fix: clear filter button layout

This commit is contained in:
Shivam Mishra 2019-10-29 12:10:55 +05:30
parent 5fe4bc45c5
commit e4c21740d0
3 changed files with 10 additions and 13 deletions

View file

@ -289,7 +289,7 @@ frappe.ui.Filter = class {
make_tag() {
this.$filter_tag = this.get_filter_tag_element()
.insertAfter(this.parent.find(".active-tag-filters .add-filter"));
.insertAfter(this.parent.find(".active-tag-filters .clear-filters"));
this.set_filter_button_text();
this.bind_tag();
}

View file

@ -4,6 +4,7 @@ frappe.ui.FilterGroup = class {
this.wrapper = this.parent;
this.filters = [];
this.make();
window.fltr = this;
}
make() {
@ -13,7 +14,8 @@ frappe.ui.FilterGroup = class {
}
toggle_clear_filter() {
let clear_filter_button = this.wrapper.find('.remove-filters');
let clear_filter_button = this.wrapper.find('.clear-filters');
if (this.filters.length == 0) {
clear_filter_button.hide();
} else {
@ -26,7 +28,7 @@ frappe.ui.FilterGroup = class {
.then(this.toggle_clear_filter());
});
this.wrapper.find('.remove-filters').on('click', () => {
this.wrapper.find('.clear-filters').on('click', () => {
this.clear_filters();
});
}
@ -38,6 +40,8 @@ frappe.ui.FilterGroup = class {
promises.push(() => this.add_filter(...filter));
}
promises.push()
return frappe.run_serially(promises);
}
@ -155,9 +159,9 @@ frappe.ui.FilterGroup = class {
return $(`<div class="tag-filters-area">
<div class="active-tag-filters">
<button class="btn btn-default btn-xs filter-button text-muted add-filter">
${__("Add Filter")}
${__("Add Filter")}
</button>
<button class="btn btn-default btn-xs filter-button text-muted remove-filters">
<button class="btn btn-default btn-xs filter-button text-muted clear-filters">
${__("Clear Filters")}
</button>
</div>

View file

@ -1,16 +1,9 @@
@import 'common';
.active-tag-filters {
display: flex;
.filter-button, .filter-tag {
.add-filter, .filter-tag, .clear-filters {
margin: 0 10px 10px 0;
}
.add-filter {
align-self: flex-start;
}
.remove-filters {
margin-left: auto;
}
}
.toggle-filter {