diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/components/sidebar/sidebar.js | 1 | ||||
-rw-r--r-- | client/components/sidebar/sidebarSearches.jade | 8 | ||||
-rw-r--r-- | client/components/sidebar/sidebarSearches.js | 19 | ||||
-rw-r--r-- | client/components/sidebar/sidebarSearches.styl | 2 |
4 files changed, 30 insertions, 0 deletions
diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index f4f0c118..e4a7c409 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -4,6 +4,7 @@ const defaultView = 'home'; const viewTitles = { filter: 'filter-cards', + search: 'search-cards', multiselection: 'multi-selection', archives: 'archives', }; diff --git a/client/components/sidebar/sidebarSearches.jade b/client/components/sidebar/sidebarSearches.jade new file mode 100644 index 00000000..2ad5b00f --- /dev/null +++ b/client/components/sidebar/sidebarSearches.jade @@ -0,0 +1,8 @@ +template(name="searchSidebar") + form.js-search-term-form + input(type="text" name="searchTerm" placeholder="{{_ 'search-example'}}" autofocus) + .list-body.js-perfect-scrollbar + .minicards.clearfix.js-minicards + each (results) + a.minicard-wrapper.js-minicard(href=absoluteUrl) + +minicard(this) diff --git a/client/components/sidebar/sidebarSearches.js b/client/components/sidebar/sidebarSearches.js new file mode 100644 index 00000000..111a86b8 --- /dev/null +++ b/client/components/sidebar/sidebarSearches.js @@ -0,0 +1,19 @@ +BlazeComponent.extendComponent({ + onCreated() { + this.term = new ReactiveVar(''); + }, + + results() { + const currentBoard = Boards.findOne(Session.get('currentBoard')); + return currentBoard.searchCards(this.term.get()); + }, + + events() { + return [{ + 'submit .js-search-term-form'(evt) { + evt.preventDefault(); + this.term.set(evt.target.searchTerm.value); + }, + }]; + }, +}).register('searchSidebar'); diff --git a/client/components/sidebar/sidebarSearches.styl b/client/components/sidebar/sidebarSearches.styl new file mode 100644 index 00000000..6b8ad904 --- /dev/null +++ b/client/components/sidebar/sidebarSearches.styl @@ -0,0 +1,2 @@ +input + max-width: 100% |