mirror of
https://github.com/discourse/discourse.git
synced 2025-06-20 17:41:33 +08:00
UX: indicate active tag sorting method
This commit is contained in:
@ -2,6 +2,8 @@ import computed from 'ember-addons/ember-computed-decorators';
|
|||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
sortProperties: ['count:desc', 'id'],
|
sortProperties: ['count:desc', 'id'],
|
||||||
|
sortedByCount: true,
|
||||||
|
sortedByName: false,
|
||||||
|
|
||||||
canAdminTags: Ember.computed.alias("currentUser.staff"),
|
canAdminTags: Ember.computed.alias("currentUser.staff"),
|
||||||
groupedByCategory: Ember.computed.notEmpty('model.extras.categories'),
|
groupedByCategory: Ember.computed.notEmpty('model.extras.categories'),
|
||||||
@ -18,11 +20,19 @@ export default Ember.Controller.extend({
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
sortByCount() {
|
sortByCount() {
|
||||||
this.set('sortProperties', ['count:desc', 'id']);
|
this.setProperties({
|
||||||
|
sortProperties: ['count:desc', 'id'],
|
||||||
|
sortedByCount: true,
|
||||||
|
sortedByName: false
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
sortById() {
|
sortById() {
|
||||||
this.set('sortProperties', ['id']);
|
this.setProperties({
|
||||||
|
sortProperties: ['id'],
|
||||||
|
sortedByCount: false,
|
||||||
|
sortedByName: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,14 +1,24 @@
|
|||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
sortProperties: ['count:desc', 'id'],
|
sortProperties: ['count:desc', 'id'],
|
||||||
tagsForUser: null,
|
tagsForUser: null,
|
||||||
|
sortedByCount: true,
|
||||||
|
sortedByName: false,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
sortByCount() {
|
sortByCount() {
|
||||||
this.set('sortProperties', ['count:desc', 'id']);
|
this.setProperties({
|
||||||
|
sortProperties: ['count:desc', 'id'],
|
||||||
|
sortedByCount: true,
|
||||||
|
sortedByName: false
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
sortById() {
|
sortById() {
|
||||||
this.set('sortProperties', ['id']);
|
this.setProperties({
|
||||||
|
sortProperties: ['id'],
|
||||||
|
sortedByCount: false,
|
||||||
|
sortedByName: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
<div class='tag-sort-options'>
|
<div class='tag-sort-options'>
|
||||||
{{i18n "tagging.sort_by"}}
|
{{i18n "tagging.sort_by"}}
|
||||||
<a {{action "sortByCount"}}>{{i18n "tagging.sort_by_count"}}</a>
|
<span class="tag-sort-count {{if sortedByCount 'active'}}"><a {{action "sortByCount"}}>{{i18n "tagging.sort_by_count"}}</a></span>
|
||||||
<a {{action "sortById"}}>{{i18n "tagging.sort_by_name"}}</a>
|
<span class="tag-sort-name {{if sortedByName 'active'}}"><a {{action "sortById"}}>{{i18n "tagging.sort_by_name"}}</a></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
<div class='tag-sort-options'>
|
<div class='tag-sort-options'>
|
||||||
{{i18n "tagging.sort_by"}}
|
{{i18n "tagging.sort_by"}}
|
||||||
<a {{action "sortByCount"}}>{{i18n "tagging.sort_by_count"}}</a>
|
<span class="tag-sort-count {{if sortedByCount 'active'}}"><a {{action "sortByCount"}}>{{i18n "tagging.sort_by_count"}}</a></span>
|
||||||
<a {{action "sortById"}}>{{i18n "tagging.sort_by_name"}}</a>
|
<span class="tag-sort-name {{if sortedByName 'active'}}"><a {{action "sortById"}}>{{i18n "tagging.sort_by_name"}}</a></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
@ -206,6 +206,9 @@ header .discourse-tag {color: $tag-color }
|
|||||||
a {
|
a {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
span.active a {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.autocomplete {
|
.autocomplete {
|
||||||
|
Reference in New Issue
Block a user