Gui editable #2
4 changed files with 31 additions and 22 deletions
13
dashboard/fixtures/dashboard_icon.json
Normal file
13
dashboard/fixtures/dashboard_icon.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[
|
||||
{
|
||||
"color": "#449CF0",
|
||||
"docstatus": 0,
|
||||
"doctype": "Dashboard Icon",
|
||||
"icon": "fas fa-th",
|
||||
"label": "OfficeTrax",
|
||||
"modified": "2025-07-18 17:13:30.629925",
|
||||
"name": "eea9orlie0",
|
||||
"roles": "OfficeTrax",
|
||||
"url": "seahaven.core7.net"
|
||||
}
|
||||
]
|
||||
|
|
@ -242,3 +242,4 @@ app_license = "mit"
|
|||
# "Logging DocType Name": 30 # days to retain logs
|
||||
# }
|
||||
|
||||
fixtures = ["Dashboard Icon"]
|
||||
|
|
|
|||
|
|
@ -1,26 +1,12 @@
|
|||
<div class="portal-wrapper">
|
||||
<h1>Sea Haven Portal</h1>
|
||||
<div class="grid">
|
||||
{% if "Accounts User" in roles %}
|
||||
<a href="https://accounting.getmynewsite.com" class="app-link">
|
||||
<i class="fas fa-file-invoice-dollar"></i>
|
||||
<div class="app-label">Accounting</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if "Wiki Editor" in roles %}
|
||||
<a href="https://wiki.getmynewsite.com" class="app-link">
|
||||
<i class="fas fa-book"></i>
|
||||
<div class="app-label">Wiki</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if "OfficeTrax" in roles %}
|
||||
<a href="https://seahaven.core7.net" class="app-link">
|
||||
<i class="fas fa-th"></i>
|
||||
<div class="app-label">OfficeTrax</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% for icon in icons %}
|
||||
<a href="{{ icon.url }}" class="app-link">
|
||||
<i class="fas {{ icon.icon }}"></i>
|
||||
<div class="app-label">{{ icon.label }}</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -68,4 +54,4 @@
|
|||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
|
||||
|
|
|
|||
|
|
@ -2,5 +2,14 @@ import frappe
|
|||
|
||||
def get_context(context):
|
||||
user = frappe.session.user
|
||||
context.roles = frappe.get_roles(user)
|
||||
user_roles = frappe.get_roles(user)
|
||||
|
||||
icons = frappe.get_all("Dashboard Icon", fields=["label", "icon", "url", "role"])
|
||||
visible_icons = []
|
||||
|
||||
for icon in icons:
|
||||
if not icon.role or icon.role in user_roles:
|
||||
visible_icons.append(icon)
|
||||
|
||||
context.icons = visible_icons
|
||||
return context
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue