mirror of
https://github.com/frappe/books.git
synced 2024-11-14 09:24:04 +00:00
Refactor code
This commit is contained in:
parent
8bff2e42fb
commit
5d60955856
@ -2,7 +2,7 @@
|
|||||||
<div class="frappe-desk row no-gutters">
|
<div class="frappe-desk row no-gutters">
|
||||||
<frappe-sidebar :sidebarConfig="sidebarConfig"></frappe-sidebar>
|
<frappe-sidebar :sidebarConfig="sidebarConfig"></frappe-sidebar>
|
||||||
<frappe-main>
|
<frappe-main>
|
||||||
<frappe-navbar :showSearch="showSearch"></frappe-navbar>
|
<frappe-navbar></frappe-navbar>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</frappe-main>
|
</frappe-main>
|
||||||
</div>
|
</div>
|
||||||
@ -19,11 +19,6 @@ export default {
|
|||||||
FrappeMain: Main,
|
FrappeMain: Main,
|
||||||
FrappeNavbar: Navbar
|
FrappeNavbar: Navbar
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
showSearch() {
|
|
||||||
return /list|edit/.test(this.$route.path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
@ -53,8 +53,8 @@ export default {
|
|||||||
frappe.db.on(`change:${this.doctype}`, () => {
|
frappe.db.on(`change:${this.doctype}`, () => {
|
||||||
this.updateList();
|
this.updateList();
|
||||||
});
|
});
|
||||||
this.$root.$on('search', this.updateList)
|
this.$root.$on('navbarSearch', this.updateList);
|
||||||
this.$root.$emit('newList')
|
this.$root.$emit('newList');
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.updateList();
|
this.updateList();
|
||||||
|
@ -6,27 +6,34 @@
|
|||||||
@input="updateSearch"
|
@input="updateSearch"
|
||||||
name="search"
|
name="search"
|
||||||
class="form-control shadow-none w-100"
|
class="form-control shadow-none w-100"
|
||||||
placeholder="Search...">
|
:placeholder="_('Search...')">
|
||||||
</form>
|
</form>
|
||||||
<div class="navbar-text">HI</div>
|
<div class="navbar-text">.</div>
|
||||||
</nav>
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
export default {
|
export default {
|
||||||
props: ["showSearch"],
|
props: ['showSearch'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
searchValue: ''
|
searchValue: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
showSearch() {
|
||||||
|
// TODO: Make this configurable
|
||||||
|
return /list|edit/.test(this.$route.path)
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$root.$on('newList', () => this.searchValue = '')
|
this.$root.$on('newList', () => this.searchValue = '')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateSearch: debounce(function() {
|
updateSearch: debounce(function() {
|
||||||
this.$root.$emit("search", this.searchValue);
|
this.$root.$emit('navbarSearch', this.searchValue)
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user