FIX: Clicking on pin/unpin would refresh the page

This commit is contained in:
Robin Ward 2014-12-29 12:29:31 -05:00
parent 0ce93f3b29
commit 07b8dc4eca
2 changed files with 12 additions and 16 deletions

View File

@ -6,22 +6,18 @@ export default Ember.Component.extend(StringBuffer, {
hasDisplayableStatus: Em.computed.or('topic.archived','topic.closed', 'topic.pinned', 'topic.unpinned', 'topic.invisible', 'topic.archetypeObject.notDefault', 'topic.is_warning'),
rerenderTriggers: ['topic.archived', 'topic.closed', 'topic.pinned', 'topic.visible', 'topic.unpinned', 'topic.is_warning'],
watchClick: function(){
var self = this;
click: function() {
var topic = this.get('topic');
this.$('a').click(function(){
var topic = self.get('topic');
// only pin unpin for now
if (topic.get('pinned')) {
topic.clearPin();
} else {
topic.rePin();
}
// only pin unpin for now
if (topic.get('pinned')) {
topic.clearPin();
} else {
topic.rePin();
}
return false;
});
}.on('didInsertElement'),
return false;
},
canAct: function() {
return Discourse.User.current() && !this.get('disableActions');

View File

@ -9,7 +9,7 @@
<div id='topic-title'>
<div class='container'>
{{#if showStarButton}}
<a {{bind-attr class=":star starred:starred"}} {{action "toggleStar"}} href='#' {{bind-attr title="starTooltip"}}></a>
<a {{bind-attr class=":star starred:starred"}} {{action "toggleStar"}} href {{bind-attr title="starTooltip"}}></a>
{{/if}}
<div class="title-wrapper">
@ -43,7 +43,7 @@
{{/if}}
{{#if details.can_edit}}
<a href='#' {{action "editTopic"}} class='edit-topic' title='{{i18n 'edit'}}'>{{fa-icon pencil}}</a>
<a href {{action "editTopic"}} class='edit-topic' title='{{i18n 'edit'}}'>{{fa-icon pencil}}</a>
{{/if}}
</h1>