chore: merge develop
This commit is contained in:
commit
46fceb1e0c
41 changed files with 761 additions and 179 deletions
|
|
@ -1116,6 +1116,7 @@ class TestGunicornWorker(IntegrationTestCase):
|
|||
time.sleep(2)
|
||||
execute_in_shell("pgrep gunicorn | xargs -L1 kill -9")
|
||||
|
||||
@unittest.skip("Flaky test")
|
||||
def test_gunicorn_ping_sync(self):
|
||||
self.spawn_gunicorn()
|
||||
path = f"http://{self.TEST_SITE}:{self.port}/api/method/ping"
|
||||
|
|
@ -1126,6 +1127,7 @@ class TestGunicornWorker(IntegrationTestCase):
|
|||
path = f"http://{self.TEST_SITE}:{self.port}/api/method/ping"
|
||||
self.assertEqual(requests.get(path).status_code, 200)
|
||||
|
||||
@unittest.skip("Flaky test")
|
||||
def test_gunicorn_idle_cpu_usage(self):
|
||||
def get_total_usage():
|
||||
process = psutil.Process(self.handle.pid)
|
||||
|
|
|
|||
|
|
@ -419,7 +419,7 @@ class Communication(Document, CommunicationEmailMixin):
|
|||
# Skip timeline links if a "Sent" communication already exists
|
||||
# else will create duplicate timeline entries
|
||||
if self.sent_or_received == "Received" and self.find_one_by_filters(
|
||||
message_id=self.message_id, sent_or_received="Sent"
|
||||
message_id=self.message_id, email_account=self.email_account, sent_or_received="Sent"
|
||||
):
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -43,25 +43,34 @@ frappe.ui.form.on("File", {
|
|||
if (!frappe.utils.can_upload_public_files() && frm.doc.is_private) {
|
||||
frm.set_df_property("is_private", "read_only", 1);
|
||||
}
|
||||
|
||||
if (frm.doc.attached_to_name) {
|
||||
const field = frm.get_field("attached_to_name");
|
||||
field.$input_wrapper
|
||||
.find(".control-value")
|
||||
.html(`${frappe.utils.get_form_link(frm.doctype, frm.docname, true)}`);
|
||||
}
|
||||
},
|
||||
|
||||
preview_file: function (frm) {
|
||||
let $preview = "";
|
||||
let file_extension = frm.doc.file_type.toLowerCase();
|
||||
const full_file_url = frm.doc.file_url + "?fid=" + frm.doc.name;
|
||||
const src_url = frappe.utils.escape_html(full_file_url);
|
||||
|
||||
if (frappe.utils.is_image_file(frm.doc.file_url)) {
|
||||
if (frappe.utils.is_image_file(full_file_url)) {
|
||||
$preview = $(`<div class="img_preview">
|
||||
<img
|
||||
class="img-responsive"
|
||||
style="max-width: 500px";
|
||||
src="${frappe.utils.escape_html(frm.doc.file_url)}"
|
||||
src="${src_url}"
|
||||
onerror="${frm.toggle_display("preview", false)}"
|
||||
/>
|
||||
</div>`);
|
||||
} else if (frappe.utils.is_video_file(frm.doc.file_url)) {
|
||||
} else if (frappe.utils.is_video_file(full_file_url)) {
|
||||
$preview = $(`<div class="img_preview">
|
||||
<video width="480" height="320" controls>
|
||||
<source src="${frappe.utils.escape_html(frm.doc.file_url)}">
|
||||
<source src="${src_url}">
|
||||
${__("Your browser does not support the video element.")}
|
||||
</video>
|
||||
</div>`);
|
||||
|
|
@ -72,14 +81,14 @@ frappe.ui.form.on("File", {
|
|||
style="background:#323639;"
|
||||
width="100%"
|
||||
height="1190"
|
||||
src="${frappe.utils.escape_html(frm.doc.file_url)}" type="application/pdf"
|
||||
src="${src_url}" type="application/pdf"
|
||||
>
|
||||
</object>
|
||||
</div>`);
|
||||
} else if (file_extension === "mp3") {
|
||||
$preview = $(`<div class="img_preview">
|
||||
<audio width="480" height="60" controls>
|
||||
<source src="${frappe.utils.escape_html(frm.doc.file_url)}" type="audio/mpeg">
|
||||
<source src="${src_url}" type="audio/mpeg">
|
||||
${__("Your browser does not support the audio element.")}
|
||||
</audio >
|
||||
</div>`);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
--desktop-blur: blur(10.2px);
|
||||
--desktop-modal-width: 590px;
|
||||
--desktop-modal-height: 450px;
|
||||
--folder-thumbnail-icon-height: 12px;
|
||||
--folder-thumbnail-icon-height: 16px;
|
||||
--desktop-icon-dimension: 54px;
|
||||
--folder-icon-background-color: var(--surface-gray-1);
|
||||
--desktop-modal-radius: 30px;
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
padding:0px;
|
||||
margin: 0px;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
.icons{
|
||||
gap: 16px;
|
||||
|
|
@ -109,6 +109,10 @@
|
|||
gap: 12px;
|
||||
padding: 13px 16px 12px 16px;
|
||||
position: relative;
|
||||
border-radius: 20px;
|
||||
border-width: 1px;
|
||||
border-style: dashed;
|
||||
border-color: transparent;
|
||||
}
|
||||
.desktop-icon.desktop-edit-mode .hide-button {
|
||||
display: flex;
|
||||
|
|
@ -129,6 +133,7 @@
|
|||
.icon-container{
|
||||
padding: 10px;
|
||||
border-radius: 16px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
|
@ -254,13 +259,13 @@
|
|||
position: absolute;
|
||||
}
|
||||
|
||||
.folder-icon{
|
||||
border-radius: 10px;
|
||||
background-color: var(--folder-icon-background-color) !important;
|
||||
.folder-icon {
|
||||
border-radius: 16px;
|
||||
background-color: var(--folder-icon-background-color) !important;
|
||||
box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.14);
|
||||
padding: 7px;
|
||||
align-items: normal;
|
||||
box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.14);
|
||||
/* box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.14); */
|
||||
& .icons{
|
||||
gap: 2.1px;
|
||||
margin-top: 0px;
|
||||
|
|
@ -343,8 +348,7 @@
|
|||
}
|
||||
|
||||
.desktop-edit-mode{
|
||||
border: 1px dashed var(--outline-gray-2);
|
||||
border-radius: 20px;
|
||||
border-color: var(--outline-gray-2);
|
||||
}
|
||||
.edit-mode-buttons{
|
||||
display: none;
|
||||
|
|
@ -364,7 +368,7 @@
|
|||
:root {
|
||||
--desktop-icon-dimension: 50px;
|
||||
--desktop-icon-container: 117px;
|
||||
--folder-thumbnail-icon-height:17px;
|
||||
--folder-thumbnail-icon-height:15px;
|
||||
}
|
||||
|
||||
.desktop-container {
|
||||
|
|
@ -443,6 +447,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
.icons-container {
|
||||
> .icons-container {
|
||||
padding: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.desktop-edit{
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
|
|
|
|||
|
|
@ -286,7 +286,6 @@ class DesktopPage {
|
|||
this.setup_navbar();
|
||||
this.setup_awesomebar();
|
||||
this.handle_route_change();
|
||||
this.setup_edit_button();
|
||||
}
|
||||
setup_edit_button() {
|
||||
if (this.edit_mode || frappe.is_mobile()) return;
|
||||
|
|
@ -1087,11 +1086,6 @@ class DesktopIcon {
|
|||
this.folder_grid = new DesktopIconGrid({
|
||||
wrapper: this.folder_wrapper,
|
||||
icons_data: this.child_icons,
|
||||
row_size: 3,
|
||||
page_size: {
|
||||
row: 3,
|
||||
col: 3,
|
||||
},
|
||||
in_folder: true,
|
||||
in_modal: false,
|
||||
no_dragging: true,
|
||||
|
|
|
|||
|
|
@ -521,12 +521,14 @@ class TestInboundMail(IntegrationTestCase):
|
|||
|
||||
def test_mail_exist_validation(self):
|
||||
"""Do not create communication record if the mail is already downloaded into the system."""
|
||||
email_account = frappe.get_doc("Email Account", "_Test Email Account 1")
|
||||
mail_content = self.get_test_mail(fname="incoming-1.raw")
|
||||
message_id = Email(mail_content).message_id
|
||||
# Create new communication record in DB
|
||||
communication = self.new_communication(message_id=message_id, sent_or_received="Received")
|
||||
communication = self.new_communication(
|
||||
message_id=message_id, email_account=email_account.name, sent_or_received="Received"
|
||||
)
|
||||
|
||||
email_account = frappe.get_doc("Email Account", "_Test Email Account 1")
|
||||
inbound_mail = InboundMail(mail_content, email_account, 12345, 1)
|
||||
new_communication = inbound_mail.process()
|
||||
|
||||
|
|
|
|||
|
|
@ -751,7 +751,10 @@ class InboundMail(Email):
|
|||
return
|
||||
|
||||
return Communication.find_one_by_filters(
|
||||
message_id=self.message_id, sent_or_received="Received", order_by="creation DESC"
|
||||
message_id=self.message_id,
|
||||
email_account=self.email_account.name,
|
||||
sent_or_received="Received",
|
||||
order_by="creation DESC",
|
||||
)
|
||||
|
||||
def is_sender_same_as_receiver(self):
|
||||
|
|
|
|||
|
|
@ -100,9 +100,6 @@ def delete_doc(
|
|||
else:
|
||||
return False
|
||||
|
||||
# delete passwords
|
||||
delete_all_passwords_for(doctype, name)
|
||||
|
||||
doc = None
|
||||
if doctype == "DocType":
|
||||
if for_reload:
|
||||
|
|
@ -200,6 +197,9 @@ def delete_doc(
|
|||
enqueue_after_commit=True,
|
||||
)
|
||||
|
||||
# delete passwords
|
||||
delete_all_passwords_for(doctype, name)
|
||||
|
||||
# clear cache for Document
|
||||
doc.clear_cache()
|
||||
# delete global search entry
|
||||
|
|
|
|||
|
|
@ -793,11 +793,21 @@ class Meta(Document):
|
|||
group.get("items").append(doctype)
|
||||
link.added = True
|
||||
|
||||
# Add fieldname to transaction group for external links
|
||||
if not link.is_child_table:
|
||||
if "fieldnames" not in group:
|
||||
group["fieldnames"] = {}
|
||||
group["fieldnames"][link.link_doctype] = link.link_fieldname
|
||||
|
||||
if not link.added:
|
||||
# group not found, make a new group
|
||||
data.transactions.append(
|
||||
dict(label=link.group, items=[link.parent_doctype or link.link_doctype])
|
||||
)
|
||||
new_group = dict(label=link.group, items=[link.parent_doctype or link.link_doctype])
|
||||
|
||||
# Add fieldname to new transaction group for external links
|
||||
if not link.is_child_table:
|
||||
new_group["fieldnames"] = {link.link_doctype: link.link_fieldname}
|
||||
|
||||
data.transactions.append(new_group)
|
||||
|
||||
if not data.fieldname and link.link_fieldname:
|
||||
data.fieldname = link.link_fieldname
|
||||
|
|
|
|||
|
|
@ -27,6 +27,14 @@ $(document).ready(function () {
|
|||
dismiss_key: `${frappe.boot.site_info.name}_trial_card_time`,
|
||||
dismiss_it_for: "day",
|
||||
};
|
||||
let visiblity_condition =
|
||||
frappe.boot.is_fc_site &&
|
||||
!!frappe.boot.setup_complete &&
|
||||
!frappe.is_mobile() &&
|
||||
frappe.user.has_role("System Manager");
|
||||
if (visiblity_condition && isFCUser) {
|
||||
addChatBubble();
|
||||
}
|
||||
if (isFCUser) {
|
||||
$.extend(card_args, {
|
||||
primary_action_label: "Upgrade",
|
||||
|
|
@ -42,12 +50,7 @@ $(document).ready(function () {
|
|||
});
|
||||
}
|
||||
$(document).on("desktop_screen", function (event, data) {
|
||||
if (
|
||||
frappe.boot.is_fc_site &&
|
||||
!!frappe.boot.setup_complete &&
|
||||
!frappe.is_mobile() &&
|
||||
frappe.user.has_role("System Manager")
|
||||
) {
|
||||
if (visiblity_condition) {
|
||||
if (site_info.trial_end_date && trial_end_date > new Date()) {
|
||||
card_args.parent = $(".icons-container").first();
|
||||
let banner_card = new frappe.ui.SidebarCard(card_args);
|
||||
|
|
@ -84,3 +87,25 @@ function openFrappeCloudDashboard() {
|
|||
"_blank"
|
||||
);
|
||||
}
|
||||
|
||||
function addChatBubble() {
|
||||
const all_apps = frappe.utils.get_installed_apps();
|
||||
const desk_apps = ["erpnext", "hrms"];
|
||||
|
||||
const apps_allowed = frappe.utils.is_sub_array(all_apps, desk_apps);
|
||||
if (checkBusinessHours && apps_allowed) {
|
||||
let chat_banner = document.createElement("script");
|
||||
chat_banner.innerHTML =
|
||||
'(function(d,t){var BASE_URL="https://chat.frappe.cloud";var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src=BASE_URL+"/packs/js/sdk.js";g.async=true;s.parentNode.insertBefore(g,s);g.onload=function(){window.chatwootSDK.run({websiteToken:"LdmfJzftdJGEcFjoTqk8CrSq",baseUrl:BASE_URL})}})(document,"script");';
|
||||
document.body.append(chat_banner);
|
||||
const root = document.documentElement;
|
||||
root.style.setProperty("--s-700", "var(--gray-500)");
|
||||
}
|
||||
}
|
||||
|
||||
function checkBusinessHours() {
|
||||
let currentTime = new Date();
|
||||
const istTime = new Date(currentTime.toLocaleString("en-US", { timeZone: "Asia/Kolkata" }));
|
||||
|
||||
return istTime.getHours() >= 11 && istTime.getHours() < 18;
|
||||
}
|
||||
|
|
|
|||
2
frappe/public/js/bootstrap-4-web.bundle.js
vendored
2
frappe/public/js/bootstrap-4-web.bundle.js
vendored
|
|
@ -25,7 +25,7 @@ frappe.get_modal = function (title, content) {
|
|||
<div class="modal-header">
|
||||
<h5 class="modal-title">${title}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
${frappe.utils.icon("close-alt", "sm", "close-alt")}
|
||||
${frappe.utils.icon("x", "sm", "close-alt")}
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
|
|
|||
|
|
@ -324,8 +324,8 @@ frappe.get_data_pill = (
|
|||
`);
|
||||
if (remove_action) {
|
||||
let remove_btn = $(`
|
||||
<span class="remove-btn cursor-pointer">
|
||||
${frappe.utils.icon("close", "sm", "es-icon")}
|
||||
<span class="remove-btn cursor-pointer flex align-items-center">
|
||||
${frappe.utils.icon("x", "sm")}
|
||||
</span>
|
||||
`);
|
||||
if (typeof remove_action === "function") {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ frappe.ui.form.ControlButton = class ControlButton extends frappe.ui.form.Contro
|
|||
this.$input = $(
|
||||
`<button
|
||||
class="btn ${frappe.utils.escape_html(btn_size)} ${frappe.utils.escape_html(btn_type)}"
|
||||
title="${frappe.utils.escape_html(this.df.label)}"
|
||||
title="${this.df.title || frappe.utils.escape_html(this.df.label)}"
|
||||
>`
|
||||
)
|
||||
.prependTo(me.input_area)
|
||||
|
|
|
|||
|
|
@ -270,6 +270,13 @@ frappe.ui.form.Dashboard = class FormDashboard {
|
|||
if (d.label == group.label) {
|
||||
group_added.push(d.label);
|
||||
group.items.push(...d.items);
|
||||
|
||||
if (d.fieldnames) {
|
||||
if (!group.fieldnames) {
|
||||
group.fieldnames = {};
|
||||
}
|
||||
Object.assign(group.fieldnames, d.fieldnames);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -335,7 +342,9 @@ frappe.ui.form.Dashboard = class FormDashboard {
|
|||
|
||||
// bind new
|
||||
transactions_area_body.find(".btn-new").on("click", function () {
|
||||
me.frm.make_new($(this).attr("data-doctype"));
|
||||
const doctype = $(this).attr("data-doctype");
|
||||
const fieldname = $(this).attr("data-fieldname");
|
||||
me.frm.make_new(doctype, fieldname);
|
||||
});
|
||||
|
||||
this.data_rendered = true;
|
||||
|
|
@ -369,6 +378,11 @@ frappe.ui.form.Dashboard = class FormDashboard {
|
|||
let doctype = $link.attr("data-doctype"),
|
||||
names = $link.attr("data-names") || [];
|
||||
|
||||
const fieldname =
|
||||
$link.find(".document-link-badge").attr("data-fieldname") ||
|
||||
(this.data.non_standard_fieldnames && this.data.non_standard_fieldnames[doctype]) ||
|
||||
this.data.fieldname;
|
||||
|
||||
if (
|
||||
this.internal_links_found &&
|
||||
this.internal_links_found.find((d) => d.doctype === doctype)
|
||||
|
|
@ -378,8 +392,8 @@ frappe.ui.form.Dashboard = class FormDashboard {
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (this.data.fieldname) {
|
||||
frappe.route_options = this.get_document_filter(doctype);
|
||||
} else if (fieldname) {
|
||||
frappe.route_options = this.get_document_filter(doctype, fieldname);
|
||||
if (show_open && frappe.ui.notifications) {
|
||||
frappe.ui.notifications.show_open_count_list(doctype);
|
||||
}
|
||||
|
|
@ -388,13 +402,10 @@ frappe.ui.form.Dashboard = class FormDashboard {
|
|||
frappe.set_route("List", doctype, "List");
|
||||
}
|
||||
|
||||
get_document_filter(doctype) {
|
||||
get_document_filter(doctype, fieldname) {
|
||||
// return the default filter for the given document
|
||||
// like {"customer": frm.doc.name}
|
||||
let filter = {};
|
||||
let fieldname = this.data.non_standard_fieldnames
|
||||
? this.data.non_standard_fieldnames[doctype] || this.data.fieldname
|
||||
: this.data.fieldname;
|
||||
const filter = {};
|
||||
|
||||
if (this.data.dynamic_links && this.data.dynamic_links[fieldname]) {
|
||||
let dynamic_fieldname = this.data.dynamic_links[fieldname][1];
|
||||
|
|
|
|||
|
|
@ -783,6 +783,7 @@ frappe.ui.form.Form = class FrappeForm {
|
|||
this.show_submit_message();
|
||||
this.clear_custom_buttons();
|
||||
this.show_web_link();
|
||||
this.show_report_bug_link();
|
||||
this.show_workflow_read_only_banner();
|
||||
}
|
||||
|
||||
|
|
@ -1280,6 +1281,17 @@ frappe.ui.form.Form = class FrappeForm {
|
|||
}
|
||||
}
|
||||
|
||||
show_report_bug_link() {
|
||||
if (this.meta.beta) {
|
||||
this.add_web_link(
|
||||
"https://github.com/frappe/" +
|
||||
frappe.boot.module_app[frappe.scrub(this.meta.module)] +
|
||||
"/issues/new",
|
||||
__("Report bug")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
add_web_link(path, label) {
|
||||
label = __(label) || __("See on Website");
|
||||
this.web_link = this.sidebar
|
||||
|
|
@ -2007,7 +2019,7 @@ frappe.ui.form.Form = class FrappeForm {
|
|||
}
|
||||
}
|
||||
|
||||
make_new(doctype) {
|
||||
make_new(doctype, fieldname) {
|
||||
// make new doctype from the current form
|
||||
// will handover to `make_methods` if defined
|
||||
// or will create and match link fields
|
||||
|
|
@ -2021,7 +2033,7 @@ frappe.ui.form.Form = class FrappeForm {
|
|||
let new_doc = frappe.model.get_new_doc(doctype, null, null, true);
|
||||
|
||||
// set link fields (if found)
|
||||
me.set_link_field(doctype, new_doc);
|
||||
me.set_link_field(doctype, new_doc, fieldname);
|
||||
|
||||
frappe.ui.form.make_quick_entry(doctype, null, null, new_doc);
|
||||
// frappe.set_route('Form', doctype, new_doc.name);
|
||||
|
|
@ -2029,16 +2041,27 @@ frappe.ui.form.Form = class FrappeForm {
|
|||
}
|
||||
}
|
||||
|
||||
set_link_field(doctype, new_doc) {
|
||||
set_link_field(doctype, new_doc, fieldname) {
|
||||
let me = this;
|
||||
frappe.get_meta(doctype).fields.forEach(function (df) {
|
||||
if (df.fieldtype === "Link" && df.options === me.doctype) {
|
||||
const isLinkToParent = df.fieldtype === "Link" && df.options === me.doctype;
|
||||
|
||||
if (fieldname) {
|
||||
if (df.fieldname === fieldname && isLinkToParent) {
|
||||
new_doc[df.fieldname] = me.doc.name;
|
||||
}
|
||||
if (df.fieldtype === "Table" && df.options && df.reqd) {
|
||||
me.set_link_field(df.options, new_doc[df.fieldname][0]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (isLinkToParent) {
|
||||
new_doc[df.fieldname] = me.doc.name;
|
||||
} else if (["Link", "Dynamic Link"].includes(df.fieldtype) && me.doc[df.fieldname]) {
|
||||
new_doc[df.fieldname] = me.doc[df.fieldname];
|
||||
} else if (df.fieldtype === "Table" && df.options && df.reqd) {
|
||||
let row = new_doc[df.fieldname][0];
|
||||
me.set_link_field(df.options, row);
|
||||
me.set_link_field(df.options, new_doc[df.fieldname][0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ frappe.ui.form.Layout = class Layout {
|
|||
}
|
||||
|
||||
// Add close button to block if not permanent
|
||||
const close_message = $(`<div class="close-message">${frappe.utils.icon("close")}</div>`);
|
||||
const close_message = $(`<div class="close-message">${frappe.utils.icon("x")}</div>`);
|
||||
if (!permanent) {
|
||||
close_message.appendTo($html);
|
||||
close_message.on("click", () => $html.remove());
|
||||
|
|
|
|||
|
|
@ -285,8 +285,8 @@ frappe.ui.form.AssignmentClass = class AssignmentClass {
|
|||
const row = $(`
|
||||
<div class="dialog-assignment-row" data-user="${assignment}">
|
||||
<div class="assignee">
|
||||
${frappe.avatar(assignment)}
|
||||
${frappe.user.full_name(assignment)}
|
||||
${frappe.avatar(assignment, "avatar-smaller")}
|
||||
<span>${frappe.user.full_name(assignment)}</span>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||
</div>
|
||||
|
|
@ -297,8 +297,8 @@ frappe.ui.form.AssignmentClass = class AssignmentClass {
|
|||
|
||||
if (assignment === frappe.session.user) {
|
||||
btn_group.append(`
|
||||
<button type="button" class="btn complete-btn" title="${__("Done")}">
|
||||
${frappe.utils.icon("tick", "xs")}
|
||||
<button type="button" class="btn btn-xs complete-btn" title="${__("Done")}">
|
||||
${frappe.utils.icon("check")}
|
||||
</button>
|
||||
`);
|
||||
btn_group.find(".complete-btn").click(() => {
|
||||
|
|
@ -324,7 +324,7 @@ frappe.ui.form.AssignmentClass = class AssignmentClass {
|
|||
|
||||
if (assignment === frappe.session.user || this.frm.perm[0].write) {
|
||||
btn_group.append(`
|
||||
<button type="button" class="btn remove-btn" title="${__("Cancel")}">
|
||||
<button type="button" class="btn btn-xs remove-btn" title="${__("Cancel")}">
|
||||
${frappe.utils.icon("x")}
|
||||
</button>
|
||||
`);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ frappe.ui.form.Sidebar = class {
|
|||
.appendTo(this.page.sidebar.empty());
|
||||
|
||||
this.user_actions = this.sidebar.find(".user-actions");
|
||||
this.user_actions_list = this.sidebar.find(".user-actions-list");
|
||||
this.image_section = this.sidebar.find(".sidebar-image-section");
|
||||
this.image_wrapper = this.image_section.find(".sidebar-image-wrapper");
|
||||
this.make_assignments();
|
||||
|
|
@ -115,7 +116,6 @@ frappe.ui.form.Sidebar = class {
|
|||
make_like() {
|
||||
this.like_wrapper = this.sidebar.find(".liked-by");
|
||||
this.like_icon = this.sidebar.find(".liked-by .like-icon");
|
||||
this.like_count = this.sidebar.find(".liked-by .like-count");
|
||||
frappe.ui.setup_like_popover(this.sidebar.find(".form-stats-likes"), ".like-icon");
|
||||
|
||||
this.like_icon.on("click", () => {
|
||||
|
|
@ -138,8 +138,6 @@ frappe.ui.form.Sidebar = class {
|
|||
.toggleClass("liked", liked)
|
||||
.attr("data-doctype", this.frm.doctype)
|
||||
.attr("data-name", this.frm.doc.name);
|
||||
|
||||
this.like_count && this.like_count.text(JSON.parse(this.frm.doc._liked_by || "[]").length);
|
||||
}
|
||||
|
||||
refresh_web_view_count() {
|
||||
|
|
@ -245,19 +243,23 @@ frappe.ui.form.Sidebar = class {
|
|||
}
|
||||
|
||||
add_user_action(label, click) {
|
||||
return $("<a>")
|
||||
.html(label)
|
||||
.appendTo(
|
||||
$('<div class="user-action-row"></div>').appendTo(
|
||||
this.user_actions.removeClass("hidden")
|
||||
)
|
||||
const parent = this.user_actions_list.length ? this.user_actions_list : this.user_actions;
|
||||
this.user_actions.removeClass("hidden");
|
||||
const row = $('<div class="user-action-row"></div>').appendTo(parent);
|
||||
|
||||
return $('<a class="user-action-link"></a>')
|
||||
.html(
|
||||
`<span class="user-action-label">${label}</span>
|
||||
<span class="user-action-external-icon">${frappe.utils.icon("external-link", "sm")}</span>`
|
||||
)
|
||||
.appendTo(row)
|
||||
.on("click", click);
|
||||
}
|
||||
|
||||
clear_user_actions() {
|
||||
this.user_actions.addClass("hidden");
|
||||
this.user_actions.find(".user-action-row").remove();
|
||||
const parent = this.user_actions_list.length ? this.user_actions_list : this.user_actions;
|
||||
parent.find(".user-action-row").remove();
|
||||
}
|
||||
|
||||
refresh_image() {}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@
|
|||
</div>
|
||||
{% for (let j=0; j < transactions[i].items.length; j++) { %}
|
||||
{% let doctype = transactions[i].items[j]; %}
|
||||
{% let fieldname = (transactions[i].fieldnames && transactions[i].fieldnames[doctype]) || transactions[i].fieldname; %}
|
||||
<div class="document-link" data-doctype="{{ doctype }}">
|
||||
<div class="document-link-badge" data-doctype="{{ doctype }}">
|
||||
<div class="document-link-badge" data-doctype="{{ doctype }}" data-fieldname="{{ fieldname }}">
|
||||
<a class="badge-link">{{ __(doctype) }}</a>
|
||||
<span class="count hidden"></span>
|
||||
</div>
|
||||
|
|
@ -19,7 +20,8 @@
|
|||
</span>
|
||||
{% if !internal_links[doctype] %}
|
||||
<button class="btn btn-new btn-secondary btn-xs icon-btn hidden"
|
||||
data-doctype="{{ doctype }}">
|
||||
data-doctype="{{ doctype }}"
|
||||
data-fieldname="{{ fieldname }}">
|
||||
<svg class="icon icon-sm"><use href="#icon-add"></use></svg>
|
||||
</button>
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
<div class="sidebar-section user-actions hidden"></div>
|
||||
<div class="flex justify-between sidebar-image-section sidebar-section hide">
|
||||
<div class="sidebar-image-wrapper">
|
||||
<img class="sidebar-image">
|
||||
|
|
@ -25,7 +24,6 @@
|
|||
<svg class="icon icon-sm like-icon pointer">
|
||||
<use href="#icon-heart"></use>
|
||||
</svg>
|
||||
<span class="like-count ml-2"></span>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
@ -34,14 +32,19 @@
|
|||
<div class="flex justify-between overflow-hidden">
|
||||
<div class="ellipsis">
|
||||
{% let title = frm.get_title(); %}
|
||||
{% if (title && title !== frm.doc.name) { %}
|
||||
<div class="form-details flex justify-between">
|
||||
<span class="bold ellipsis form-title-text mr-3 text-medium">{%= frappe.utils.escape_html(frappe.utils.html2text(title)) %}</span>
|
||||
</div>
|
||||
{% } %}
|
||||
<div class="form-name-container mt-2 flex justify-between form-name-copy" data-copy="{{frm.doc.name}}" title="{{frm.doc.name}}" >
|
||||
{% if frm.meta.beta %}
|
||||
<div class="pt-1">
|
||||
<label class="indicator-pill yellow mb-0" title="{{ __("This feature is brand new and still experimental") }}">{{ __("Experimental") }}</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if (title && title !== frm.doc.name) { %}
|
||||
<div class="form-name-container mt-1 flex justify-between form-name-copy" data-copy="{{frm.doc.name}}" title="{{frm.doc.name}}" >
|
||||
<span class="ellipsis mr-3">{%= frm.doc.name %}</span>
|
||||
</div>
|
||||
{% } %}
|
||||
</div>
|
||||
{% if not image_field %}
|
||||
<div class="align-items-baseline flex form-stats-likes">
|
||||
|
|
@ -51,21 +54,10 @@
|
|||
<svg class="icon icon-sm like-icon pointer">
|
||||
<use href="#icon-heart"></use>
|
||||
</svg>
|
||||
<span class="like-count ml-2"></span>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if frm.meta.beta %}
|
||||
<div class="flex pt-2 justify-between">
|
||||
<div>
|
||||
<a class="small text-muted" href="https://github.com/frappe/{{ frappe.boot.module_app[frappe.scrub(frm.meta.module)] }}/issues/new"
|
||||
target="_blank">
|
||||
{{ __("Report bug") }}</a>
|
||||
</div>
|
||||
<label class="indicator-pill yellow mb-0" title="{{ __("This feature is brand new and still experimental") }}">{{ __("Experimental") }}</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="sidebar-section sidebar-rating hide border-bottom">
|
||||
<div style="position: relative;">
|
||||
|
|
@ -82,6 +74,15 @@
|
|||
</div>
|
||||
{% } %}
|
||||
</div>
|
||||
<div class="sidebar-section user-actions hidden border-bottom">
|
||||
<div class="form-sidebar-items user-actions-header">
|
||||
<div class="form-sidebar-label">
|
||||
{%= frappe.utils.icon("link-2") %}
|
||||
<span class="ellipsis">{%= __("Links") %}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user-actions-list"></div>
|
||||
</div>
|
||||
<div class="sidebar-section form-assignments">
|
||||
<div>
|
||||
<span class="form-sidebar-items">
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ $.extend(frappe.model, {
|
|||
allowed_records.length;
|
||||
|
||||
// don't set defaults for "User" link field using User Permissions!
|
||||
if (df.fieldtype === "Link" && df.options !== "User") {
|
||||
if (!df.read_only && df.fieldtype === "Link" && df.options !== "User") {
|
||||
// If user permission has Is Default enabled or single-user permission has found against respective doctype.
|
||||
if (has_user_permissions && default_doc) {
|
||||
value = default_doc;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
{% if (!in_folder) { %}
|
||||
<div class="icon-caption">
|
||||
<div class="icon-title" data-toggle="tooltip" data-original-title="{{ __(icon.label) }}">{{ __(icon.label) }}</div>
|
||||
<div class="icon-subtitle"></div>
|
||||
<!-- <div class="icon-subtitle"></div> -->
|
||||
</div>
|
||||
{% } %}
|
||||
{% if(!icon.in_folder && !icon.restrict_removal) { %}
|
||||
|
|
@ -25,4 +25,4 @@
|
|||
{%= frappe.utils.icon("x") %}
|
||||
</div>
|
||||
{% } %}
|
||||
</a>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -128,6 +128,14 @@ frappe.ui.Dialog = class Dialog extends frappe.ui.FieldGroup {
|
|||
) {
|
||||
$input.blur();
|
||||
}
|
||||
})
|
||||
.on("keydown", function (e) {
|
||||
if (e.key === "Escape" || e.keyCode === 27) {
|
||||
// when dialog is open and contains an awesomplete dropdown - do not close the dialog on escape key press
|
||||
if (me.display && me.$wrapper.find(".awesomplete").length) {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// MIT License. See license.txt
|
||||
import { createPopper } from "@popperjs/core";
|
||||
|
||||
frappe.ui.is_liked = function (doc) {
|
||||
return frappe.ui.get_liked_by(doc).includes(frappe.session.user);
|
||||
|
|
@ -65,63 +66,157 @@ frappe.ui.setup_like_popover = ($parent, selector) => {
|
|||
return;
|
||||
}
|
||||
|
||||
$parent.on("mouseover", selector, function () {
|
||||
const target_element = $(this);
|
||||
target_element.popover({
|
||||
animation: true,
|
||||
placement: "bottom",
|
||||
trigger: "manual",
|
||||
template: `<div class="liked-by-popover popover">
|
||||
<div class="arrow"></div>
|
||||
let active_target = null;
|
||||
let active_popover = null;
|
||||
let active_popper = null;
|
||||
let hide_timer = null;
|
||||
|
||||
const clear_hide_timer = () => {
|
||||
if (hide_timer) {
|
||||
clearTimeout(hide_timer);
|
||||
hide_timer = null;
|
||||
}
|
||||
};
|
||||
|
||||
const destroy_active_popover = () => {
|
||||
clear_hide_timer();
|
||||
if (active_target) {
|
||||
active_target.off(".likePopover");
|
||||
}
|
||||
if (active_popover) {
|
||||
active_popover.off(".likePopover");
|
||||
active_popover.remove();
|
||||
}
|
||||
if (active_popper) {
|
||||
active_popper.destroy();
|
||||
}
|
||||
active_target = null;
|
||||
active_popover = null;
|
||||
active_popper = null;
|
||||
};
|
||||
|
||||
const schedule_hide = () => {
|
||||
clear_hide_timer();
|
||||
hide_timer = setTimeout(() => {
|
||||
destroy_active_popover();
|
||||
}, 120);
|
||||
};
|
||||
|
||||
const get_liked_by_users = (target_element) => {
|
||||
let liked_by = target_element.parents(".liked-by").attr("data-liked-by");
|
||||
liked_by = liked_by ? decodeURI(liked_by) : "[]";
|
||||
return JSON.parse(liked_by);
|
||||
};
|
||||
|
||||
const get_popover_content = (target_element) => {
|
||||
const liked_by = get_liked_by_users(target_element);
|
||||
const content = $('<div class="liked-by-popover-content"></div>');
|
||||
const like_count = liked_by.length;
|
||||
|
||||
if (like_count > 3) {
|
||||
const like_summary = __("Liked by {0} people", [like_count]);
|
||||
const like_count_html = $(
|
||||
`<div class="liked-by-popover-summary">${like_summary}</div>`
|
||||
);
|
||||
content.append(like_count_html);
|
||||
}
|
||||
|
||||
if (!liked_by.length) {
|
||||
return content;
|
||||
}
|
||||
|
||||
const liked_by_list = $('<ul class="list-unstyled"></ul>');
|
||||
const link_base = "/desk/user/";
|
||||
|
||||
liked_by.forEach((user) => {
|
||||
liked_by_list.append(`
|
||||
<li data-user=${user}>${frappe.avatar(user, "avatar-xs")}
|
||||
<span>${frappe.user.full_name(user)}</span>
|
||||
</li>
|
||||
`);
|
||||
});
|
||||
|
||||
liked_by_list.children("li").on("click", (ev) => {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
const user = ev.currentTarget.dataset.user;
|
||||
setTimeout(() => destroy_active_popover(), 0);
|
||||
frappe.set_route(link_base + user);
|
||||
});
|
||||
|
||||
content.append(liked_by_list);
|
||||
return content;
|
||||
};
|
||||
|
||||
const show_popover = (target_element) => {
|
||||
if (!get_liked_by_users(target_element).length) {
|
||||
destroy_active_popover();
|
||||
return;
|
||||
}
|
||||
|
||||
if (active_target?.get(0) === target_element.get(0) && active_popover) {
|
||||
clear_hide_timer();
|
||||
active_popper?.update();
|
||||
return;
|
||||
}
|
||||
|
||||
destroy_active_popover();
|
||||
|
||||
const popover = $(
|
||||
`<div class="liked-by-popover popover show" role="tooltip">
|
||||
<div class="popover-body popover-content"></div>
|
||||
</div>`,
|
||||
content: () => {
|
||||
let liked_by = target_element.parents(".liked-by").attr("data-liked-by");
|
||||
liked_by = liked_by ? decodeURI(liked_by) : "[]";
|
||||
liked_by = JSON.parse(liked_by);
|
||||
</div>`
|
||||
);
|
||||
|
||||
if (!liked_by.length) {
|
||||
return "";
|
||||
}
|
||||
popover.find(".popover-content").append(get_popover_content(target_element));
|
||||
$(document.body).append(popover);
|
||||
|
||||
let liked_by_list = $(`<ul class="list-unstyled"></ul>`);
|
||||
|
||||
// to show social profile of the user
|
||||
let link_base = "/desk/user/";
|
||||
|
||||
liked_by.forEach((user) => {
|
||||
// append user list item
|
||||
liked_by_list.append(`
|
||||
<li data-user=${user}>${frappe.avatar(user, "avatar-xs")}
|
||||
<span>${frappe.user.full_name(user)}</span>
|
||||
</li>
|
||||
`);
|
||||
});
|
||||
|
||||
liked_by_list.children("li").click((ev) => {
|
||||
let user = ev.currentTarget.dataset.user;
|
||||
target_element.popover("hide");
|
||||
frappe.set_route(link_base + user);
|
||||
});
|
||||
|
||||
return liked_by_list;
|
||||
},
|
||||
html: true,
|
||||
container: "body",
|
||||
const popper = createPopper(target_element.get(0), popover.get(0), {
|
||||
placement: "bottom",
|
||||
modifiers: [
|
||||
{
|
||||
name: "offset",
|
||||
options: {
|
||||
offset: [0, 8],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "preventOverflow",
|
||||
options: {
|
||||
padding: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "flip",
|
||||
options: {
|
||||
padding: 12,
|
||||
fallbackPlacements: ["bottom-start", "top", "top-start"],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
target_element.popover("show");
|
||||
active_target = target_element;
|
||||
active_popover = popover;
|
||||
active_popper = popper;
|
||||
|
||||
$(".popover").on("mouseleave", () => {
|
||||
target_element.popover("hide");
|
||||
});
|
||||
target_element
|
||||
.off(".likePopover")
|
||||
.on("mouseenter.likePopover", clear_hide_timer)
|
||||
.on("mouseleave.likePopover", schedule_hide);
|
||||
|
||||
target_element.on("mouseout", () => {
|
||||
setTimeout(() => {
|
||||
if (!$(".popover:hover").length) {
|
||||
target_element.popover("hide");
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
popover
|
||||
.off(".likePopover")
|
||||
.on("mousedown.likePopover click.likePopover", (ev) => {
|
||||
ev.stopPropagation();
|
||||
})
|
||||
.on("mouseenter.likePopover", clear_hide_timer)
|
||||
.on("mouseleave.likePopover", schedule_hide);
|
||||
};
|
||||
|
||||
$parent.on("mouseenter", selector, function () {
|
||||
show_popover($(this));
|
||||
});
|
||||
|
||||
$parent.on("mouseleave", selector, schedule_hide);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ frappe.show_alert = frappe.toast = function (message, seconds = 7, actions = {})
|
|||
<div class="alert-subtitle">${message.subtitle || ""}</div>
|
||||
</div>
|
||||
<div class="alert-body" style="display: none"></div>
|
||||
<a class="close">${frappe.utils.icon("close-alt")}</a>
|
||||
<a class="close">${frappe.utils.icon("x")}</a>
|
||||
</div>
|
||||
`);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
Save
|
||||
</button>
|
||||
</div>
|
||||
<div class="promotional-banners"></div>
|
||||
<p>
|
||||
<a class="onboarding-sidebar">
|
||||
{%= frappe.utils.icon("user-check" , "sm", "", "", "text-ink-gray-7 current-color", true)%}
|
||||
|
|
|
|||
|
|
@ -78,9 +78,95 @@ frappe.ui.Sidebar = class Sidebar {
|
|||
}
|
||||
}
|
||||
|
||||
setup_promotional_banners() {
|
||||
if (
|
||||
cint(frappe.sys_defaults?.disable_product_suggestion) ||
|
||||
!frappe.user.has_role("System Manager")
|
||||
)
|
||||
return;
|
||||
|
||||
let module = this.all_sidebar_items?.[this.workspace_title]?.["module"] || "";
|
||||
if (!module) return;
|
||||
|
||||
this.$promotional_banners = this.wrapper.find(".promotional-banners");
|
||||
this.$promotional_banners.empty();
|
||||
this.promotional_banners = [];
|
||||
|
||||
this.get_crm_banner(module);
|
||||
this.get_helpdesk_banner(module);
|
||||
|
||||
this.render_promotional_banners();
|
||||
}
|
||||
|
||||
get_crm_banner(module) {
|
||||
if (module != "CRM") return;
|
||||
|
||||
const icon =
|
||||
$(`<svg width="16" height="16" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0 11.2C0 7.27963 0 5.31945 0.762954 3.82207C1.43407 2.50493 2.50493 1.43407 3.82207 0.762954C5.31945 0 7.27963 0 11.2 0H16.8C20.7204 0 22.6806 0 24.1779 0.762954C25.4951 1.43407 26.5659 2.50493 27.237 3.82207C28 5.31945 28 7.27963 28 11.2V16.8C28 20.7204 28 22.6806 27.237 24.1779C26.5659 25.4951 25.4951 26.5659 24.1779 27.237C22.6806 28 20.7204 28 16.8 28H11.2C7.27963 28 5.31945 28 3.82207 27.237C2.50493 26.5659 1.43407 25.4951 0.762954 24.1779C0 22.6806 0 20.7204 0 16.8V11.2Z" fill="#DB4EE0"/>
|
||||
<path d="M5.02441 6.58252V9.09486H20.4627V10.9791L15.0135 16.3806V19.3201H12.9676V16.3806C12.9676 16.3806 9.78529 13.1774 8.62962 12.0469H5.03698L10.0156 17.0087C10.3045 17.2851 10.4678 17.6745 10.4678 18.0765V21.041L17.5259 21.0661V18.0765C17.5259 17.6745 17.6892 17.2851 17.9781 17.0087L22.9751 12.0343V6.58252H5.02441Z" fill="#F1FCFF"/>
|
||||
</svg>
|
||||
`);
|
||||
|
||||
const title = __("Switch to Frappe CRM");
|
||||
const message = __(
|
||||
"Sales without complexity, lock-in and per-user costs. Try it for free!"
|
||||
);
|
||||
const link =
|
||||
"https://frappe.io/crm?utm_source=crm-sidebar&utm_medium=sidebar&utm_campaign=frappe-ad";
|
||||
|
||||
this.promotional_banners.push({ title, message, link, icon });
|
||||
}
|
||||
|
||||
get_helpdesk_banner(module) {
|
||||
if (module != "Support") return;
|
||||
|
||||
const icon =
|
||||
$(`<svg width="16" height="16" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0 11.2C0 7.27963 0 5.31945 0.762954 3.82207C1.43407 2.50493 2.50493 1.43407 3.82207 0.762954C5.31945 0 7.27963 0 11.2 0H16.8C20.7204 0 22.6806 0 24.1779 0.762954C25.4951 1.43407 26.5659 2.50493 27.237 3.82207C28 5.31945 28 7.27963 28 11.2V16.8C28 20.7204 28 22.6806 27.237 24.1779C26.5659 25.4951 25.4951 26.5659 24.1779 27.237C22.6806 28 20.7204 28 16.8 28H11.2C7.27963 28 5.31945 28 3.82207 27.237C2.50493 26.5659 1.43407 25.4951 0.762954 24.1779C0 22.6806 0 20.7204 0 16.8V11.2Z" fill="#7D42FB"/>
|
||||
<path d="M22.7237 12.1723V6.65771H5.26367V9.17005H20.2239V11.5568C19.2189 11.8457 18.4904 12.7753 18.4904 13.8681C18.4904 14.961 19.2189 15.878 20.2239 16.1669V18.5536H7.77601V11.9964H5.26367V21.066H22.7362V15.5514L21.2414 14.4836V13.2526L22.7362 12.1849L22.7237 12.1723Z" fill="#EDF7FF"/>
|
||||
</svg>
|
||||
`);
|
||||
|
||||
const title = __("Switch to Helpdesk");
|
||||
const message = __(
|
||||
"Support without complexity, lock-in and per-user costs. Try it for free!"
|
||||
);
|
||||
const link =
|
||||
"https://frappe.io/helpdesk?utm_source=support-sidebar&utm_medium=sidebar&utm_campaign=frappe-ad";
|
||||
|
||||
this.promotional_banners.push({ title, message, link, icon });
|
||||
}
|
||||
|
||||
render_promotional_banners() {
|
||||
let me = this;
|
||||
|
||||
if (this.promotional_banners.length === 0) {
|
||||
this.$promotional_banners.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
this.$promotional_banners.show();
|
||||
|
||||
this.promotional_banners.forEach((banner) => {
|
||||
let banner_html = $(`
|
||||
<a href="${banner.link}" class="promotional-banner" target="_blank" title="${banner.message}">
|
||||
<span>${banner.title}</span>
|
||||
</a>
|
||||
`);
|
||||
|
||||
banner_html.prepend(banner.icon);
|
||||
me.$promotional_banners.append(banner_html);
|
||||
});
|
||||
}
|
||||
|
||||
remove_onboarding_wrapper() {
|
||||
this.$onboarding.empty();
|
||||
this.wrapper.find(".onboarding-sidebar").removeClass("hidden");
|
||||
|
||||
if (!this.sidebar_data?.module_onboarding) {
|
||||
this.wrapper.find(".onboarding-sidebar").addClass("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
setup_onboarding() {
|
||||
|
|
@ -170,6 +256,7 @@ frappe.ui.Sidebar = class Sidebar {
|
|||
this.sidebar_header = new frappe.ui.SidebarHeader(this);
|
||||
this.make_sidebar();
|
||||
this.add_sidebar_cards();
|
||||
this.setup_promotional_banners();
|
||||
this.setup_onboarding();
|
||||
|
||||
this.wrapper.find(".onboarding-sidebar").click(() => {
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ function markReset(step) {
|
|||
<!-- Header -->
|
||||
|
||||
<div class="header onb-header-main">
|
||||
<div class="text-base font-medium">Getting started</div>
|
||||
<div class="text-base font-medium">{{ __("Getting Started") }}</div>
|
||||
<div class="onb-header-actions">
|
||||
<button @click="toggleCollapse" v-html="minimizeIcon"></button>
|
||||
<button @click="close" v-html="closeIcon"></button>
|
||||
|
|
@ -249,7 +249,7 @@ function markReset(step) {
|
|||
<div class="text-base font-medium">{{ title }}</div>
|
||||
|
||||
<div class="onb-title-steps">
|
||||
{{ completedCount }}/{{ steps.length }} steps completed
|
||||
{{ completedCount }}/{{ steps.length }} {{ __("steps completed") }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -297,8 +297,11 @@ function markReset(step) {
|
|||
</div>
|
||||
|
||||
<div v-if="!step.is_skipped">
|
||||
<span class="text-base onb-step-text">
|
||||
{{ step.action_label }}
|
||||
<span
|
||||
class="text-base onb-step-text"
|
||||
:class="step.is_complete ? 'text-extra-muted' : ''"
|
||||
>
|
||||
{{ __(step.action_label) }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-else>
|
||||
|
|
@ -306,7 +309,7 @@ function markReset(step) {
|
|||
class="text-base onb-step-text"
|
||||
style="text-decoration-line: line-through"
|
||||
>
|
||||
{{ step.action_label }}
|
||||
{{ __(step.action_label) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ function addStyles() {
|
|||
position: fixed;
|
||||
right: 24px;
|
||||
bottom: 24px;
|
||||
width: 380px;
|
||||
width: 310px;
|
||||
max-height: 80vh;
|
||||
background: #fff;
|
||||
border-radius: 16px;
|
||||
|
|
|
|||
|
|
@ -2252,4 +2252,16 @@ Object.assign(frappe.utils, {
|
|||
}
|
||||
return value;
|
||||
},
|
||||
get_installed_apps() {
|
||||
return frappe.boot.app_data.map((app) => {
|
||||
return app.app_name;
|
||||
});
|
||||
},
|
||||
is_sub_array(big, small) {
|
||||
let i = 0;
|
||||
for (let num of big) {
|
||||
if (num === small[i]) i++;
|
||||
}
|
||||
return i === small.length;
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ frappe.views.CommunicationComposer = class {
|
|||
{
|
||||
fieldtype: "Button",
|
||||
label: frappe.utils.icon("down", "xs"),
|
||||
title: __("More Options"),
|
||||
fieldname: "option_toggle_button",
|
||||
click: () => {
|
||||
this.toggle_more_options();
|
||||
|
|
@ -496,7 +497,11 @@ frappe.views.CommunicationComposer = class {
|
|||
},
|
||||
];
|
||||
|
||||
frappe.utils.add_select_group_button(clear_and_add_template, email_template_actions);
|
||||
frappe.utils.add_select_group_button(
|
||||
clear_and_add_template,
|
||||
email_template_actions,
|
||||
"btn-default"
|
||||
);
|
||||
$(fields.use_html.wrapper).addClass("mt-2 text-center").appendTo(clear_and_add_template);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -493,6 +493,7 @@ frappe.views.Workspace = class Workspace {
|
|||
let blocks = [
|
||||
{
|
||||
type: "header",
|
||||
|
||||
data: { text: values.title },
|
||||
},
|
||||
];
|
||||
|
|
@ -666,7 +667,6 @@ frappe.views.Workspace = class Workspace {
|
|||
spacer: this.blocks["spacer"],
|
||||
HeaderSize: frappe.workspace_block.tunes["header_size"],
|
||||
};
|
||||
|
||||
this.editor = new EditorJS({
|
||||
data: {
|
||||
blocks: blocks || [],
|
||||
|
|
@ -676,6 +676,26 @@ frappe.views.Workspace = class Workspace {
|
|||
readOnly: true,
|
||||
logLevel: "ERROR",
|
||||
});
|
||||
if (blocks.length == 0) {
|
||||
let message = __("Welcome to the {0} workspace", [this.page.title]);
|
||||
let default_block = [
|
||||
{
|
||||
type: "header",
|
||||
data: { text: message },
|
||||
},
|
||||
];
|
||||
if (this.has_access) {
|
||||
default_block.push({
|
||||
type: "paragraph",
|
||||
data: {
|
||||
text: __("Click on {0} to edit", [frappe.utils.icon("ellipsis")]),
|
||||
},
|
||||
});
|
||||
}
|
||||
this.editor.isReady.then(() => {
|
||||
this.editor.render({ blocks: default_block });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
save_page(page) {
|
||||
|
|
|
|||
|
|
@ -243,10 +243,6 @@ body.modal-open[style^="padding-right"] {
|
|||
}
|
||||
.frappe-control:last-child {
|
||||
margin-left: 10px;
|
||||
button {
|
||||
// same as form-control input
|
||||
height: calc(1.5em + 0.7rem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -268,7 +264,19 @@ body.modal-open[style^="padding-right"] {
|
|||
}
|
||||
|
||||
.frappe-control:last-child {
|
||||
margin-top: -14px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.modal .frappe-control[data-fieldname="option_toggle_button"] {
|
||||
margin-top: 10px;
|
||||
.form-group {
|
||||
margin-bottom: 0;
|
||||
|
||||
button {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -299,6 +307,9 @@ body.modal-open[style^="padding-right"] {
|
|||
}
|
||||
.assignee {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
&:hover {
|
||||
.btn-group {
|
||||
|
|
@ -306,9 +317,6 @@ body.modal-open[style^="padding-right"] {
|
|||
transition: opacity 0.1s ease-in-out;
|
||||
}
|
||||
}
|
||||
.avatar {
|
||||
margin-right: var(--margin-md);
|
||||
}
|
||||
}
|
||||
|
||||
// Stack minimized modals
|
||||
|
|
|
|||
|
|
@ -98,6 +98,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
.avatar-smaller {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
text-align: center;
|
||||
|
||||
.standard-image {
|
||||
@include get_textstyle("xs", "regular");
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-medium {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@
|
|||
flex-wrap: wrap;
|
||||
color: var(--text-light);
|
||||
|
||||
.icon {
|
||||
stroke: var(--text-light);
|
||||
}
|
||||
|
||||
.icon-btn {
|
||||
height: unset;
|
||||
}
|
||||
|
|
@ -38,6 +42,82 @@
|
|||
}
|
||||
}
|
||||
|
||||
.user-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding: var(--padding-md);
|
||||
|
||||
.user-actions-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.user-action-row {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.user-action-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-decoration: underline;
|
||||
justify-content: space-between;
|
||||
gap: var(--margin-sm);
|
||||
width: 100%;
|
||||
padding: 4px 8px;
|
||||
margin-left: -6px;
|
||||
margin-right: -8px;
|
||||
border-radius: var(--border-radius-md);
|
||||
transition: background-color 120ms ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background: var(--subtle-fg);
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.user-action-external-icon {
|
||||
display: none;
|
||||
line-height: 0;
|
||||
|
||||
.icon {
|
||||
margin: 0;
|
||||
--icon-stroke: var(--text-muted);
|
||||
}
|
||||
}
|
||||
|
||||
&[target="_blank"] .user-action-external-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
opacity: 0;
|
||||
transform: translateX(-2px);
|
||||
transition: opacity 120ms ease, transform 120ms ease;
|
||||
}
|
||||
|
||||
&[target="_blank"]:hover .user-action-external-icon,
|
||||
&[target="_blank"]:focus-visible .user-action-external-icon {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
|
||||
.user-action-label {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-section.user-actions.border-bottom {
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.form-tags {
|
||||
.tag-area {
|
||||
margin-top: -3px;
|
||||
|
|
@ -141,8 +221,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
.form-title-text {
|
||||
// to match the actions button height for center alignment
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
.form-stats-likes {
|
||||
gap: 8px;
|
||||
gap: 2px;
|
||||
.form-print {
|
||||
button:hover {
|
||||
background: var(--btn-default-hover-bg);
|
||||
|
|
@ -318,30 +403,56 @@ body[data-route^="Form"] {
|
|||
|
||||
.attachment-row,
|
||||
.form-tag-row {
|
||||
margin: var(--margin-xs) 0;
|
||||
max-width: 100%;
|
||||
margin: 4px 0;
|
||||
|
||||
.data-pill {
|
||||
@include get_textstyle("sm", "regular");
|
||||
justify-content: space-between;
|
||||
box-shadow: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 24px;
|
||||
padding: 0px 6px !important;
|
||||
|
||||
.pill-label {
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
.icon {
|
||||
stroke: currentColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
.attachment-row {
|
||||
margin-left: -6px;
|
||||
margin-right: 0px;
|
||||
|
||||
.data-pill {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 28px;
|
||||
border-radius: var(--border-radius-md);
|
||||
padding: 0px 6px !important;
|
||||
background-color: unset;
|
||||
box-shadow: none;
|
||||
padding-left: 0px !important;
|
||||
width: 100%;
|
||||
|
||||
&:hover,
|
||||
&:focus-within {
|
||||
background-color: var(--subtle-fg);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: transparent !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
> div {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.attachment-file-label {
|
||||
display: block;
|
||||
margin-left: var(--margin-xs);
|
||||
padding-right: var(--padding-xs);
|
||||
text-align: left;
|
||||
}
|
||||
.attachment-icon {
|
||||
|
|
@ -377,13 +488,58 @@ body[data-route^="Form"] {
|
|||
.form-attachments,
|
||||
.form-tags,
|
||||
.form-shared {
|
||||
padding: 8px;
|
||||
padding: var(--padding-sm) var(--padding-md);
|
||||
}
|
||||
|
||||
.form-attachments {
|
||||
// to add gap between attachment section label and attachments
|
||||
// without affecting empty state
|
||||
.attachments-actions + .attachment-row {
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.form-tags {
|
||||
// to add gap between tag section label and tags
|
||||
// without affecting empty state
|
||||
:not(.form-tag-row) + .form-tag-row {
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.form-assignments,
|
||||
.form-shared {
|
||||
.assignments,
|
||||
.shares {
|
||||
margin: var(--margin-xs) 0px;
|
||||
margin-top: 8px;
|
||||
|
||||
.dialog-assignment-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 28px;
|
||||
border-radius: var(--border-radius-md);
|
||||
padding: 0px 6px;
|
||||
margin-left: -8px;
|
||||
margin-right: 0px;
|
||||
|
||||
&:hover,
|
||||
&:focus-within {
|
||||
background-color: var(--subtle-fg);
|
||||
}
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
margin-right: -4px;
|
||||
}
|
||||
}
|
||||
|
||||
.view-all-assignment {
|
||||
display: block;
|
||||
margin-top: var(--padding-xs);
|
||||
}
|
||||
}
|
||||
}
|
||||
.add-assignment-btn,
|
||||
|
|
@ -415,17 +571,43 @@ body[data-route^="Form"] {
|
|||
}
|
||||
}
|
||||
|
||||
.liked-by {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.liked-by-popover {
|
||||
max-width: 240px;
|
||||
border-radius: var(--border-radius-md);
|
||||
box-shadow: var(--shadow-md);
|
||||
overflow: hidden;
|
||||
|
||||
.popover-body {
|
||||
min-height: 30px;
|
||||
padding: 0px;
|
||||
|
||||
.liked-by-popover-summary {
|
||||
padding: 4px 10px;
|
||||
margin: 0;
|
||||
color: var(--text-muted);
|
||||
border-bottom: 1px solid var(--subtle-accent);
|
||||
@include get_textstyle("sm", "regular");
|
||||
}
|
||||
|
||||
ul.list-unstyled {
|
||||
margin-bottom: 0px;
|
||||
padding: 4px;
|
||||
|
||||
li {
|
||||
padding: var(--padding-xs) var(--padding-sm);
|
||||
margin: 2px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--padding-xs);
|
||||
padding: var(--padding-xs);
|
||||
margin: 0;
|
||||
border-radius: var(--border-radius-sm);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--fg-hover-color);
|
||||
|
|
|
|||
|
|
@ -127,7 +127,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
.onboarding-sidebar {
|
||||
.promotional-banners {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
margin: var(--margin-sm) 0;
|
||||
}
|
||||
|
||||
.onboarding-sidebar,
|
||||
.promotional-banner {
|
||||
text-decoration: none;
|
||||
font-size: var(--text-sm);
|
||||
display: flex;
|
||||
|
|
@ -287,9 +295,8 @@
|
|||
width: auto;
|
||||
}
|
||||
}
|
||||
.collapse-sidebar-link {
|
||||
display: none;
|
||||
}
|
||||
.promotional-banners,
|
||||
.collapse-sidebar-link,
|
||||
.dropdown-navbar-user {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,11 @@ $threshold: 34;
|
|||
max-width: var(--timeline-content-max-width);
|
||||
padding: var(--padding-sm);
|
||||
margin-left: var(--margin-md);
|
||||
|
||||
> .ql-editor {
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
&.frappe-card {
|
||||
color: var(--text-neutral);
|
||||
background-color: var(--bg-color);
|
||||
|
|
|
|||
2
frappe/website/js/bootstrap-4.js
vendored
2
frappe/website/js/bootstrap-4.js
vendored
|
|
@ -27,7 +27,7 @@ frappe.get_modal = function (title, content) {
|
|||
<div class="modal-header">
|
||||
<h5 class="modal-title">${title}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
${frappe.utils.icon("close-alt", "sm", "close-alt")}
|
||||
${frappe.utils.icon("x", "sm", "close-alt")}
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
|
|
|||
|
|
@ -207,17 +207,61 @@ def return_action_confirmation_page(doc, action, action_link, alert_doc_change=F
|
|||
|
||||
|
||||
def return_link_expired_page(doc, doc_workflow_state):
|
||||
user_full_name = get_user_who_set_workflow_state(doc, doc_workflow_state) or frappe.get_value(
|
||||
"User", doc.get("modified_by"), "full_name"
|
||||
)
|
||||
frappe.respond_as_web_page(
|
||||
_("Link Expired"),
|
||||
_("Document {0} has been set to state {1} by {2}").format(
|
||||
frappe.bold(doc.get("name")),
|
||||
frappe.bold(doc_workflow_state),
|
||||
frappe.bold(frappe.get_value("User", doc.get("modified_by"), "full_name")),
|
||||
frappe.bold(
|
||||
user_full_name
|
||||
if user_full_name
|
||||
else frappe.get_value("User", doc.get("modified_by"), "full_name")
|
||||
),
|
||||
),
|
||||
indicator_color="blue",
|
||||
)
|
||||
|
||||
|
||||
def get_user_who_set_workflow_state(doc, doc_workflow_state):
|
||||
"""Get the full name of the user who triggered the workflow action that set the document to the given state.
|
||||
Falls back to None if no completed Workflow Action is found (e.g. state was set without workflow).
|
||||
"""
|
||||
workflow_name = get_workflow_name(doc.get("doctype"))
|
||||
if not workflow_name:
|
||||
return None
|
||||
|
||||
# Get states that have a transition to the current workflow state
|
||||
from_states = frappe.get_all(
|
||||
"Workflow Transition",
|
||||
filters={"parent": workflow_name, "next_state": doc_workflow_state},
|
||||
pluck="state",
|
||||
)
|
||||
if not from_states:
|
||||
return None
|
||||
|
||||
# Find the most recently completed Workflow Action that led to this state
|
||||
WorkflowAction = DocType("Workflow Action")
|
||||
completed_by = (
|
||||
frappe.qb.from_(WorkflowAction)
|
||||
.select(WorkflowAction.completed_by)
|
||||
.where(
|
||||
(WorkflowAction.reference_doctype == doc.get("doctype"))
|
||||
& (WorkflowAction.reference_name == doc.get("name"))
|
||||
& (WorkflowAction.status == "Completed")
|
||||
& (WorkflowAction.workflow_state.isin(from_states))
|
||||
)
|
||||
.orderby(WorkflowAction.modified, order=frappe.qb.desc)
|
||||
.limit(1)
|
||||
).run()
|
||||
|
||||
if completed_by and completed_by[0][0]:
|
||||
return frappe.get_value("User", completed_by[0][0], "full_name")
|
||||
return None
|
||||
|
||||
|
||||
def update_completed_workflow_actions(doc, user=None, workflow=None, workflow_state=None):
|
||||
allowed_roles = get_allowed_roles(user, workflow, workflow_state)
|
||||
# There is no transaction leading upto this state
|
||||
|
|
|
|||
|
|
@ -343,7 +343,8 @@ def get_html_and_style(
|
|||
if isinstance(name, str):
|
||||
document = frappe.get_lazy_doc(doc, name, check_permission=True)
|
||||
else:
|
||||
document = frappe.get_doc(json.loads(doc), check_permission=True)
|
||||
details = json.loads(doc)
|
||||
document = frappe.get_cached_doc(details["doctype"], details["name"], check_permission=True)
|
||||
|
||||
print_format = get_print_format_doc(print_format, meta=document.meta)
|
||||
set_link_titles(document)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ dependencies = [
|
|||
# We depend on internal attributes,
|
||||
# do NOT add loose requirements on PyMySQL versions.
|
||||
"PyMySQL==1.1.2",
|
||||
"pypdf==6.7.1",
|
||||
"pypdf==6.7.2",
|
||||
"PyPika @ git+https://github.com/frappe/pypika@2c50e6142b2d61d2d243e466fdd5dc03b3d918f2",
|
||||
"mysqlclient==2.2.7",
|
||||
"PyQRCode~=1.2.1",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue