fix(minor): only select public workspaces by default

This commit is contained in:
Rushabh Mehta 2024-09-23 16:53:31 +05:30
parent 4da1f70eaf
commit 70c98abc84
10 changed files with 1562 additions and 1592 deletions

View file

@ -1,38 +0,0 @@
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 = $(`
<div style="position: relative;">
<div class="pr-3">
${message} <br><a href="${link}" target="_blank" style="color: var(--primary-color)">${cta} &rarr; </a>
</div>
<div style="position: absolute; top: -1px; right: -4px; cursor: pointer;" title="Dismiss"
onclick="localStorage.setItem('${key}', 'false') || this.parentElement.remove()">
<svg class="icon icon-sm" style="">
<use class="" href="#icon-close"></use>
</svg>
</div>
</div>
`).appendTo(listview.page.sidebar);
} catch (error) {
console.error(error);
}
}

View file

@ -260,13 +260,16 @@ class FormMeta(Meta):
self.set("__dashboard", self.get_dashboard_data())
def load_workspaces(self):
# find workspaces from shortcut
Shortcut = frappe.qb.DocType("Workspace Shortcut")
Workspace = frappe.qb.DocType("Workspace")
shortcut = (
frappe.qb.from_(Shortcut)
.select(Shortcut.parent)
.inner_join(Workspace)
.on(Workspace.name == Shortcut.parent)
.where(Shortcut.link_to == self.name)
.where(Shortcut.type == "DocType")
.where(Workspace.public == 1)
.run()
)
if shortcut:
@ -276,8 +279,11 @@ class FormMeta(Meta):
link = (
frappe.qb.from_(Link)
.select(Link.parent)
.inner_join(Workspace)
.on(Workspace.name == Link.parent)
.where(Link.link_type == "DocType")
.where(Link.link_to == self.name)
.where(Workspace.public == 1)
.run()
)

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 743 KiB

After

Width:  |  Height:  |  Size: 757 KiB

View file

@ -374,6 +374,10 @@ Tip: use lucide.svg in /icons for all downloaded icons
<path stroke-linejoin="round" stroke-linecap="round" stroke-miterlimit="10" d="M19.272 10.364h4.364v4.364"></path>
</symbol>
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-notebook-text">
<path d="M2 6h4" /> <path d="M2 10h4" /> <path d="M2 14h4" /> <path d="M2 18h4" /> <rect width="16" height="20" x="4" y="2" rx="2" /> <path d="M9.5 8h5" /> <path d="M9.5 12H16" /> <path d="M9.5 16H14" />
</symbol>
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="icon-crop">
<path d="M14.88,11.63H4.33V1.12m7.34,10.51v3.25M6,4.37h5.64V10M1.13,4.37h3.2" stroke-linecap="round" stroke-linejoin="round"/>
</symbol>

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 87 KiB

View file

@ -474,9 +474,6 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
[__(this.doctype)],
"Create a new document from list view"
);
let empty_state_image =
this.settings.empty_state_image ||
"/assets/frappe/images/ui-states/list-empty-state.svg";
const new_button = this.can_create
? `<p><button class="btn btn-default btn-sm btn-new-doc hidden-xs">
@ -487,8 +484,10 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
: "";
return `<div class="msg-box no-border">
<div>
<img src="${empty_state_image}" alt="Generic Empty State" class="null-state">
<div class="mb-4">
<svg class="icon icon-xl" style="stroke: var(--text-light);">
<use href="#icon-small-file"></use>
</svg>
</div>
<p>${no_result_message}</p>
${new_button}

View file

@ -197,11 +197,11 @@ frappe.views.DashboardView = class DashboardView extends frappe.views.ListView {
${__("Customize")}
</button></p>`;
const empty_state_image = "/assets/frappe/images/ui-states/list-empty-state.svg";
const empty_state_html = `<div class="msg-box no-border empty-dashboard">
<div>
<img src="${empty_state_image}" alt="Generic Empty State" class="null-state">
<svg class="icon icon-xl" style="stroke: var(--text-light);">
<use href="#icon-small-file"></use>
</svg>
</div>
${no_result_message_html}
${customize_button}

View file

@ -103,9 +103,9 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
get_no_result_message() {
return `<div class="msg-box no-border">
<div>
<img src="/assets/frappe/images/ui-states/list-empty-state.svg" alt="Generic Empty State" class="null-state">
</div>
<svg class="icon icon-xl mb-4" style="stroke: var(--text-light);">
<use href="#icon-table"></use>
</svg>
<p>${__("Nothing to show")}</p>
</div>`;
}
@ -1015,9 +1015,9 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
show_loading_screen() {
const loading_state = `<div class="msg-box no-border">
<div>
<img src="/assets/frappe/images/ui-states/list-empty-state.svg" alt="Generic Empty State" class="null-state">
</div>
<svg class="icon icon-xl mb-4" style="stroke: var(--text-light);">
<use href="#icon-table"></use>
</svg>
<p>${__("Loading")}...</p>
</div>`;

View file

@ -233,12 +233,9 @@ export default class WebFormList {
let empty_state = $(`
<div class="no-result text-muted flex justify-center align-center">
<div class="text-center">
<div>
<img
src="/assets/frappe/images/ui-states/list-empty-state.svg"
alt="Generic Empty State"
class="null-state">
</div>
<svg class="mb-4 icon icon-xl" style="stroke: var(--text-light);">
<use href="#icon-small-file"></use>
</svg>
<p class="small mb-2">${__("No {0} found", [__(this.doctype)])}</p>
${new_button}
</div>

View file

@ -72,8 +72,8 @@ use.like-icon {
}
.icon-xl {
width: 75px;
height: 75px;
width: 40px;
height: 40px;
}
.no-stroke {

View file

@ -3,7 +3,9 @@
{% endif %}
{% if not result -%}
<div class="empty-apps-state">
<img class="empty-list-icon" src="/assets/frappe/images/ui-states/list-empty-state.svg"/>
<svg class="icon icon-xl" style="stroke: var(--text-light);">
<use href="#icon-small-file"></use>
</svg>
<div class="mt-4">{{ no_result_message or _("Nothing to show") }}</div>
</div>
{% else %}