]> BookStack Code Mirror - bookstack/blob - resources/js/components/user-select.js
Merge branch 'feature_add_add-button_to_home_view' of git://github.com/philjak/BookSt...
[bookstack] / resources / js / components / user-select.js
1 import {onChildEvent} from "../services/dom";
2
3 class UserSelect {
4
5     setup() {
6
7         this.input = this.$refs.input;
8         this.userInfoContainer = this.$refs.userInfo;
9
10         this.hide = this.$el.components.dropdown.hide;
11
12         onChildEvent(this.$el, 'a.dropdown-search-item', 'click', this.selectUser.bind(this));
13     }
14
15     selectUser(event, userEl) {
16         const id = userEl.getAttribute('data-id');
17         this.input.value = id;
18         this.userInfoContainer.innerHTML = userEl.innerHTML;
19         this.hide();
20     }
21
22 }
23
24 export default UserSelect;