Skip to content

Commit

Permalink
Support for displaying as text email
Browse files Browse the repository at this point in the history
  • Loading branch information
purwandi committed Dec 15, 2020
1 parent 6ce0b48 commit be7b58b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion deployment/docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
smtp:
image: purwandi/mailbox:1.0.2
image: purwandi/mailbox:1.0.3
container_name: mailbox
restart: unless-stopped
environment:
Expand Down
8 changes: 4 additions & 4 deletions deployment/kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ kind: Deployment
metadata:
labels:
app: mailbox
version: "1.0.1"
version: "1.0.3"
name: mailbox
spec:
replicas: 1
selector:
matchLabels:
app: mailbox
version: "1.0.1"
version: "1.0.3"
template:
metadata:
labels:
app: mailbox
version: "1.0.1"
version: "1.0.3"
spec:
containers:
- image: purwandi/mailbox:1.0.2
- image: purwandi/mailbox:1.0.3
name: mailbox
imagePullPolicy: Always
env:
Expand Down
21 changes: 16 additions & 5 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inbox</title>
<title>Mailbox</title>
<link rel="stylesheet" href="/css/app.css">
</head>
<body>
Expand All @@ -26,7 +26,7 @@
</div>
<messages-sidebar :messages="messages" :message="message" :set="setMessage"/>
</div>
<message-component :message="message" :del="deleteMessage" />
<message-component :message="message" :del="deleteMessage" :changedisplay="changeDisplay" :display="display" />
</div>
</div>

Expand Down Expand Up @@ -60,7 +60,7 @@ <h1 class="font-bold">Mailbox</h1>
<a href="/logout" class="text-red-500">Logout</a>
</div>
</div>
<div class="p-4">
<div class="px-4 py-2">
<div class="flex mb-2">
<h2 class="font-medium flex-1">{{ message.subject }}</h2>
<button type="button" @click="del($event, message)">
Expand Down Expand Up @@ -97,8 +97,13 @@ <h2 class="font-medium flex-1">{{ message.subject }}</h2>
</span>
</div>
</div>
<div class="px-4 flex">
<a href="#" @click="changedisplay($event, 'html')" class="px-6 py-2" v-bind:class="{'border-b-2 border-yellow-500': display == 'html'}">Html</a>
<a href="#" @click="changedisplay($event, 'text')" class="px-6 py-2" v-bind:class="{'border-b-2 border-yellow-500': display == 'text'}">Text</a>
</div>
<div class="flex-1 overflow-y-auto border-t border-gray-100">
<iframe class="w-full h-full" :srcdoc="message.html_body"></iframe>
<iframe v-if="display == 'html'" class="w-full h-full" :srcdoc="message.html_body"></iframe>
<div v-else class="w-full h-full p-4" v-html="message.text_body"></div>
</div>
</div>
<div v-else class="flex flex-col justify-center items-center h-screen">
Expand All @@ -111,7 +116,7 @@ <h1 class="text-lg">Empty inbox</h1>
<script>
Vue.component('message-component', {
template: '#message-template',
props: ['message', 'del']
props: ['message', 'del', 'changedisplay', 'display']
})

Vue.component('messages-sidebar', {
Expand All @@ -137,6 +142,7 @@ <h1 class="text-lg">Empty inbox</h1>
el: "#app",
data () {
return {
display: 'html',
index: 0,
messages: [],
}
Expand Down Expand Up @@ -209,6 +215,11 @@ <h1 class="text-lg">Empty inbox</h1>
setMessage(e, index) {
this.index = index
e.preventDefault()
},
changeDisplay(e, val) {
console.log(val)
this.display = val
e.preventDefault()
}
}
})
Expand Down

0 comments on commit be7b58b

Please sign in to comment.