summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bucky/app/bucky.js3
-rw-r--r--bucky/app/router.js10
-rw-r--r--fortune/hoots1
-rw-r--r--public/assets/css/bucky.css6
-rw-r--r--public/assets/js/lib/views/mail/mailbox.js7
-rw-r--r--public/assets/js/lib/views/mail/message.js10
-rw-r--r--views/pages/mailbox.ejs4
-rw-r--r--views/pages/message.ejs2
8 files changed, 30 insertions, 13 deletions
diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js
index 5fb58bf..47ad187 100644
--- a/bucky/app/bucky.js
+++ b/bucky/app/bucky.js
@@ -530,4 +530,7 @@ var bucky = module.exports = {
next()
})
},
+ destroyMessage: function(req, res, next) {
+ res.message.destroy().then( () => next() )
+ },
} \ No newline at end of file
diff --git a/bucky/app/router.js b/bucky/app/router.js
index 56e1f36..7fbf479 100644
--- a/bucky/app/router.js
+++ b/bucky/app/router.js
@@ -301,8 +301,14 @@ module.exports = function(app){
bucky.deleteDraft,
function(req, res){
res.json({ status: "ok" })
- }
- )
+ })
+ app.delete("/api/message/:id",
+ middleware.ensureAuthenticated,
+ bucky.ensureMessage,
+ bucky.destroyMessage,
+ function(req, res){
+ res.json({ status: "ok" })
+ })
auth.route(app)
}
diff --git a/fortune/hoots b/fortune/hoots
index 13de5a0..f3ef99c 100644
--- a/fortune/hoots
+++ b/fortune/hoots
@@ -40,4 +40,3 @@ melt
bark
sup?
omgg
-reee
diff --git a/public/assets/css/bucky.css b/public/assets/css/bucky.css
index a5dcd55..ce55bfa 100644
--- a/public/assets/css/bucky.css
+++ b/public/assets/css/bucky.css
@@ -250,7 +250,7 @@ table, tr {
display: block;
padding: 4px 5px;
text-decoration: none;
- color: #444;
+ color: #222;
}
#threads td:nth-child(6) {
text-align: center;
@@ -800,7 +800,8 @@ pre br {
#message {
text-align: left;
max-width: 500px;
- margin-top: 10px;
+ margin-top: 20px;
+ margin-left: 40px;
}
#message .av {
float: left;
@@ -808,6 +809,7 @@ pre br {
width: 40px;
height: 40px;
background: #fff;
+ background-size: cover;
}
#message > span {
display: inline-block;
diff --git a/public/assets/js/lib/views/mail/mailbox.js b/public/assets/js/lib/views/mail/mailbox.js
index 860d200..b7877f2 100644
--- a/public/assets/js/lib/views/mail/mailbox.js
+++ b/public/assets/js/lib/views/mail/mailbox.js
@@ -54,20 +54,23 @@ var MailboxView = View.extend({
.replace(/{{size_class}}/g, size[0] )
var $t = $(t)
if (is_sender) {
- $t.find('reply_link').remove()
+ $t.find('.reply_link').remove()
}
return $t
},
discard: function(e){
var id = $(e.target).data('id')
+ var ok = confirm("Really delete this message?")
+ if (! ok) return
$.ajax({
method: 'delete',
url: '/api/message/' + id,
+ headers: { "csrf-token": csrf() },
+ data: { _csrf: csrf() },
success: function(){ window.location.reload() },
error: function(){ window.location.reload() },
})
},
-
})
diff --git a/public/assets/js/lib/views/mail/message.js b/public/assets/js/lib/views/mail/message.js
index 400c11e..c765b0a 100644
--- a/public/assets/js/lib/views/mail/message.js
+++ b/public/assets/js/lib/views/mail/message.js
@@ -45,18 +45,22 @@ var MessageView = View.extend({
.replace(/{{body}}/g, tidy_urls(message.body) )
var $t = $(t)
if (is_sender) {
- $t.find('reply_link').remove()
+ $t.find('.reply_link').remove()
}
this.$el.empty().append($t)
},
discard: function(e){
var id = $(e.target).data('id')
+ var ok = confirm("Really delete this message?")
+ if (! ok) return
$.ajax({
method: 'delete',
url: '/api/message/' + id,
- success: function(){ window.location.reload() },
- error: function(){ window.location.reload() },
+ headers: { "csrf-token": csrf() },
+ data: { _csrf: csrf() },
+ success: function(){ window.location.href = "/mail" },
+ error: function(){ window.location.href = "/mail" },
})
},
diff --git a/views/pages/mailbox.ejs b/views/pages/mailbox.ejs
index 19938d0..386e857 100644
--- a/views/pages/mailbox.ejs
+++ b/views/pages/mailbox.ejs
@@ -26,11 +26,11 @@
<span class="{{size_class}}">{{size}}</span>
</td>
<td>
- <span class='reply-link'>
+ <span class='reply_link'>
<a href='/mail/reply/{{id}}'>reply</a>
&middot;
</span>
- <a href='#' class='discard-link' data-id='{{id}}'>discard</a>
+ <a href='#' class='discard_link' data-id='{{id}}'>discard</a>
</td>
</tr>
</script>
diff --git a/views/pages/message.ejs b/views/pages/message.ejs
index 6382b25..d46b5fb 100644
--- a/views/pages/message.ejs
+++ b/views/pages/message.ejs
@@ -6,7 +6,7 @@
<div class="bluebox" id="message">
<script class="template" type="text/html">
- <a href="/profile/{{sender}}" class="av"><img src="/data/profile/{{sender}}.jpg"></a>
+ <a href="/profile/{{sender}}" class="av" style="background-image:url(/data/profile/{{sender}}.jpg);"></a>
<span class="subject">{{subject}}</span>
<span class="sender">
sent by