-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: Added UI for adding and removing watched and muted categories
- Loading branch information
1 parent
1b259c5
commit 2da5d23
Showing
14 changed files
with
187 additions
and
13 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
app/assets/javascripts/discourse/components/category_group_component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Discourse.CategoryGroupComponent = Ember.Component.extend({ | ||
|
||
didInsertElement: function(){ | ||
var self = this; | ||
|
||
this.$('input').autocomplete({ | ||
items: this.get('categories'), | ||
single: false, | ||
allowAny: false, | ||
dataSource: function(term){ | ||
return Discourse.Category.list().filter(function(category){ | ||
var regex = new RegExp(term, "i"); | ||
return category.get("name").match(regex) && | ||
!_.contains(self.get('categories'), category); | ||
}); | ||
}, | ||
onChangeItems: function(items) { | ||
self.set("categories", items); | ||
}, | ||
template: Discourse.CategoryGroupComponent.templateFunction(), | ||
transformComplete: function(category){ | ||
return Discourse.HTML.categoryLink(category); | ||
} | ||
}); | ||
} | ||
|
||
}); | ||
|
||
Discourse.CategoryGroupComponent.reopenClass({ | ||
templateFunction: function(){ | ||
this.compiled = this.compiled || Handlebars.compile("<div class='autocomplete'>" + | ||
"<ul>" + | ||
"{{#each options}}" + | ||
"<li>" + | ||
"{{categoryLinkRaw this}}" + | ||
"</li>" + | ||
"{{/each}}" + | ||
"</ul>" + | ||
"</div>"); | ||
return this.compiled; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
app/assets/javascripts/discourse/templates/components/category-group.js.handlebars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<input class='category-group' type='text'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters