mirror of
https://github.com/TryGhost/Ghost-Admin.git
synced 2023-12-14 02:33:04 +01:00
c2605a32ae
no issue - removed unused `<GhTagsManagementContainer>` component and related `isMobile` CPs - un-nested `tag` and `tag.new` routes - nested routes in Ember are used for nested UI but these are both separate screens - removes usage of `selectedTag` property in favour of using Ember's built-in model handling - removed unnecessary `tags/new` controller - sets up `tag.new` route which extends the `tag` route to avoid duplicate code
30 lines
824 B
JavaScript
30 lines
824 B
JavaScript
import Controller from '@ember/controller';
|
|
import {alias, sort} from '@ember/object/computed';
|
|
import {computed} from '@ember/object';
|
|
|
|
export default Controller.extend({
|
|
|
|
queryParams: ['type'],
|
|
type: 'public',
|
|
|
|
tags: alias('model'),
|
|
|
|
filteredTags: computed('tags.@each.isNew', 'type', function () {
|
|
return this.tags.filter((tag) => {
|
|
return (!tag.isNew && (!this.type || tag.visibility === this.type));
|
|
});
|
|
}),
|
|
|
|
// tags are sorted by name
|
|
sortedTags: sort('filteredTags', function (tagA, tagB) {
|
|
// ignorePunctuation means the # in internal tag names is ignored
|
|
return tagA.name.localeCompare(tagB.name, undefined, {ignorePunctuation: true});
|
|
}),
|
|
|
|
actions: {
|
|
changeType(type) {
|
|
this.set('type', type);
|
|
}
|
|
}
|
|
});
|