[minor] fixes in select inbox and no_result template
This commit is contained in:
parent
0033d81193
commit
bb4e7ab128
5 changed files with 29 additions and 28 deletions
|
|
@ -45,18 +45,20 @@ $.extend(frappe.desktop, {
|
|||
explore_icon.app_icon = frappe.ui.app_icon.get_html(explore_icon);
|
||||
all_icons.push(explore_icon);
|
||||
|
||||
var inbox_icon = {
|
||||
module_name: 'Communication',
|
||||
label: 'Email Inbox',
|
||||
_label: __('Email Inbox'),
|
||||
_id: 'Email Inbox',
|
||||
_doctype: 'Communication',
|
||||
icon: 'fa fa-envelope-o',
|
||||
color: '#589494',
|
||||
link: 'List/Communication/Inbox'
|
||||
if(frappe.boot.email_accounts.length && frappe.model.can_read("Communication")) {
|
||||
var inbox_icon = {
|
||||
module_name: 'Communication',
|
||||
label: 'Email Inbox',
|
||||
_label: __('Email Inbox'),
|
||||
_id: 'Email Inbox',
|
||||
_doctype: 'Communication',
|
||||
icon: 'fa fa-envelope-o',
|
||||
color: '#589494',
|
||||
link: 'List/Communication/Inbox'
|
||||
}
|
||||
inbox_icon.app_icon = frappe.ui.app_icon.get_html(inbox_icon)
|
||||
all_icons.push(inbox_icon);
|
||||
}
|
||||
inbox_icon.app_icon = frappe.ui.app_icon.get_html(inbox_icon)
|
||||
all_icons.push(inbox_icon);
|
||||
|
||||
frappe.desktop.wrapper.html(frappe.render_template(template, {
|
||||
// all visible icons
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ frappe.views.ListSidebar = Class.extend({
|
|||
}
|
||||
//show link for kanban view
|
||||
this.sidebar.find('.list-link[data-view="Kanban"]').removeClass('hide');
|
||||
if(this.doctype === "Communication"){
|
||||
if(this.doctype === "Communication" && frappe.boot.email_accounts.length) {
|
||||
this.sidebar.find('.list-link[data-view="Inbox"]').removeClass('hide');
|
||||
show_list_link = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
<div class="msg-box no-border">
|
||||
<p>{{ __("No {} found", [doctype]) }}</p>
|
||||
<p>
|
||||
<button class="btn btn-primary btn-sm btn-no-result" list_view_doc="{{ doctype }}">
|
||||
{{__(label) }}
|
||||
</button>
|
||||
</p>
|
||||
{% if(!frappe.model.can_create(doctype) && doctype == "Email Account") { %}
|
||||
<p>Email Account is not assigned, Please contact System Manager</p>
|
||||
{% } else { %}
|
||||
<p>{{ __("No {} found", [doctype]) }}</p>
|
||||
<p>
|
||||
<button class="btn btn-primary btn-sm btn-no-result" list_view_doc="{{ doctype }}">
|
||||
{{__(label) }}
|
||||
</button>
|
||||
</p>
|
||||
{% } %}
|
||||
</div>
|
||||
|
|
@ -120,15 +120,15 @@ frappe.views.InboxView = frappe.views.ListRenderer.extend({
|
|||
},
|
||||
make_no_result: function () {
|
||||
var no_result_message = ""
|
||||
email_account = this.get_current_email_account();
|
||||
email_account = this.get_current_email_account();
|
||||
if (inList(["Spam", "Trash"], email_account)) {
|
||||
return __("No {0} mail", [email_account])
|
||||
} else if(!email_account) {
|
||||
} else if(!email_account && !frappe.boot.email_accounts.length) {
|
||||
// email account is not configured
|
||||
this.no_result_doctype = "Email Account"
|
||||
args = {
|
||||
doctype: "Email Account",
|
||||
label: "New Email Account"
|
||||
label: "New Email Account",
|
||||
}
|
||||
} else {
|
||||
// no sent mail
|
||||
|
|
@ -149,8 +149,6 @@ frappe.views.InboxView = frappe.views.ListRenderer.extend({
|
|||
});
|
||||
html = frappe.render_template("select_email_inbox", {
|
||||
email_accounts: email_account_map,
|
||||
current_email_account: this.current_email_account,
|
||||
is_system_manager: has_common(["System Manager", "Administrator"], roles),
|
||||
is_inbox_configured: Object.keys(email_account_map).length
|
||||
})
|
||||
|
||||
|
|
@ -159,6 +157,7 @@ frappe.views.InboxView = frappe.views.ListRenderer.extend({
|
|||
|
||||
return html
|
||||
},
|
||||
|
||||
bind_email_inbox_selector: function() {
|
||||
// bind email_account on_change event
|
||||
var me = this;
|
||||
|
|
@ -167,6 +166,7 @@ frappe.views.InboxView = frappe.views.ListRenderer.extend({
|
|||
frappe.set_route("List", "Communication", "Inbox", inbox)
|
||||
})
|
||||
},
|
||||
|
||||
make_new_doc: function() {
|
||||
if (this.no_result_doctype == "Communication") {
|
||||
new frappe.views.CommunicationComposer({
|
||||
|
|
|
|||
|
|
@ -18,15 +18,10 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% } else if(!is_system_manager) { %}
|
||||
<div class="msg-box no-border">
|
||||
<p>Email Account is not assigned, Please contact System Manager</p>
|
||||
</div>
|
||||
{% } else { %}
|
||||
{%= frappe.render_template("inbox_no_result", {
|
||||
doctype: "Email Account",
|
||||
label: "Email Account",
|
||||
action: `frappe.new_doc("Email Account")`
|
||||
}) %}
|
||||
{% } %}
|
||||
</div>
|
||||
Loading…
Add table
Reference in a new issue