FIX: tag filter shows when "no tags" is selected
This commit is contained in:
parent
b617557cb4
commit
e52c0e2087
|
@ -20,30 +20,39 @@ export default Ember.Component.extend({
|
|||
}
|
||||
},
|
||||
|
||||
iconClass: function() {
|
||||
@computed('expanded')
|
||||
iconClass() {
|
||||
if (this.get('expanded')) { return "fa fa-caret-down"; }
|
||||
return "fa fa-caret-right";
|
||||
}.property('expanded'),
|
||||
},
|
||||
|
||||
tagClass: function() {
|
||||
@computed('tagId')
|
||||
tagClass() {
|
||||
if (this.get('tagId')) {
|
||||
return "tag-" + this.get('tagId');
|
||||
} else {
|
||||
return "tag_all";
|
||||
}
|
||||
}.property('tagId'),
|
||||
},
|
||||
|
||||
allTagsUrl: function() {
|
||||
@computed('firstCategory', 'secondCategory')
|
||||
allTagsUrl() {
|
||||
if (this.get('currentCategory')) {
|
||||
return this.get('currentCategory.url') + "?allTags=1";
|
||||
} else {
|
||||
return "/";
|
||||
}
|
||||
}.property('firstCategory', 'secondCategory'),
|
||||
},
|
||||
|
||||
allTagsLabel: function() {
|
||||
@computed('tag')
|
||||
allTagsLabel() {
|
||||
return I18n.t("tagging.selector_all_tags");
|
||||
}.property('tag'),
|
||||
},
|
||||
|
||||
@computed('tagId')
|
||||
noTagsSelected() {
|
||||
return this.get('tagId') === 'none';
|
||||
},
|
||||
|
||||
@computed('firstCategory', 'secondCategory')
|
||||
noTagsUrl() {
|
||||
|
@ -59,17 +68,19 @@ export default Ember.Component.extend({
|
|||
return I18n.t("tagging.selector_no_tags");
|
||||
},
|
||||
|
||||
dropdownButtonClass: function() {
|
||||
@computed('tag')
|
||||
dropdownButtonClass() {
|
||||
var result = 'badge-category category-dropdown-button';
|
||||
if (Em.isNone(this.get('tag'))) {
|
||||
result += ' home';
|
||||
}
|
||||
return result;
|
||||
}.property('tag'),
|
||||
},
|
||||
|
||||
clickEventName: function() {
|
||||
@computed('tag')
|
||||
clickEventName() {
|
||||
return "click.tag-drop-" + (this.get('tag') || "all");
|
||||
}.property('tag'),
|
||||
},
|
||||
|
||||
actions: {
|
||||
expand: function() {
|
||||
|
|
|
@ -11,7 +11,7 @@ export default Discourse.Route.extend({
|
|||
},
|
||||
|
||||
model(params) {
|
||||
var tag = (params.tag_id === 'none' ? null : this.store.createRecord("tag", { id: Handlebars.Utils.escapeExpression(params.tag_id) })),
|
||||
var tag = this.store.createRecord("tag", { id: Handlebars.Utils.escapeExpression(params.tag_id) }),
|
||||
f = '';
|
||||
|
||||
if (params.category) {
|
||||
|
@ -25,7 +25,7 @@ export default Discourse.Route.extend({
|
|||
if (params.category) { this.set('categorySlug', params.category); }
|
||||
if (params.parent_category) { this.set('parentCategorySlug', params.parent_category); }
|
||||
|
||||
if (tag && this.get("currentUser")) {
|
||||
if (tag && tag.get("id") !== "none" && this.get("currentUser")) {
|
||||
// If logged in, we should get the tag's user settings
|
||||
return this.store.find("tagNotification", tag.get("id")).then(tn => {
|
||||
this.set("tagNotification", tn);
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
{{#if showTagDropdown}}
|
||||
{{#if tagId}}
|
||||
<a href {{action "expand"}} class="badge-category {{tagClass}}">{{tagId}}</a>
|
||||
{{#if noTagsSelected}}
|
||||
<a href {{action "expand"}} class="badge-category {{tagClass}} home">{{noTagsLabel}}</a>
|
||||
{{else}}
|
||||
<a href {{action "expand"}} class="badge-category {{tagClass}}">{{tagId}}</a>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<!-- TODO: how to detect "no tags" is currently selected -->
|
||||
<a href {{action "expand"}} class="badge-category {{tagClass}} home">{{allTagsLabel}}</a>
|
||||
{{/if}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue