diff options
author | Ghassen Rjab <rjab.ghassen@gmail.com> | 2018-02-23 01:09:59 +0100 |
---|---|---|
committer | Ghassen Rjab <rjab.ghassen@gmail.com> | 2018-02-23 01:09:59 +0100 |
commit | 636e1657f6e03eb966aca1aacbc50bb71f86ab3b (patch) | |
tree | 998d5b9c7d148ceebb15fe37ad2a9229357e6f4d /client/components/sidebar | |
parent | 2001c01b4ddcf49e830a754e8b451308d78c3783 (diff) | |
download | wekan-636e1657f6e03eb966aca1aacbc50bb71f86ab3b.tar.gz wekan-636e1657f6e03eb966aca1aacbc50bb71f86ab3b.tar.bz2 wekan-636e1657f6e03eb966aca1aacbc50bb71f86ab3b.zip |
Add search sidebar
Diffstat (limited to 'client/components/sidebar')
-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% |