mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 09:03:12 +03:00
Changed content filters to show "unknown" if a deleted tag/author is selected
refs https://github.com/TryGhost/Ghost-Admin/pull/1474 - show some indicitive text rather than a blank dropdown button when type/author/tag/order query param is present but doesn't match something in our data sets (eg, if a tag/author has been deleted or a query param has been incorrectly typed)
This commit is contained in:
parent
9cad64cd76
commit
d873f929e1
@ -65,12 +65,12 @@ export default Controller.extend({
|
||||
|
||||
selectedType: computed('type', function () {
|
||||
let types = this.get('availableTypes');
|
||||
return types.findBy('value', this.get('type'));
|
||||
return types.findBy('value', this.get('type')) || {value: '!unknown'};
|
||||
}),
|
||||
|
||||
selectedOrder: computed('order', function () {
|
||||
let orders = this.get('availableOrders');
|
||||
return orders.findBy('value', this.get('order'));
|
||||
return orders.findBy('value', this.get('order')) || {value: '!unknown'};
|
||||
}),
|
||||
|
||||
_availableTags: computed(function () {
|
||||
@ -82,7 +82,6 @@ export default Controller.extend({
|
||||
.filter(tag => tag.get('id') !== null)
|
||||
.sort((tagA, tagB) => tagA.name.localeCompare(tagB.name, undefined, {ignorePunctuation: true}));
|
||||
let options = tags.toArray();
|
||||
|
||||
options.unshiftObject({name: 'All tags', slug: null});
|
||||
|
||||
return options;
|
||||
@ -92,7 +91,7 @@ export default Controller.extend({
|
||||
let tag = this.get('tag');
|
||||
let tags = this.get('availableTags');
|
||||
|
||||
return tags.findBy('slug', tag);
|
||||
return tags.findBy('slug', tag) || {slug: '!unknown'};
|
||||
}),
|
||||
|
||||
_availableAuthors: computed(function () {
|
||||
@ -112,7 +111,7 @@ export default Controller.extend({
|
||||
let author = this.get('author');
|
||||
let authors = this.get('availableAuthors');
|
||||
|
||||
return authors.findBy('slug', author);
|
||||
return authors.findBy('slug', author) || {slug: '!unknown'};
|
||||
}),
|
||||
|
||||
actions: {
|
||||
|
@ -13,7 +13,7 @@
|
||||
data-test-type-select="true"
|
||||
as |type|
|
||||
>
|
||||
{{type.name}}
|
||||
{{#if type.name}}{{type.name}}{{else}}<span class="red">Unknown type</span>{{/if}}
|
||||
</PowerSelect>
|
||||
{{/unless}}
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
data-test-author-select="true"
|
||||
as |author|
|
||||
>
|
||||
{{author.name}}
|
||||
{{#if author.name}}{{author.name}}{{else}}<span class="red">Unknown author</span>{{/if}}
|
||||
</PowerSelect>
|
||||
{{/unless}}
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
data-test-tag-select="true"
|
||||
as |tag|
|
||||
>
|
||||
{{tag.name}}
|
||||
{{#if tag.name}}{{tag.name}}{{else}}<span class="red">Unknown tag</span>{{/if}}
|
||||
</PowerSelect>
|
||||
{{/unless}}
|
||||
|
||||
@ -69,6 +69,6 @@
|
||||
@data-test-order-select="true"
|
||||
as |order|
|
||||
>
|
||||
{{order.name}}
|
||||
{{#if order.name}}{{order.name}}{{else}}<span class="red">Unknown</span>{{/if}}
|
||||
</PowerSelect>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user