feat: Persistent Announcement Widget and Color Customization (#36768)
Co-authored-by: Michael Weißer <michael.weisser@rindenmuehle.de> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Suraj Shetty <surajshetty3416@gmail.com>
This commit is contained in:
parent
fcc672315f
commit
b110c0b8fd
4 changed files with 26 additions and 7 deletions
|
|
@ -11,7 +11,9 @@
|
|||
"settings_dropdown",
|
||||
"help_dropdown",
|
||||
"announcements_section",
|
||||
"announcement_widget"
|
||||
"announcement_widget",
|
||||
"announcement_widget_color",
|
||||
"dismissible_announcement_widget"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
|
|
@ -47,16 +49,27 @@
|
|||
"label": "Announcements"
|
||||
},
|
||||
{
|
||||
"description": "These announcements will appear inside a dismissible alert below the Navbar.",
|
||||
"description": "These announcements will appear inside an alert below the Navbar.",
|
||||
"fieldname": "announcement_widget",
|
||||
"fieldtype": "Text Editor",
|
||||
"label": "Announcement Widget",
|
||||
"max_height": "10em"
|
||||
},
|
||||
{
|
||||
"fieldname": "announcement_widget_color",
|
||||
"fieldtype": "Color",
|
||||
"label": "Widget Color"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "dismissible_announcement_widget",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Dismissible"
|
||||
}
|
||||
],
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2024-05-01 14:09:54.587137",
|
||||
"modified": "2026-02-05 15:19:55.524034",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Navbar Settings",
|
||||
|
|
@ -74,8 +87,9 @@
|
|||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": [],
|
||||
"track_changes": 1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ class NavbarSettings(Document):
|
|||
from frappe.types import DF
|
||||
|
||||
announcement_widget: DF.TextEditor | None
|
||||
announcement_widget_color: DF.Color | None
|
||||
app_logo: DF.AttachImage | None
|
||||
dismissible_announcement_widget: DF.Check
|
||||
help_dropdown: DF.Table[NavbarItem]
|
||||
settings_dropdown: DF.Table[NavbarItem]
|
||||
# end: auto-generated types
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
<div class="sticky-top">
|
||||
{% if !localStorage.getItem("dismissed_announcement_widget") && strip_html(navbar_settings.announcement_widget) != '' %}
|
||||
<div class="announcement-widget form-message p-2 m-0" style="position: relative; z-index: -1; border-radius: 0; background-color: var(--bg-blue);">
|
||||
{% if (!navbar_settings.dismissible_announcement_widget || !localStorage.getItem("dismissed_announcement_widget")) && strip_html(navbar_settings.announcement_widget) != '' %}
|
||||
<div class="announcement-widget form-message p-2 m-0" style="position: relative; z-index: -1; border-radius: 0; background-color: {{ navbar_settings.announcement_widget_color || 'var(--bg-blue)' }};">
|
||||
<div class="container flex justify-between align-center mx-auto">
|
||||
{{ navbar_settings.announcement_widget }}
|
||||
{% if navbar_settings.dismissible_announcement_widget %}
|
||||
<div class="close-message p-0 mr-2" style="position: relative;">
|
||||
{{ frappe.utils.icon("close") }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ frappe.ui.toolbar.Toolbar = class {
|
|||
if (
|
||||
frappe.boot.read_only ||
|
||||
frappe.boot.user.impersonated_by ||
|
||||
(!localStorage.getItem("dismissed_announcement_widget") &&
|
||||
((!localStorage.getItem("dismissed_announcement_widget") ||
|
||||
!frappe.boot.navbar_settings.dismissible_announcement_widget) &&
|
||||
strip_html(frappe.boot.navbar_settings.announcement_widget) != "") ||
|
||||
frappe.is_mobile()
|
||||
) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue