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