style: fix formatting
This commit is contained in:
parent
a47b55546b
commit
2118bd1cc8
28 changed files with 92 additions and 97 deletions
|
|
@ -13,8 +13,6 @@ from email.mime.multipart import MIMEMultipart
|
|||
from email.header import Header
|
||||
from email import policy
|
||||
|
||||
from frappe.core.doctype.navbar_settings.navbar_settings import get_app_logo
|
||||
|
||||
def get_email(recipients, sender='', msg='', subject='[No Subject]',
|
||||
text_content = None, footer=None, print_html=None, formatted=None, attachments=None,
|
||||
content=None, reply_to=None, cc=[], bcc=[], email_account=None, expose_recipients=None,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ frappe.ui.IconBar = Class.extend({
|
|||
return false;
|
||||
});
|
||||
|
||||
$li.find("i").attr("title", label).tooltip({ delay: { "show": 600, "hide": 100 }, trigger : "hover" });
|
||||
$li.find("i").attr("title", label).tooltip({ delay: { "show": 600, "hide": 100 }, trigger: "hover" });
|
||||
|
||||
|
||||
this.$wrapper.find(".iconbar-" + group).removeClass("hide")
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ frappe.ui.setup_like_popover = ($parent, selector, check_not_liked=true) => {
|
|||
animation: true,
|
||||
placement: 'bottom',
|
||||
trigger: 'manual',
|
||||
template:`<div class="liked-by-popover popover">
|
||||
template: `<div class="liked-by-popover popover">
|
||||
<div class="arrow"></div>
|
||||
<div class="popover-body popover-content"></div>
|
||||
</div>`,
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ frappe.show_alert = function(message, seconds=7, actions={}) {
|
|||
if (message.indicator) {
|
||||
icon = indicator_icon_map[message.indicator.toLowerCase()] || 'solid-' + message.indicator;
|
||||
} else {
|
||||
icon = 'solid-info'
|
||||
icon = 'solid-info';
|
||||
}
|
||||
|
||||
const div = $(`
|
||||
|
|
@ -397,7 +397,7 @@ frappe.show_alert = function(message, seconds=7, actions={}) {
|
|||
}
|
||||
|
||||
div.find('.close, button').click(function() {
|
||||
div.addClass('out')
|
||||
div.addClass('out');
|
||||
setTimeout(() => div.remove(), 800);
|
||||
return false;
|
||||
});
|
||||
|
|
@ -408,14 +408,14 @@ frappe.show_alert = function(message, seconds=7, actions={}) {
|
|||
|
||||
if (seconds > 2) {
|
||||
// Delay for animation
|
||||
seconds = seconds - 0.8
|
||||
seconds = seconds - 0.8;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
div.addClass('out')
|
||||
div.addClass('out');
|
||||
setTimeout(() => div.remove(), 800);
|
||||
return false;
|
||||
}, seconds * 1000)
|
||||
}, seconds * 1000);
|
||||
|
||||
return div;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ frappe.ui.Notifications = class Notifications {
|
|||
frappe.set_route('Form', 'Notification Settings', frappe.session.user);
|
||||
}).appendTo(this.header_actions)
|
||||
.attr('title', __("Notification Settings"))
|
||||
.tooltip({ delay: { "show": 600, "hide": 100}, trigger : "hover" });
|
||||
.tooltip({ delay: { "show": 600, "hide": 100}, trigger: "hover" });
|
||||
|
||||
$(`<span class="mark-all-read pull-right" data-action="mark_all_as_read">
|
||||
${frappe.utils.icon('mark-as-read')}
|
||||
|
|
@ -46,7 +46,7 @@ frappe.ui.Notifications = class Notifications {
|
|||
.on('click', (e) => this.mark_all_as_read(e))
|
||||
.appendTo(this.header_actions)
|
||||
.attr('title', __("Mark all as read"))
|
||||
.tooltip({ delay: { "show": 600, "hide": 100 }, trigger : "hover" });
|
||||
.tooltip({ delay: { "show": 600, "hide": 100 }, trigger: "hover" });
|
||||
|
||||
this.categories = [
|
||||
{
|
||||
|
|
@ -64,7 +64,7 @@ frappe.ui.Notifications = class Notifications {
|
|||
];
|
||||
|
||||
let get_headers_html = (item) => {
|
||||
let active = item.id == "notifications" ? 'active' : ''
|
||||
let active = item.id == "notifications" ? 'active' : '';
|
||||
|
||||
let html = `<li class="notifications-category ${active}"
|
||||
id="${item.id}"
|
||||
|
|
@ -80,15 +80,15 @@ frappe.ui.Notifications = class Notifications {
|
|||
item.$tab.on('click', (e) => {
|
||||
e.stopImmediatePropagation();
|
||||
this.switch_tab(item);
|
||||
})
|
||||
});
|
||||
navitem.append(item.$tab);
|
||||
|
||||
return item
|
||||
})
|
||||
return item;
|
||||
});
|
||||
navitem.appendTo(this.header_items);
|
||||
this.categories.forEach(category => {
|
||||
this.make_tab_view(category);
|
||||
})
|
||||
});
|
||||
this.switch_tab(this.categories[0]);
|
||||
}
|
||||
|
||||
|
|
@ -178,11 +178,11 @@ class BaseNotificaitonsView {
|
|||
}
|
||||
|
||||
show() {
|
||||
this.container.show()
|
||||
this.container.show();
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.container.hide()
|
||||
this.container.hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ class NotificationsView extends BaseNotificaitonsView {
|
|||
make() {
|
||||
this.notifications_icon = this.parent.find('.notifications-icon');
|
||||
this.notifications_icon.attr("title", __('Notifications')).tooltip(
|
||||
{ delay: { "show": 600, "hide": 100}, trigger : "hover" }
|
||||
{ delay: { "show": 600, "hide": 100}, trigger: "hover" }
|
||||
);
|
||||
|
||||
this.setup_notification_listeners();
|
||||
|
|
@ -281,15 +281,15 @@ class NotificationsView extends BaseNotificaitonsView {
|
|||
</a>`);
|
||||
|
||||
if (!field.read) {
|
||||
let mark_btn = item_html.find(".mark-as-read")
|
||||
mark_btn.tooltip({ delay: { "show": 600, "hide": 100 }, trigger : "hover" });
|
||||
let mark_btn = item_html.find(".mark-as-read");
|
||||
mark_btn.tooltip({ delay: { "show": 600, "hide": 100 }, trigger: "hover" });
|
||||
mark_btn.on('click', (e) => {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
this.mark_as_read(field.name, item_html);
|
||||
});
|
||||
|
||||
item_html.on('click', (e) => {
|
||||
item_html.on('click', () => {
|
||||
this.mark_as_read(field.name, item_html);
|
||||
});
|
||||
}
|
||||
|
|
@ -361,12 +361,12 @@ class NotificationsView extends BaseNotificaitonsView {
|
|||
|
||||
setup_notification_listeners() {
|
||||
frappe.realtime.on('notification', () => {
|
||||
this.toggle_notification_icon(false)
|
||||
this.toggle_notification_icon(false);
|
||||
this.update_dropdown();
|
||||
});
|
||||
|
||||
frappe.realtime.on('indicator_hide', () => {
|
||||
this.toggle_notification_icon(true)
|
||||
this.toggle_notification_icon(true);
|
||||
});
|
||||
|
||||
this.parent.on('show.bs.dropdown', () => {
|
||||
|
|
@ -400,7 +400,7 @@ class EventsView extends BaseNotificaitonsView {
|
|||
let time = __("All Day");
|
||||
if (!event.all_day) {
|
||||
let start_time = frappe.datetime.get_time(event.starts_on);
|
||||
let days_diff = frappe.datetime.get_day_diff(event.ends_on, event.starts_on)
|
||||
let days_diff = frappe.datetime.get_day_diff(event.ends_on, event.starts_on);
|
||||
let end_time = frappe.datetime.get_time(event.ends_on);
|
||||
if (days_diff > 1) {
|
||||
end_time = __("Rest of the day");
|
||||
|
|
|
|||
|
|
@ -187,19 +187,19 @@ frappe.ui.Page = Class.extend({
|
|||
this.sidebar.find(".close-sidebar").on('click', (e) => close_sidebar(e));
|
||||
this.sidebar.on("click", "button:not(.dropdown-toggle)", (e) => close_sidebar(e));
|
||||
|
||||
let close_sidebar = (e) => {
|
||||
let close_sidebar = () => {
|
||||
scroll_container.css("overflow-y", "");
|
||||
this.sidebar.find("div.close-sidebar").fadeOut(() => {
|
||||
overlay_sidebar.removeClass('opened')
|
||||
.find('.dropdown-toggle')
|
||||
.removeClass('text-muted');
|
||||
});
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
update_sidebar_icon() {
|
||||
let sidebar_toggle = $('.page-head').find('.sidebar-toggle-btn');
|
||||
let sidebar_toggle_icon = sidebar_toggle.find('.sidebar-toggle-icon')
|
||||
let sidebar_toggle_icon = sidebar_toggle.find('.sidebar-toggle-icon');
|
||||
let sidebar_wrapper = this.wrapper.find('.layout-side-section');
|
||||
let is_sidebar_visible = $(sidebar_wrapper).is(":visible");
|
||||
sidebar_toggle_icon.html(frappe.utils.icon(is_sidebar_visible ? 'sidebar-collapse' : 'sidebar-expand', 'md'));
|
||||
|
|
@ -214,14 +214,14 @@ frappe.ui.Page = Class.extend({
|
|||
<button class="text-muted btn btn-default ${css_class} icon-btn">
|
||||
${frappe.utils.icon(icon)}
|
||||
</button>
|
||||
`)
|
||||
`);
|
||||
|
||||
button.appendTo(this.icon_group.removeClass("hide"));
|
||||
button.click(click);
|
||||
button.attr("title", __(tooltip_label || frappe.unscrub(icon)))
|
||||
.tooltip({ delay: { "show": 600, "hide": 100 }, trigger : "hover" });
|
||||
.tooltip({ delay: { "show": 600, "hide": 100 }, trigger: "hover" });
|
||||
|
||||
return button
|
||||
return button;
|
||||
},
|
||||
|
||||
clear_indicator: function() {
|
||||
|
|
@ -789,7 +789,7 @@ frappe.ui.Page = Class.extend({
|
|||
}
|
||||
|
||||
if(df.fieldtype=="Button") {
|
||||
$(f.wrapper).find(".page-control-label").html(" ")
|
||||
$(f.wrapper).find(".page-control-label").html(" ");
|
||||
f.$input.addClass("btn-xs").css({"width": "100%", "margin-top": "-1px"});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher {
|
|||
setup_dialog() {
|
||||
this.dialog = new frappe.ui.Dialog({
|
||||
title: __("Switch Theme")
|
||||
})
|
||||
});
|
||||
this.body = $(`<div class="theme-grid"></div>`).appendTo(this.dialog.$body);
|
||||
}
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher {
|
|||
this.current_theme = document.body.dataset.theme;
|
||||
this.fetch_themes().then(() => {
|
||||
this.render();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
fetch_themes() {
|
||||
|
|
@ -31,7 +31,7 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher {
|
|||
name: "dark",
|
||||
label: __("Timeless Night"),
|
||||
}
|
||||
]
|
||||
];
|
||||
|
||||
resolve(this.themes);
|
||||
});
|
||||
|
|
@ -42,7 +42,7 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher {
|
|||
let html = this.get_preview_html(theme);
|
||||
html.appendTo(this.body);
|
||||
theme.$html = html;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -80,13 +80,13 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher {
|
|||
preview.on('click', () => {
|
||||
this.themes.forEach((th) => {
|
||||
th.$html.removeClass("selected");
|
||||
})
|
||||
});
|
||||
|
||||
preview.addClass("selected")
|
||||
this.toggle_theme(theme.name)
|
||||
preview.addClass("selected");
|
||||
this.toggle_theme(theme.name);
|
||||
})
|
||||
|
||||
return preview
|
||||
return preview;
|
||||
}
|
||||
|
||||
toggle_theme(theme, preview=false) {
|
||||
|
|
@ -96,7 +96,7 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher {
|
|||
|
||||
frappe.call('frappe.core.doctype.user.user.switch_theme', {
|
||||
theme: toTitle(theme)
|
||||
})
|
||||
});
|
||||
} else {
|
||||
document.body.dataset.theme = theme.toLowerCase();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ frappe.search.SearchDialog = class {
|
|||
if (result.route_options) {
|
||||
frappe.route_options = result.route_options;
|
||||
}
|
||||
$result.on("click", e => {
|
||||
$result.on("click", () => {
|
||||
// this.toggle_minimize();
|
||||
if (result.onclick) {
|
||||
result.onclick(result.match);
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ frappe.ui.toolbar.Toolbar = class {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
$.extend(frappe.ui.toolbar, {
|
||||
add_dropdown_button: function(parent, label, click, icon) {
|
||||
|
|
|
|||
|
|
@ -274,12 +274,12 @@ frappe.ui.Tree = class {
|
|||
|
||||
node.$tree_link.hover(
|
||||
function() {
|
||||
$(this).parent().addClass('hover-active')
|
||||
$(this).parent().addClass('hover-active');
|
||||
},
|
||||
function() {
|
||||
$(this).parent().removeClass('hover-active')
|
||||
$(this).parent().removeClass('hover-active');
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
get_toolbar(node) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ frappe.get_avatar = function(user, css_class, title, image_url=null, remove_colo
|
|||
let style = '';
|
||||
if (!remove_color) {
|
||||
let color = frappe.get_palette(title);
|
||||
style = `background-color: var(${color[0]}); color: var(${color[1]})`
|
||||
style = `background-color: var(${color[0]}); color: var(${color[1]})`;
|
||||
}
|
||||
|
||||
if (css_class === 'avatar-small' || css_class == 'avatar-xs') {
|
||||
|
|
@ -61,7 +61,7 @@ frappe.get_avatar = function(user, css_class, title, image_url=null, remove_colo
|
|||
${abbr}
|
||||
</div>
|
||||
</span>`;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
frappe.avatar_group = function (users, limit=4, options = {}) {
|
||||
|
|
@ -127,7 +127,7 @@ frappe.palette = [
|
|||
['--yellow-avatar-bg', '--yellow-avatar-color'],
|
||||
['--purple-avatar-bg', '--purple-avatar-color'],
|
||||
['--gray-avatar-bg', '--gray-avatar-color0']
|
||||
]
|
||||
];
|
||||
|
||||
frappe.get_palette = function (txt) {
|
||||
var idx = cint((parseInt(md5(txt).substr(4, 2), 16) + 1) / 5.33);
|
||||
|
|
@ -182,7 +182,7 @@ window.strip_html = function(txt) {
|
|||
|
||||
window.strip = function (s, chars) {
|
||||
if (s) {
|
||||
var s = lstrip(s, chars)
|
||||
var s = lstrip(s, chars);
|
||||
s = rstrip(s, chars);
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ frappe.dashboard_utils = {
|
|||
let icon_html = '', filter_class = '';
|
||||
|
||||
if (filter.icon) {
|
||||
icon_html = frappe.utils.icon(filter.icon)
|
||||
icon_html = frappe.utils.icon(filter.icon);
|
||||
}
|
||||
|
||||
if (filter.class) {
|
||||
|
|
|
|||
|
|
@ -1102,7 +1102,7 @@ Object.assign(frappe.utils, {
|
|||
|
||||
for (let key in custom_options) {
|
||||
if (typeof chart_args[key] === 'object' && typeof custom_options[key] === 'object') {
|
||||
chart_args[key] = Object.assign(chart_args[key], custom_options[key])
|
||||
chart_args[key] = Object.assign(chart_args[key], custom_options[key]);
|
||||
} else {
|
||||
chart_args[key] = custom_options[key];
|
||||
}
|
||||
|
|
@ -1112,7 +1112,7 @@ Object.assign(frappe.utils, {
|
|||
},
|
||||
|
||||
generate_route(item) {
|
||||
const type = item.type.toLowerCase()
|
||||
const type = item.type.toLowerCase();
|
||||
if (type === "doctype") {
|
||||
item.doctype = item.name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ frappe.breadcrumbs = {
|
|||
var breadcrumbs = this.all[frappe.breadcrumbs.current_page()];
|
||||
|
||||
this.clear();
|
||||
if(!breadcrumbs) return this.toggle(false);
|
||||
if (!breadcrumbs) return this.toggle(false);
|
||||
|
||||
if (breadcrumbs.type === 'Custom') {
|
||||
this.set_custom_breadcrumbs(breadcrumbs);
|
||||
|
|
@ -87,7 +87,7 @@ frappe.breadcrumbs = {
|
|||
}
|
||||
|
||||
if (breadcrumbs.workspace) {
|
||||
if(!breadcrumbs.module_info.blocked && frappe.visible_modules.includes(breadcrumbs.module_info.module)) {
|
||||
if (!breadcrumbs.module_info.blocked && frappe.visible_modules.includes(breadcrumbs.module_info.module)) {
|
||||
$(`<li><a href="/app/${frappe.router.slug(breadcrumbs.workspace)}">${__(breadcrumbs.workspace)}</a></li>`)
|
||||
.appendTo(this.$breadcrumbs);
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ frappe.breadcrumbs = {
|
|||
|
||||
if (from_module) {
|
||||
breadcrumbs.module = from_module;
|
||||
} else if(this.preferred[breadcrumbs.doctype]!==undefined) {
|
||||
} else if (this.preferred[breadcrumbs.doctype]!==undefined) {
|
||||
// get preferred module for breadcrumbs
|
||||
breadcrumbs.module = this.preferred[breadcrumbs.doctype];
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ frappe.breadcrumbs = {
|
|||
route = doctype_route;
|
||||
}
|
||||
$(`<li><a href="/app/${route}">${doctype}</a></li>`)
|
||||
.appendTo(this.$breadcrumbs)
|
||||
.appendTo(this.$breadcrumbs);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ frappe.breadcrumbs = {
|
|||
},
|
||||
|
||||
setup_modules() {
|
||||
if(!frappe.visible_modules) {
|
||||
if (!frappe.visible_modules) {
|
||||
frappe.visible_modules = $.map(frappe.boot.allowed_workspaces, (m) => {
|
||||
return m.module;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ frappe.provide("frappe.views.calendars");
|
|||
frappe.views.CalendarView = class CalendarView extends frappe.views.ListView {
|
||||
static load_last_view() {
|
||||
const route = frappe.get_route();
|
||||
console.log(route);
|
||||
if (route.length === 3) {
|
||||
const doctype = route[1];
|
||||
const user_settings = frappe.get_user_settings(doctype)['Calendar'] || {};
|
||||
|
|
@ -198,7 +197,7 @@ frappe.views.Calendar = Class.extend({
|
|||
this.$wrapper.find('.fc-today-button')
|
||||
.prepend(frappe.utils.icon('today'));
|
||||
|
||||
this.$wrapper.find('.fc-day-number').wrap('<div class="fc-day"></div>')
|
||||
this.$wrapper.find('.fc-day-number').wrap('<div class="fc-day"></div>');
|
||||
|
||||
var btn_group = this.$wrapper.find(".fc-button-group");
|
||||
btn_group.find(".fc-state-active").addClass("active");
|
||||
|
|
@ -206,7 +205,7 @@ frappe.views.Calendar = Class.extend({
|
|||
btn_group.find(".btn").on("click", function() {
|
||||
btn_group.find(".btn").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
})
|
||||
});
|
||||
},
|
||||
field_map: {
|
||||
"id": "name",
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ frappe.views.Factory = class Factory {
|
|||
var page_name = frappe.get_route_str(),
|
||||
me = this;
|
||||
|
||||
if(frappe.pages[page_name]) {
|
||||
if (frappe.pages[page_name]) {
|
||||
frappe.container.change_to(page_name);
|
||||
if(me.on_show) {
|
||||
me.on_show();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ frappe.views.FormFactory = class FormFactory extends frappe.views.Factory {
|
|||
frappe.model.with_doc('DocType Layout', frappe.router.doctype_layout, () => {
|
||||
this.make_form(doctype);
|
||||
this.show_doc(route);
|
||||
})
|
||||
});
|
||||
} else {
|
||||
this.make_form(doctype);
|
||||
this.show_doc(route);
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ frappe.provide("frappe.views");
|
|||
doctype: card.doctype,
|
||||
docname: card.name,
|
||||
callback: function() {
|
||||
const users = self.assign_to_dialog.get_values().assign_to;;
|
||||
const users = self.assign_to_dialog.get_values().assign_to;
|
||||
card.assigned_list = [...new Set(card.assigned_list.concat(users))];
|
||||
fluxify.doAction('update_card', card);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ frappe.views.KanbanView.get_kanbans = function (doctype) {
|
|||
function get_kanban_boards() {
|
||||
return frappe.call('frappe.desk.doctype.kanban_board.kanban_board.get_kanban_boards', { doctype })
|
||||
.then(r => r.message);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ frappe.views.KanbanView.show_kanban_dialog = function (doctype, show_existing) {
|
|||
} else {
|
||||
frappe.set_route(kanbans.find(kanban => kanban.name == values.selected_kanban).route);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
dialog = new frappe.ui.Dialog({
|
||||
title: __('New Kanban Board'),
|
||||
|
|
|
|||
|
|
@ -152,20 +152,20 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
|
|||
|
||||
add_chart_buttons_to_toolbar(show) {
|
||||
if (show) {
|
||||
this.create_chart_button && this.create_chart_button.remove()
|
||||
this.create_chart_button && this.create_chart_button.remove();
|
||||
this.create_chart_button = this.page.add_button(__("Set Chart"), () => {
|
||||
this.open_create_chart_dialog();
|
||||
});
|
||||
|
||||
if (this.chart_fields || this.chart_options) {
|
||||
this.add_to_dashboard_button && this.add_to_dashboard_button.remove()
|
||||
this.add_to_dashboard_button && this.add_to_dashboard_button.remove();
|
||||
this.add_to_dashboard_button = this.page.add_button(__("Add Chart to Dashboard"), () => {
|
||||
this.add_chart_to_dashboard();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.create_chart_button && this.create_chart_button.remove()
|
||||
this.add_to_dashboard_button && this.add_to_dashboard_button.remove()
|
||||
this.create_chart_button && this.create_chart_button.remove();
|
||||
this.add_to_dashboard_button && this.add_to_dashboard_button.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -465,7 +465,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
|
|||
this.clear_filters();
|
||||
const { filters = [] } = this.report_settings;
|
||||
|
||||
let filter_area = this.page.page_form;s
|
||||
let filter_area = this.page.page_form;
|
||||
|
||||
this.filters = filters.map(df => {
|
||||
if (df.fieldtype === 'Break') return;
|
||||
|
|
@ -660,7 +660,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
|
|||
}
|
||||
|
||||
add_prepared_report_buttons(doc) {
|
||||
if(doc){
|
||||
if (doc) {
|
||||
this.page.add_inner_button(__("Download Report"), function (){
|
||||
window.open(
|
||||
frappe.urllib.get_full_url(
|
||||
|
|
@ -791,7 +791,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
|
|||
this.toggle_primary_button_disabled(true);
|
||||
let mandatory = this.filters.filter(f => f.df.reqd);
|
||||
let missing_mandatory = mandatory.filter(f => !f.get_value());
|
||||
if (!missing_mandatory.length){
|
||||
if (!missing_mandatory.length) {
|
||||
let filters = this.get_filter_values(true);
|
||||
return new Promise(resolve => frappe.call({
|
||||
method: 'frappe.desk.query_report.background_enqueue_run',
|
||||
|
|
|
|||
|
|
@ -727,8 +727,8 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
|
|||
let fields_to_add = this.fields.filter(df => {
|
||||
return !table_fields.find((field) => {
|
||||
return df[0] == field[0] && df[1] == field[1]
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
// rebuild fields
|
||||
this.fields = [...fields_already_in_table, ...fields_to_add];
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ frappe.views.TreeView = Class.extend({
|
|||
if (!this.opts.disable_add_node && this.can_create) {
|
||||
me.page.set_primary_action(__("New"), function() {
|
||||
me.new_node();
|
||||
}, "add")
|
||||
}, "add");
|
||||
}
|
||||
},
|
||||
set_menu_item: function(){
|
||||
|
|
|
|||
|
|
@ -85,8 +85,7 @@ frappe.views.Workspace = class Workspace {
|
|||
}
|
||||
|
||||
build_sidebar_section(title, items) {
|
||||
let sidebar_section = $(`<div class="standard-sidebar-section">
|
||||
</div>`)
|
||||
let sidebar_section = $(`<div class="standard-sidebar-section"></div>`);
|
||||
|
||||
// DO NOT REMOVE: Comment to load translation
|
||||
// __("Modules") __("Domains") __("Places") __("Administration")
|
||||
|
|
@ -119,7 +118,7 @@ frappe.views.Workspace = class Workspace {
|
|||
|
||||
items.forEach(item => make_sidebar_category_item(item));
|
||||
|
||||
sidebar_section.appendTo(this.sidebar)
|
||||
sidebar_section.appendTo(this.sidebar);
|
||||
}
|
||||
|
||||
show_page(page) {
|
||||
|
|
@ -151,7 +150,7 @@ frappe.views.Workspace = class Workspace {
|
|||
|
||||
customize() {
|
||||
if (this.current_page && this.current_page.allow_customization) {
|
||||
this.page.clear_menu()
|
||||
this.page.clear_menu();
|
||||
this.current_page.customize();
|
||||
|
||||
this.page.set_primary_action(
|
||||
|
|
@ -164,7 +163,7 @@ frappe.views.Workspace = class Workspace {
|
|||
},
|
||||
null,
|
||||
__("Saving")
|
||||
)
|
||||
);
|
||||
|
||||
this.page.set_secondary_action(
|
||||
__("Discard"),
|
||||
|
|
@ -175,7 +174,7 @@ frappe.views.Workspace = class Workspace {
|
|||
this.page.clear_secondary_action();
|
||||
this.setup_dropdown();
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -317,10 +316,10 @@ class DesktopPage {
|
|||
reset_customization() {
|
||||
frappe.call('frappe.desk.desktop.reset_customization', {
|
||||
page: this.page_name
|
||||
}).then(res => {
|
||||
}).then(() => {
|
||||
frappe.show_alert({ message: __("Removed page customizations"), indicator: "green" });
|
||||
this.reload();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
make_onboarding() {
|
||||
|
|
|
|||
|
|
@ -118,10 +118,10 @@ export default class Widget {
|
|||
let title = max_chars ? frappe.ellipsis(base, max_chars) : base;
|
||||
|
||||
if (this.icon) {
|
||||
let icon = frappe.utils.icon(this.icon)
|
||||
let icon = frappe.utils.icon(this.icon);
|
||||
this.title_field[0].innerHTML = `${icon} <span>${title}</span>`;
|
||||
} else {
|
||||
this.title_field[0].innerHTML = title
|
||||
this.title_field[0].innerHTML = title;
|
||||
if (max_chars) {
|
||||
this.title_field[0].setAttribute('title', this.label);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,7 +244,6 @@ export default class ChartWidget extends Widget {
|
|||
reqd: 1,
|
||||
change: () => {
|
||||
let selected_date_range = this.date_range_field.get_value();
|
||||
console.log('selected', selected_date_range);
|
||||
this.selected_from_date = selected_date_range[0];
|
||||
this.selected_to_date = selected_date_range[1];
|
||||
|
||||
|
|
@ -585,7 +584,7 @@ export default class ChartWidget extends Widget {
|
|||
let custom_options = JSON.parse(options);
|
||||
for (let key in custom_options) {
|
||||
if (typeof chart_args[key] === 'object' && typeof custom_options[key] === 'object') {
|
||||
chart_args[key] = Object.assign(chart_args[key], custom_options[key])
|
||||
chart_args[key] = Object.assign(chart_args[key], custom_options[key]);
|
||||
} else {
|
||||
chart_args[key] = custom_options[key];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export default class LinksWidget extends Widget {
|
|||
name: item.link_to,
|
||||
type: item.link_type,
|
||||
is_query_report: item.is_query_report
|
||||
})
|
||||
});
|
||||
|
||||
return $(`<a href="${route}" class="link-item ellipsis ${
|
||||
item.onboard ? "onboard-spotlight" : ""
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export default class OnboardingWidget extends Widget {
|
|||
step.description ?
|
||||
frappe.markdown(step.description)
|
||||
: `<h1>${step.title}</h1>`
|
||||
)
|
||||
);
|
||||
|
||||
if (step.intro_video_url) {
|
||||
$(`<button class="btn btn-primary btn-sm">${__('Watch Tutorial')}</button>`)
|
||||
|
|
@ -99,14 +99,14 @@ export default class OnboardingWidget extends Widget {
|
|||
.appendTo(this.step_footer)
|
||||
.on('click', () => actions[step.action](step));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const toggle_video = () => {
|
||||
this.step_body.empty();
|
||||
this.step_footer.empty();
|
||||
|
||||
const video = $(`<div class="video-player" data-plyr-provider="youtube" data-plyr-embed-id="${step.intro_video_url}"></div>`);
|
||||
video.appendTo(this.step_body)
|
||||
video.appendTo(this.step_body);
|
||||
let plyr = new frappe.Plyr(video[0], {
|
||||
hideControls: true,
|
||||
resetOnEnd: true,
|
||||
|
|
@ -122,12 +122,12 @@ export default class OnboardingWidget extends Widget {
|
|||
// Fire only once, on hashchange
|
||||
$(window).one('hashchange', () => {
|
||||
plyr.pause();
|
||||
})
|
||||
});
|
||||
|
||||
$(`<button class="btn btn-secondary ml-2 btn-sm">${__('Back')}</button>`)
|
||||
.appendTo(this.step_footer)
|
||||
.on('click', toggle_content);
|
||||
}
|
||||
};
|
||||
|
||||
toggle_content();
|
||||
// toggle_video();
|
||||
|
|
@ -136,8 +136,8 @@ export default class OnboardingWidget extends Widget {
|
|||
go_to_page(step) {
|
||||
this.mark_complete(step);
|
||||
frappe.set_route(step.path).then(() => {
|
||||
let message = step.callback_message || __("You can continue with the onboarding after exploring this page")
|
||||
let title = step.callback_title || __("Awesome Work")
|
||||
let message = step.callback_message || __("You can continue with the onboarding after exploring this page");
|
||||
let title = step.callback_title || __("Awesome Work");s
|
||||
|
||||
let msg_dialog = frappe.msgprint({
|
||||
message: message,
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default class WidgetGroup {
|
|||
make() {
|
||||
this.make_container();
|
||||
if (this.title) {
|
||||
this.set_title()
|
||||
this.set_title();
|
||||
} else {
|
||||
this.title_area.remove();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue