Validate last_view before saving
This commit is contained in:
parent
459b9aac2e
commit
b6677ed6c3
2 changed files with 6 additions and 3 deletions
|
|
@ -50,7 +50,7 @@ frappe.views.ListSidebar = Class.extend({
|
|||
|
||||
this.current_view = 'List';
|
||||
var route = frappe.get_route();
|
||||
if(route.length > 2 && in_list(['Gantt', 'Image', 'Kanban', 'Calendar', 'Inbox'], route[2])) {
|
||||
if(route.length > 2 && frappe.views.view_modes.includes(route[2])) {
|
||||
this.current_view = route[2];
|
||||
|
||||
if(this.current_view === 'Kanban') {
|
||||
|
|
|
|||
|
|
@ -116,6 +116,8 @@ frappe.views.set_list_as_dirty = function (doctype) {
|
|||
}
|
||||
}
|
||||
|
||||
frappe.views.view_modes = ['List', 'Gantt', 'Kanban', 'Calendar', 'Image', 'Inbox'];
|
||||
|
||||
frappe.views.ListView = frappe.ui.BaseList.extend({
|
||||
init: function (opts) {
|
||||
$.extend(this, opts);
|
||||
|
|
@ -453,7 +455,8 @@ frappe.views.ListView = frappe.ui.BaseList.extend({
|
|||
}
|
||||
|
||||
// save last view
|
||||
if (user_settings_common.last_view !== this.current_view) {
|
||||
if (user_settings_common.last_view !== this.current_view
|
||||
&& frappe.views.view_modes.includes(this.current_view)) {
|
||||
user_settings_common.last_view = this.current_view;
|
||||
different = true;
|
||||
}
|
||||
|
|
@ -489,7 +492,7 @@ frappe.views.ListView = frappe.ui.BaseList.extend({
|
|||
|
||||
if (!this.list_renderer.settings.use_route) {
|
||||
var route = frappe.get_route();
|
||||
if (route[2] && !in_list(['List', 'Image', 'Gantt', 'Kanban', 'Calendar', 'Inbox'], route[2])) {
|
||||
if (route[2] && !frappe.views.view_modes.includes(route[2])) {
|
||||
$.each(frappe.utils.get_args_dict_from_url(route[2]), function (key, val) {
|
||||
me.set_filter(key, val, true);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue