Browse Source

fix: Use calendar name as it is

Do not convert route to title case since calendar names are case sensitive, and it breaks for calendar names which are all CAPs
version-14
Suraj Shetty 3 years ago
parent
commit
6b6514c796
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      frappe/public/js/frappe/views/calendar/calendar.js

+ 7
- 2
frappe/public/js/frappe/views/calendar/calendar.js View File

@@ -29,7 +29,7 @@ frappe.views.CalendarView = class CalendarView extends frappe.views.ListView {
.then(() => {
this.page_title = __('{0} Calendar', [this.page_title]);
this.calendar_settings = frappe.views.calendar[this.doctype] || {};
this.calendar_name = frappe.utils.to_title_case(frappe.get_route()[3] || '');
this.calendar_name = frappe.get_route()[3];
});
}

@@ -72,12 +72,17 @@ frappe.views.CalendarView = class CalendarView extends frappe.views.ListView {
const calendar_name = this.calendar_name;

return new Promise(resolve => {
if (calendar_name === 'Default') {
if (calendar_name === 'default') {
Object.assign(options, frappe.views.calendar[this.doctype]);
resolve(options);
} else {
frappe.model.with_doc('Calendar View', calendar_name, () => {
const doc = frappe.get_doc('Calendar View', calendar_name);
if (!doc) {
frappe.show_alert(__("{0} is not a valid Calendar. Redirecting to default Calendar.", [calendar_name.bold()]));
frappe.set_route("List", this.doctype, "Calendar", "default");
return;
}
Object.assign(options, {
field_map: {
id: "name",


Loading…
Cancel
Save