mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 04:31:56 +08:00
keep favorite/star button's title in sync with starred status
This commit is contained in:
parent
766f437e44
commit
967b03fcfc
|
@ -141,6 +141,14 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
});
|
||||
},
|
||||
|
||||
favoriteTooltipKey: (function() {
|
||||
return this.get('starred') ? 'favorite.help.unstar' : 'favorite.help.star';
|
||||
}).property('starred'),
|
||||
|
||||
favoriteTooltip: (function() {
|
||||
return Em.String.i18n(this.get('favoriteTooltipKey'));
|
||||
}).property('favoriteTooltipKey'),
|
||||
|
||||
toggleStar: function() {
|
||||
var topic = this;
|
||||
topic.toggleProperty('starred');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
{{#if Discourse.currentUser.id}}
|
||||
<td class='star'>
|
||||
<a {{bindAttr class=":star :icon-star starred:starred"}} {{action toggleStar this target="controller"}} href='#' title='{{i18n favorite.help}}'></a>
|
||||
<a {{bindAttr class=":star :icon-star starred:starred"}} {{action toggleStar this target="controller"}} href='#' {{bindAttr title="favoriteTooltip"}}></a>
|
||||
</td>
|
||||
{{/if}}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class='container'>
|
||||
<div class='inner'>
|
||||
{{#if view.showFavoriteButton}}
|
||||
<a {{bindAttr class=":star view.topic.starred:starred"}} {{action toggleStar target="controller"}} href='#' title="{{i18n favorite.help}}"></a>
|
||||
<a {{bindAttr class=":star view.topic.starred:starred"}} {{action toggleStar target="controller"}} href='#' {{bindAttr title="favoriteTooltip"}}></a>
|
||||
{{/if}}
|
||||
{{#if view.editingTopic}}
|
||||
<input id='edit-title' type='text' {{bindAttr value="view.topic.title"}}>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{#if view.showFavoriteButton}}
|
||||
<a {{bindAttr class=":star view.topic.starred:starred"}} {{action toggleStar target="controller"}} href='#' title="{{i18n favorite.help}}"></a>
|
||||
<a {{bindAttr class=":star view.topic.starred:starred"}} {{action toggleStar target="controller"}} href='#' {{bindAttr title="view.topic.favoriteTooltip"}}></a>
|
||||
{{/if}}
|
||||
|
||||
<h1>
|
||||
|
|
|
@ -40,7 +40,7 @@ Discourse.TopicFooterButtonsView = Ember.ContainerView.extend({
|
|||
|
||||
this.addObject(Discourse.ButtonView.createWithMixins({
|
||||
textKey: 'favorite.title',
|
||||
helpKey: 'favorite.help',
|
||||
helpKeyBinding: 'controller.content.favoriteTooltipKey',
|
||||
|
||||
favoriteChanged: (function() {
|
||||
this.rerender();
|
||||
|
|
|
@ -357,7 +357,9 @@ en:
|
|||
|
||||
favorite:
|
||||
title: 'Favorite'
|
||||
help: 'add this topic to your favorites list'
|
||||
help:
|
||||
star: 'add this topic to your favorites list'
|
||||
unstar: 'remove this topic from your favorites list'
|
||||
|
||||
topics:
|
||||
none:
|
||||
|
|
|
@ -361,7 +361,9 @@ fr:
|
|||
|
||||
favorite:
|
||||
title: 'Favoris'
|
||||
help: 'ajouter cette discussion à vos favoris'
|
||||
help:
|
||||
star: 'ajouter cette discussion à vos favoris'
|
||||
unstar: 'enlever cette discussion de vos favoris'
|
||||
|
||||
topics:
|
||||
none:
|
||||
|
|
Loading…
Reference in New Issue
Block a user