]> BookStack Code Mirror - bookstack/blob - resources/assets/js/pages/book-show.js
Added logo selector
[bookstack] / resources / assets / js / pages / book-show.js
1
2 new Vue({
3     el: '#book-dashboard',
4     data: {
5         searching: false,
6         searchTerm: '',
7         searchResults: ''
8     },
9     methods: {
10         searchBook: function (e) {
11             e.preventDefault();
12             var term = this.searchTerm;
13             if (term.length == 0) return;
14             this.searching = true;
15             this.searchResults = '';
16             var searchUrl = this.$$.form.getAttribute('action');
17             searchUrl += '?term=' + encodeURIComponent(term);
18             this.$http.get(searchUrl, function (data) {
19                 this.$set('searchResults', data);
20             });
21         },
22         checkSearchForm: function (e) {
23             if (this.searchTerm.length < 1) {
24                 this.searching = false;
25             }
26         },
27         clearSearch: function(e) {
28             this.searching = false;
29             this.searchTerm = '';
30         }
31     }
32 });