mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:38:39 +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() {
|
toggleStar: function() {
|
||||||
var topic = this;
|
var topic = this;
|
||||||
topic.toggleProperty('starred');
|
topic.toggleProperty('starred');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
{{#if Discourse.currentUser.id}}
|
{{#if Discourse.currentUser.id}}
|
||||||
<td class='star'>
|
<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>
|
</td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div class='container'>
|
<div class='container'>
|
||||||
<div class='inner'>
|
<div class='inner'>
|
||||||
{{#if view.showFavoriteButton}}
|
{{#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}}
|
||||||
{{#if view.editingTopic}}
|
{{#if view.editingTopic}}
|
||||||
<input id='edit-title' type='text' {{bindAttr value="view.topic.title"}}>
|
<input id='edit-title' type='text' {{bindAttr value="view.topic.title"}}>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{#if view.showFavoriteButton}}
|
{{#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}}
|
{{/if}}
|
||||||
|
|
||||||
<h1>
|
<h1>
|
||||||
|
@ -40,7 +40,7 @@ Discourse.TopicFooterButtonsView = Ember.ContainerView.extend({
|
|||||||
|
|
||||||
this.addObject(Discourse.ButtonView.createWithMixins({
|
this.addObject(Discourse.ButtonView.createWithMixins({
|
||||||
textKey: 'favorite.title',
|
textKey: 'favorite.title',
|
||||||
helpKey: 'favorite.help',
|
helpKeyBinding: 'controller.content.favoriteTooltipKey',
|
||||||
|
|
||||||
favoriteChanged: (function() {
|
favoriteChanged: (function() {
|
||||||
this.rerender();
|
this.rerender();
|
||||||
|
@ -357,7 +357,9 @@ en:
|
|||||||
|
|
||||||
favorite:
|
favorite:
|
||||||
title: '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:
|
topics:
|
||||||
none:
|
none:
|
||||||
|
@ -361,7 +361,9 @@ fr:
|
|||||||
|
|
||||||
favorite:
|
favorite:
|
||||||
title: 'Favoris'
|
title: 'Favoris'
|
||||||
help: 'ajouter cette discussion à vos favoris'
|
help:
|
||||||
|
star: 'ajouter cette discussion à vos favoris'
|
||||||
|
unstar: 'enlever cette discussion de vos favoris'
|
||||||
|
|
||||||
topics:
|
topics:
|
||||||
none:
|
none:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user