FIX: watched word counts always show as 0
This commit is contained in:
parent
ddefc29c4e
commit
90c0198a57
|
@ -10,11 +10,11 @@ export default Ember.Controller.extend({
|
|||
return (this.get('adminWatchedWords.model') || []).findBy('nameKey', actionName);
|
||||
},
|
||||
|
||||
@computed('adminWatchedWords.model', 'actionNameKey')
|
||||
filteredContent() {
|
||||
if (!this.get('actionNameKey')) { return []; }
|
||||
@computed('actionNameKey', 'adminWatchedWords.model')
|
||||
filteredContent(actionNameKey) {
|
||||
if (!actionNameKey) { return []; }
|
||||
|
||||
const a = this.findAction(this.get('actionNameKey'));
|
||||
const a = this.findAction(actionNameKey);
|
||||
return a ? a.words : [];
|
||||
},
|
||||
|
||||
|
@ -23,6 +23,12 @@ export default Ember.Controller.extend({
|
|||
return I18n.t('admin.watched_words.action_descriptions.' + actionNameKey);
|
||||
},
|
||||
|
||||
@computed('actionNameKey', 'adminWatchedWords.model')
|
||||
wordCount(actionNameKey) {
|
||||
const a = this.findAction(actionNameKey);
|
||||
return a ? a.words.length : 0;
|
||||
},
|
||||
|
||||
actions: {
|
||||
recordAdded(arg) {
|
||||
const a = this.findAction(this.get('actionNameKey'));
|
||||
|
|
|
@ -22,6 +22,6 @@
|
|||
<div class="watched-word-box">{{admin-watched-word word=word action="recordRemoved"}}</div>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
{{i18n 'admin.watched_words.word_count' count=model.words.length}}
|
||||
{{i18n 'admin.watched_words.word_count' count=wordCount}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue