瀏覽代碼

Add Show Calendar button

version-14
Faris Ansari 7 年之前
父節點
當前提交
1fbc8ff448
共有 2 個文件被更改,包括 12 次插入1 次删除
  1. +6
    -0
      frappe/desk/doctype/calendar_view/calendar_view.js
  2. +6
    -1
      frappe/public/js/frappe/views/calendar/calendar.js

+ 6
- 0
frappe/desk/doctype/calendar_view/calendar_view.js 查看文件

@@ -5,6 +5,12 @@ frappe.ui.form.on('Calendar View', {
onload: function(frm) {
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) {
const { reference_doctype } = frm.doc;
if (!reference_doctype) return;


+ 6
- 1
frappe/public/js/frappe/views/calendar/calendar.js 查看文件

@@ -43,7 +43,12 @@ frappe.views.CalendarView = frappe.views.ListRenderer.extend({
if(!should_refresh) {
this.last_calendar_view = this.current_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;
}


Loading…
取消
儲存