fix(minor): ui tweaks & override workflow status
This commit is contained in:
parent
58e779f0a3
commit
58df70fc00
3 changed files with 46 additions and 17 deletions
|
|
@ -59,10 +59,12 @@ $('body').on('click', 'a', function(e) {
|
|||
if (frappe.router.is_app_route(e.currentTarget.pathname)) {
|
||||
// target has "/app, this is a v2 style route.
|
||||
|
||||
frappe.route_options = {};
|
||||
let params = new URLSearchParams(e.currentTarget.search);
|
||||
for (const [key, value] of params) {
|
||||
frappe.route_options[key] = value;
|
||||
if (e.currentTarget.search) {
|
||||
frappe.route_options = {};
|
||||
let params = new URLSearchParams(e.currentTarget.search);
|
||||
for (const [key, value] of params) {
|
||||
frappe.route_options[key] = value;
|
||||
}
|
||||
}
|
||||
return override(e.currentTarget.pathname + e.currentTarget.hash);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ export default class QuickListWidget extends Widget {
|
|||
|
||||
if (old_filter != me.quick_list_filter) {
|
||||
me.body.empty();
|
||||
me.set_footer();
|
||||
me.set_body();
|
||||
}
|
||||
},
|
||||
|
|
@ -191,6 +192,10 @@ export default class QuickListWidget extends Widget {
|
|||
if (this.has_status_field) {
|
||||
fields.push('status');
|
||||
fields.push('docstatus');
|
||||
|
||||
// add workflow state field if workflow exist & is active
|
||||
let workflow_fieldname = frappe.workflow.get_state_fieldname(this.document_type);
|
||||
workflow_fieldname && fields.push(workflow_fieldname);
|
||||
}
|
||||
|
||||
fields.push('modified');
|
||||
|
|
@ -230,18 +235,18 @@ export default class QuickListWidget extends Widget {
|
|||
}
|
||||
|
||||
set_footer() {
|
||||
if (!this.see_all_button) {
|
||||
this.see_all_button = $(`
|
||||
<div class="see-all btn">See all</div>
|
||||
`).appendTo(this.footer);
|
||||
this.footer.empty();
|
||||
|
||||
this.see_all_button.click(() => {
|
||||
let filters = frappe.utils.get_filter_from_json(this.quick_list_filter);
|
||||
if (filters) {
|
||||
frappe.route_options = filters;
|
||||
}
|
||||
frappe.set_route(frappe.utils.generate_route({type: 'doctype', name: this.document_type}));
|
||||
});
|
||||
let filters = frappe.utils.get_filter_from_json(this.quick_list_filter);
|
||||
if (filters) {
|
||||
frappe.route_options = filters;
|
||||
}
|
||||
|
||||
this.see_all_button = $(`
|
||||
<a href="${frappe.utils.generate_route({
|
||||
type: 'doctype',
|
||||
name: this.document_type
|
||||
})}"class="see-all btn btn-xs">View List</a>
|
||||
`).appendTo(this.footer);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -734,6 +734,27 @@ body {
|
|||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.widget-head .widget-control {
|
||||
width: auto;
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.widget-head {
|
||||
.widget-label {
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
.widget-control {
|
||||
width: 0px;
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
transition: visibility 0s, opacity 0.5s ease-in-out;
|
||||
}
|
||||
}
|
||||
|
||||
.widget-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
@ -757,7 +778,6 @@ body {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
margin-left: 3px;
|
||||
|
||||
.timestamp {
|
||||
font-size: smaller;
|
||||
|
|
@ -770,14 +790,16 @@ body {
|
|||
|
||||
.right-arrow {
|
||||
margin-left: 6px;
|
||||
margin-right: -2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.widget-footer {
|
||||
.see-all {
|
||||
background-color: var(--btn-default-bg);
|
||||
width: 100%;
|
||||
text-decoration: none;
|
||||
background-color: var(--btn-default-bg);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--btn-default-hover-bg);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue