2018-06-27 14:38:27 +00:00
|
|
|
<template>
|
2018-07-16 11:20:24 +00:00
|
|
|
<nav class="frappe-navbar navbar navbar-light bg-light row no-gutters border-bottom">
|
2018-07-12 15:17:46 +00:00
|
|
|
<form v-if="showSearch" class="form-inline col-4 pr-3">
|
|
|
|
<input type="text"
|
|
|
|
v-model="searchValue"
|
|
|
|
@input="updateSearch"
|
|
|
|
name="search"
|
|
|
|
class="form-control shadow-none w-100"
|
2018-07-12 16:27:23 +00:00
|
|
|
:placeholder="_('Search...')">
|
2018-07-12 15:17:46 +00:00
|
|
|
</form>
|
2018-07-12 16:27:23 +00:00
|
|
|
<div class="navbar-text">.</div>
|
2018-07-12 15:17:46 +00:00
|
|
|
</nav>
|
2018-06-27 14:38:27 +00:00
|
|
|
</template>
|
2018-07-12 15:17:46 +00:00
|
|
|
<script>
|
|
|
|
import { debounce } from 'lodash';
|
|
|
|
export default {
|
2018-07-12 16:27:23 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
searchValue: ''
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
showSearch() {
|
|
|
|
// TODO: Make this configurable
|
|
|
|
return /list|edit/.test(this.$route.path)
|
2018-07-12 15:17:46 +00:00
|
|
|
}
|
2018-07-12 16:27:23 +00:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.$root.$on('newList', () => this.searchValue = '')
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
updateSearch: debounce(function() {
|
|
|
|
this.$root.$emit('navbarSearch', this.searchValue)
|
|
|
|
}, 500)
|
|
|
|
}
|
2018-07-12 15:17:46 +00:00
|
|
|
};
|
|
|
|
</script>
|