From ee74830460a13e1042a9f587de423d61b0b3594b Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 26 Jun 2023 17:32:02 +0530 Subject: [PATCH] chore: add github star CTA on server script sidebar [skip ci] --- .../server_script/server_script_list.js | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 frappe/core/doctype/server_script/server_script_list.js diff --git a/frappe/core/doctype/server_script/server_script_list.js b/frappe/core/doctype/server_script/server_script_list.js new file mode 100644 index 0000000000..0df447a0eb --- /dev/null +++ b/frappe/core/doctype/server_script/server_script_list.js @@ -0,0 +1,38 @@ +frappe.listview_settings["Server Script"] = { + onload: function (listview) { + add_github_star_cta(listview); + }, +}; + +function add_github_star_cta(listview) { + try { + const key = "show_github_star_banner"; + if (localStorage.getItem(key) == "false") { + return; + } + + if (listview.github_star_banner) { + listview.github_star_banner.remove(); + } + + const message = "Loving Frappe Framework?"; + const link = "https://github.com/frappe/frappe"; + const cta = "Star us on GitHub"; + + listview.github_star_banner = $(` +
+
+ ${message}
${cta} → +
+
+ + + +
+
+ `).appendTo(listview.page.sidebar); + } catch (error) { + console.error(error); + } +}