@@ -5,6 +5,12 @@ frappe.ui.form.on('Calendar View', { | |||||
onload: function(frm) { | onload: function(frm) { | ||||
frm.trigger('reference_doctype'); | frm.trigger('reference_doctype'); | ||||
}, | }, | ||||
refresh: function(frm) { | |||||
if (!frm.is_new()) { | |||||
frm.add_custom_button(__('Show Calendar'), | |||||
() => frappe.set_route('List', frm.doc.reference_doctype, 'Calendar', frm.doc.name)) | |||||
} | |||||
}, | |||||
reference_doctype: function(frm) { | reference_doctype: function(frm) { | ||||
const { reference_doctype } = frm.doc; | const { reference_doctype } = frm.doc; | ||||
if (!reference_doctype) return; | if (!reference_doctype) return; | ||||
@@ -43,7 +43,12 @@ frappe.views.CalendarView = frappe.views.ListRenderer.extend({ | |||||
if(!should_refresh) { | if(!should_refresh) { | ||||
this.last_calendar_view = this.current_calendar_view || ''; | this.last_calendar_view = this.current_calendar_view || ''; | ||||
this.current_calendar_view = this.get_calendar_view(); | this.current_calendar_view = this.get_calendar_view(); | ||||
this.page_title = __(this.get_calendar_view()); | |||||
if (this.current_calendar_view !== 'Default') { | |||||
this.page_title = __(this.current_calendar_view); | |||||
} else { | |||||
this.page_title = this.doctype + ' ' + __('Calendar'); | |||||
} | |||||
should_refresh = this.current_calendar_view !== this.last_calendar_view; | should_refresh = this.current_calendar_view !== this.last_calendar_view; | ||||
} | } | ||||