FEATURE: Tags display on knowledge explorer
This commit is contained in:
parent
64555d5362
commit
d62e856fc5
|
@ -0,0 +1,13 @@
|
||||||
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
import DiscourseURL from "discourse/lib/url";
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
@computed("category", "tag")
|
||||||
|
href(category, tag) {
|
||||||
|
return "/knowledge-explorer";
|
||||||
|
},
|
||||||
|
|
||||||
|
click() {
|
||||||
|
DiscourseURL.routeTo(this.href, { replaceURL: true });
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,23 @@
|
||||||
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||||
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
|
||||||
|
function sortAlpha(a, b) {
|
||||||
|
let aName = a.id.toLowerCase();
|
||||||
|
let bName = b.id.toLowerCase();
|
||||||
|
return aName < bName ? -1 : aName > bName ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sortCount(a, b) {
|
||||||
|
let aCount = a.count;
|
||||||
|
let bCount = b.count;
|
||||||
|
|
||||||
|
return bCount - aCount || a.id.localeCompare(b.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
let cachedResults = null;
|
||||||
|
let lastFetchDate = null;
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
classNames: "knowledge-explorer-tags"
|
||||||
|
});
|
|
@ -0,0 +1,9 @@
|
||||||
|
<div class="knowledge-explorer-tag {{if tag.active 'selected'}} {{if subtag 'subtag'}}">
|
||||||
|
{{#unless tag.active}}
|
||||||
|
{{d-icon "plus"}}
|
||||||
|
{{/unless}}
|
||||||
|
{{tag.id}} <span class="tag-count">({{tag.count}})</span>
|
||||||
|
{{#if tag.active}}
|
||||||
|
{{d-icon "times-circle"}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
|
@ -0,0 +1,11 @@
|
||||||
|
{{#each model.tags as |tag|}}
|
||||||
|
{{knowledge-explorer-tag tag=tag}}
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
{{#if subtags}}
|
||||||
|
{{#each subtags as |tag|}}
|
||||||
|
{{knowledge-explorer-tag
|
||||||
|
tag=tag
|
||||||
|
subtag=true}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
|
@ -1,3 +1,6 @@
|
||||||
<div class="knowledge-explorer">
|
<div class="knowledge-explorer">
|
||||||
|
{{knowledge-explorer-tags
|
||||||
|
model=model
|
||||||
|
searchResults=searchResults}}
|
||||||
{{knowledge-explorer-topic-list model=model}}
|
{{knowledge-explorer-topic-list model=model}}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue