Support for deleting small post actions

This commit is contained in:
Robin Ward 2015-07-28 16:27:39 -04:00
parent e09e5016ce
commit 510813769f
4 changed files with 16 additions and 3 deletions

View File

@ -30,6 +30,10 @@ export default Ember.Component.extend({
actions: { actions: {
edit: function() { edit: function() {
this.sendAction('editPost', this.get('post')); this.sendAction('editPost', this.get('post'));
},
delete: function() {
this.sendAction('deletePost', this.get('post'));
} }
} }

View File

@ -1,8 +1,11 @@
<div class='topic-avatar'>{{fa-icon icon}}</div> <div class='topic-avatar'>{{fa-icon icon}}</div>
<div class='small-action-desc'> <div class='small-action-desc'>
{{#if post}} {{#if post}}
{{#if post.can_delete}}
<button {{action "delete"}} title={{i18n "post.controls.delete"}}>{{fa-icon "times"}}</button>
{{/if}}
{{#if post.can_edit}} {{#if post.can_edit}}
<button {{action "edit"}} title="{{i18n "post.controls.edit"}}">{{fa-icon "pencil"}}</button> <button {{action "edit"}} title={{i18n "post.controls.edit"}}>{{fa-icon "pencil"}}</button>
{{/if}} {{/if}}
<a href={{post.usernameUrl}} data-user-card={{post.username}}> <a href={{post.usernameUrl}} data-user-card={{post.username}}>
{{avatar post imageSize="small"}} {{avatar post imageSize="small"}}

View File

@ -1,3 +1,9 @@
{{post-gap post=this postStream=controller.model.postStream before="true"}} {{post-gap post=this postStream=controller.model.postStream before="true"}}
{{small-action actionCode=action_code post=this daysAgo=view.daysAgo editPost="editPost"}}
{{small-action actionCode=action_code
post=this
daysAgo=view.daysAgo
editPost="editPost"
deletePost="deletePost"}}
{{post-gap post=this postStream=controller.model.postStream before="false"}} {{post-gap post=this postStream=controller.model.postStream before="false"}}

View File

@ -587,7 +587,7 @@ a.mention {
} }
.deleted { .deleted {
.topic-body { .topic-body, .small-action {
background-color: dark-light-diff(rgba($danger,.7), $secondary, 50%, -60%); background-color: dark-light-diff(rgba($danger,.7), $secondary, 50%, -60%);
} }
} }