Skip to content

Commit

Permalink
fix: render map view in Views menu
Browse files Browse the repository at this point in the history
  • Loading branch information
prssanna committed Mar 26, 2021
1 parent 7fe570c commit 8af1616
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions frappe/public/icons/timeless/symbol-defs.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion frappe/public/js/frappe/list/base_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ frappe.views.BaseList = class BaseList {
'Calendar': 'calendar',
'Gantt': 'gantt',
'Kanban': 'kanban',
'Dashboard': 'dashboard'
'Dashboard': 'dashboard',
'Map': 'map',
};

if (frappe.boot.desk_settings.view_switcher) {
Expand Down Expand Up @@ -823,6 +824,7 @@ frappe.views.view_modes = [
"Image",
"Inbox",
"Tree",
"Map",
];
frappe.views.is_valid = (view_mode) =>
frappe.views.view_modes.includes(view_mode);
9 changes: 8 additions & 1 deletion frappe/public/js/frappe/list/list_view_select.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,14 @@ frappe.views.ListViewSelect = class ListViewSelect {
kanbans => this.setup_kanban_switcher(kanbans)
);
}
}
},
Map: {
condition: this.list_view.settings.get_coords_method ||
(this.list_view.meta.fields.find(i => i.fieldname === "latitude") &&
this.list_view.meta.fields.find(i => i.fieldname === "longitude")) ||
(this.list_view.meta.fields.find(i => i.fieldname === 'location' && i.fieldtype == 'Geolocation')),
action: () => this.set_route("map")
},
};

frappe.views.view_modes.forEach(view => {
Expand Down

0 comments on commit 8af1616

Please sign in to comment.