lesli 5.1.13 → 5.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/lesli/application.css +527 -10
  3. data/app/controllers/lesli/application_lesli_controller.rb +27 -0
  4. data/app/controllers/lesli/items/attachments_controller.rb +3 -3
  5. data/app/controllers/lesli/items/discussions_controller.rb +2 -2
  6. data/app/controllers/lesli/items/tasks_controller.rb +2 -2
  7. data/app/controllers/lesli/roles_controller.rb +1 -6
  8. data/app/controllers/lesli/users_controller.rb +1 -5
  9. data/app/helpers/lesli/html_helper.rb +5 -5
  10. data/app/helpers/lesli/navigation_helper.rb +5 -5
  11. data/app/interfaces/lesli/customization_interface.rb +11 -31
  12. data/app/interfaces/lesli/responder_interface.rb +11 -4
  13. data/app/models/concerns/lesli/account_initializer.rb +5 -45
  14. data/app/models/concerns/lesli/user_extensions.rb +4 -2
  15. data/app/models/lesli/items/attachment.rb +3 -3
  16. data/app/models/lesli/role.rb +14 -2
  17. data/app/models/lesli/user.rb +7 -0
  18. data/app/operators/lesli/account_operator.rb +84 -0
  19. data/app/operators/lesli/resource_operator.rb +123 -0
  20. data/app/services/lesli/application_lesli_service.rb +33 -116
  21. data/app/services/lesli/resource_service.rb +12 -159
  22. data/app/services/lesli/role_service.rb +11 -229
  23. data/app/services/lesli/user_service.rb +37 -117
  24. data/app/views/lesli/abouts/welcome.html.erb +4 -4
  25. data/app/views/lesli/apps/show.html.erb +1 -1
  26. data/app/views/lesli/errors/not_found.html.erb +9 -16
  27. data/app/views/lesli/errors/unauthorized.html.erb +19 -28
  28. data/app/views/lesli/layouts/application-devise.html.erb +1 -0
  29. data/app/views/lesli/layouts/application-lesli.html.erb +1 -1
  30. data/app/views/lesli/partials/_application-lesli-announcements.html.erb +18 -0
  31. data/app/views/lesli/partials/_application-lesli-assets.html.erb +16 -19
  32. data/app/views/lesli/partials/_application-lesli-header.html.erb +45 -100
  33. data/app/views/lesli/partials/_application-lesli-notifications.html.erb +2 -27
  34. data/app/views/lesli/partials/_application-lesli-turbo.html.erb +5 -0
  35. data/app/views/lesli/shared/dashboards/edit.html.erb +1 -1
  36. data/app/views/lesli/shared/dashboards/show.html.erb +1 -1
  37. data/config/initializers/lesli.rb +7 -2
  38. data/config/locales/translations.en.yml +56 -48
  39. data/config/locales/translations.es.yml +54 -45
  40. data/db/migrate/v1/0000000210_create_lesli_users.rb +1 -0
  41. data/db/seed/xyz.rb +1 -3
  42. data/lib/generators/lesli/base_generator.rb +41 -3
  43. data/lib/generators/lesli/controller/controller_generator.rb +1 -1
  44. data/lib/generators/lesli/controller/templates/controller.rb.tt +12 -7
  45. data/lib/generators/lesli/model/model_generator.rb +1 -1
  46. data/lib/generators/lesli/resource/resource_generator.rb +290 -0
  47. data/lib/generators/lesli/resource/templates/controller.rb.tt +99 -0
  48. data/lib/generators/lesli/resource/templates/locale.en.yml.tt +13 -0
  49. data/lib/generators/lesli/resource/templates/migration.rb.tt +28 -0
  50. data/lib/generators/lesli/resource/templates/model.rb.tt +38 -0
  51. data/lib/generators/lesli/resource/templates/operator.rb.tt +15 -0
  52. data/lib/generators/lesli/resource/templates/service.rb.tt +52 -0
  53. data/lib/generators/lesli/resource/templates/tests/controller_test.rb.tt +14 -0
  54. data/lib/generators/lesli/resource/templates/tests/model_test.rb.tt +24 -0
  55. data/lib/generators/lesli/resource/templates/tests/operator_test.rb.tt +15 -0
  56. data/lib/generators/lesli/resource/templates/tests/service_test.rb.tt +17 -0
  57. data/lib/generators/lesli/resource/templates/views/_form.html.erb.tt +17 -0
  58. data/lib/generators/lesli/resource/templates/views/edit.html.erb.tt +4 -0
  59. data/lib/generators/lesli/resource/templates/views/index.html.erb.tt +22 -0
  60. data/lib/generators/lesli/resource/templates/views/new.html.erb.tt +4 -0
  61. data/lib/generators/lesli/resource/templates/views/show.html.erb.tt +17 -0
  62. data/lib/generators/lesli/scaffold/scaffold_generator.rb +4 -39
  63. data/lib/generators/lesli/service/service_generator.rb +1 -1
  64. data/lib/generators/lesli/service/templates/service.rb.tt +15 -7
  65. data/lib/generators/lesli/views/views_generator.rb +1 -1
  66. data/lib/generators/lesli_generator.rb +11 -0
  67. data/lib/lesli/courier.rb +66 -34
  68. data/lib/lesli/database_tasks.rb +145 -0
  69. data/lib/lesli/version.rb +2 -2
  70. data/lib/tasks/lesli/db.rake +16 -93
  71. data/lib/tasks/lesli/resources.rake +1 -1
  72. data/readme.md +3 -1
  73. metadata +23 -4
  74. data/app/views/lesli/partials/_application-lesli-footer.html.erb +0 -82
  75. data/app/views/lesli/partials/_application-lesli-sidebar.html.erb +0 -50
@@ -32,138 +32,58 @@ Building a better future, one line of code at a time.
32
32
 
33
33
  module Lesli
34
34
  class UserService < Lesli::ApplicationLesliService
35
-
36
- def find id
35
+ def find(id)
37
36
  super(current_user.account.users.find_by(id: id))
38
37
  end
39
38
 
40
-
41
- # Return a list of users that belongs to the account of the current_user
42
- # this list is meant to be used in selectors, autocomplets, etc
43
- def list params=nil
44
- users = current_user.account.users
45
-
46
- if params[:role].present?
47
- # add simple quotes to the roles so the sql can manage the query
48
- roles = params[:role].split(",").map { |role| "'#{role}'" }.join(", ")
49
- # users = users.joins("
50
- # inner join (
51
- # select
52
- # ur.users_id, string_agg(r.\"name\", ', ') role_names
53
- # from user_roles ur
54
- # join roles r
55
- # on r.id = ur.role_id
56
- # and r.name in ( #{ roles } )
57
- # where ur.deleted_at is null
58
- # group by ur.users_id
59
- # ) roles on roles.users_id = users.id
60
- # ")
61
-
62
- users = users.joins("
63
- inner join (
64
- select
65
- ur.users_id, string_agg(r.\"name\", ', ') role_names
66
- from user_roles ur
67
- join roles r
68
- on r.id = ur.role_id
69
- and r.name in (:roles)
70
- where ur.deleted_at is null
71
- group by ur.users_id
72
- ) roles on roles.users_id = users.id
73
- ")
74
- .where('r.name IN (:roles)', roles: roles)
75
-
39
+ # Return only the identifier and display name needed by selectors.
40
+ # This read is account-scoped and intentionally not paginated.
41
+ def list(role: nil)
42
+ users = current_user.account.users.order(:first_name, :last_name, :id)
43
+ if role.present?
44
+ users = if defined?(LesliShield)
45
+ users.joins(:roles).where(lesli_roles: { name: role.split(",").map(&:strip) }).distinct
46
+ else
47
+ users.none
48
+ end
76
49
  end
77
50
 
78
- users.order(name: :asc).select(
79
- :id,
80
- :email,
81
- "CONCAT_WS(' ', first_name, last_name) as name",
82
- "COALESCE(NULLIF(alias,''), email) as alias"
83
- ).as_json
51
+ users.select(:id, :first_name, :last_name, :email).map do |user|
52
+ { "id" => user.id, "name" => user.full_name }
53
+ end
84
54
  end
85
55
 
86
- # @return [Array] Paginated index of users.
87
- # @description Return a paginated array of users, used mostly in frontend views
88
- # TODO: Implement pg_search
89
- def index params
90
-
91
- # Build user full name
92
- fullname_sql = "TRIM(CONCAT(lesli_users.first_name, ' ', lesli_users.last_name))"
93
-
94
- # Build user status
95
- status_sql = "case when lesli_users.active is true then 'active' else 'inactive' end"
96
-
97
- # Get all the roles assigned to the user
98
- roles_subquery = <<-SQL
99
- LEFT JOIN (
100
- SELECT ur.user_id, string_agg(r.name, ', ' ORDER BY r.name) as rolenames
101
- FROM lesli_shield_user_roles ur
102
- JOIN lesli_roles r ON r.id = ur.role_id
103
- WHERE ur.deleted_at IS NULL
104
- GROUP BY ur.user_id
105
- ) roles ON roles.user_id = lesli_users.id
106
- SQL
107
-
108
- current_user.account.users
109
- .joins(roles_subquery)
110
- .select(
111
- :id,
112
- :email,
113
- :active,
114
- "#{status_sql} AS status",
115
- "#{fullname_sql} AS fullname",
116
- "COALESCE(roles.rolenames, '') AS rolenames",
56
+ def index
57
+ users = current_user.account.users.order(:first_name, :last_name, :id)
58
+ users = users.select(
59
+ "lesli_users.*",
60
+ "TRIM(CONCAT(COALESCE(first_name, ''), ' ', COALESCE(last_name, ''))) AS fullname",
61
+ "CASE WHEN active THEN 'active' ELSE 'inactive' END AS status",
62
+ "'' AS rolenames",
117
63
  Date2.new.date_time.db_column("current_sign_in_at")
118
- )
119
- .page(query.dig(:pagination, :page))
120
- .per(query.dig(:pagination, :perPage))
64
+ ).page(query.dig(:pagination, :page)).per(query.dig(:pagination, :perPage))
65
+
66
+ # Preload role names instead of using database-specific string aggregation.
67
+ if defined?(LesliShield)
68
+ users = users.preload(:roles)
69
+ users.each { |user| user[:rolenames] = user.roles.map(&:name).join(", ") }
70
+ end
71
+
72
+ users
121
73
  end
122
74
 
123
- # Creates a query that selects all user information from several tables if CloudLock is present
124
75
  def show
125
76
  resource
126
77
  end
127
78
 
128
- def update params
129
-
130
- # old_attributes = resource.detail.attributes.merge({
131
- # active: resource.active
132
- # })
133
-
134
- if resource.update(params)
135
-
136
- # Set the user alias based on the full_name.
137
- if resource.alias.empty?
138
- resource.update(alias: resource.full_name_initials())
139
- end
140
-
141
- # new_attributes = resource.detail.attributes.merge({
142
- # active: resource.active
143
- # })
144
- #resource.log_activity_update(current_user, resource, old_attributes, new_attributes)
145
- else
146
- self.error(resource.errors.full_messages.to_sentence)
147
- end
148
-
149
- self
150
- end
151
-
152
- def sessions
153
- resource.sessions
154
- end
79
+ def update(attributes)
80
+ attributes = attributes.to_h.symbolize_keys
81
+ attributes[:time_zone] = attributes[:time_zone].presence if attributes.key?(:time_zone)
82
+ resource.assign_attributes(attributes)
83
+ resource.alias = resource.full_name_initials if resource.alias.blank?
155
84
 
156
- def roles
157
- resource.roles
85
+ error(resource.errors.full_messages.to_sentence) unless resource.save
86
+ response(resource)
158
87
  end
159
-
160
- def logs
161
- return [] unless defined?(LesliAudit)
162
- resource.logs
163
- .order(id: :desc)
164
- .select(:id, :operation, :description, Date2.new.db_column('created_at', as:'date'))
165
- .limit(7)
166
- .as_json
167
- end
168
88
  end
169
89
  end
@@ -1,10 +1,10 @@
1
1
  <% content_for :head do %>
2
2
  <style>
3
3
  :root {
4
- --welcome-primary: var(--lesli-color-primary-500, #276AD6);
5
- --welcome-primary-light: var(--lesli-color-primary-400, #4C83EA);
6
- --welcome-primary-dark: var(--lesli-color-primary-900, #0C2856);
7
- --welcome-primary-soft: var(--lesli-color-primary-100, #E3EEFF);
4
+ --welcome-primary: var(--lesli-color-primary, var(--lesli-color-primary-700, #194A99));
5
+ --welcome-primary-light: color-mix(in srgb, var(--welcome-primary) 75%, white);
6
+ --welcome-primary-dark: var(--lesli-color-primary-strong, color-mix(in srgb, var(--welcome-primary) 80%, black));
7
+ --welcome-primary-soft: var(--lesli-color-primary-soft, color-mix(in srgb, var(--welcome-primary) 8%, white));
8
8
  --welcome-ink: var(--lesli-color-neutral-900, #1F2933);
9
9
  --welcome-muted: var(--lesli-color-neutral-600, #4B5663);
10
10
  --welcome-border: var(--lesli-color-neutral-200, #E5EAF0);
@@ -25,7 +25,7 @@ document.addEventListener('turbo:load', window.lesliFilterNavigationEngines)
25
25
  </script>
26
26
 
27
27
  <%= render(LesliView::Layout::Container.new("lesli-apps", dashboard: false)) do %>
28
- <%= render("lesli_dashboard/dashboards/shared/header") if defined?(LesliDashboard) %>
28
+ <%= render("lesli_dashboard/shared/header") if defined?(LesliDashboard) %>
29
29
  <section class="lesli-engines py-6 sm:py-8">
30
30
  <div class="grid grid-cols-1 gap-5 sm:grid-cols-2 sm:gap-6 lg:grid-cols-4">
31
31
  <%= navigation_engines %>
@@ -1,18 +1,11 @@
1
1
  <%= render(LesliView::Layout::Container.new("accounts")) do %>
2
- <section class="px-4 py-24 sm:px-6 sm:py-36" aria-labelledby="not-found-title">
3
- <div class="mx-auto max-w-2xl text-center">
4
-
5
- <div class="mb-6" aria-hidden="true">
6
- <%= render(LesliView::Elements::Empty.new(text:nil)) %>
7
- </div>
8
-
9
- <h2 id="not-found-title" class="mb-4 text-[2rem] font-semibold leading-tight text-[#3d211b]">
10
- 404 <%= I18n.t("lesli.shared.message_error_not_found") %>
11
- </h2>
12
-
13
- <p class="text-[1.4rem] font-light leading-relaxed text-neutral-700">
14
- <%= @message %>
15
- </p>
16
- </div>
17
- </section>
2
+ <%= render LesliView::Partials::Error.new(
3
+ id: "not-found",
4
+ title: "404 #{I18n.t('lesli.shared.message_error_not_found')}",
5
+ message: @message
6
+ ) do |error| %>
7
+ <% error.with_illustration do %>
8
+ <%= render LesliView::Elements::Empty.new(text: nil) %>
9
+ <% end %>
10
+ <% end %>
18
11
  <% end %>
@@ -1,30 +1,21 @@
1
1
  <%= render(LesliView::Layout::Container.new("accounts")) do %>
2
- <section class="px-4 py-24 sm:px-6 sm:py-36" aria-labelledby="unauthorized-title">
3
- <div class="mx-auto max-w-2xl text-center">
4
-
5
- <div class="mb-6" aria-hidden="true">
6
- <span class="material-symbols !text-[8rem] leading-none text-danger-800">
7
- shield_lock
8
- </span>
9
- </div>
10
-
11
- <h2 id="unauthorized-title" class="mb-4 text-[2rem] font-semibold leading-tight text-danger-800">
12
- 403 <%= I18n.t("lesli.shared.message_error_unauthorized") %>
13
- </h2>
14
-
15
- <p class="text-[1.4rem] font-light leading-relaxed text-neutral-700">
16
- <%= I18n.t("lesli.shared.message_error_unauthorized_credentials") %>
17
- </p>
18
-
19
- <div class="mx-auto mt-6 max-w-xl rounded-lg border border-neutral-200 bg-white p-5 text-sm text-neutral-600 shadow-sm">
20
- <ul class="space-y-1">
21
- <li>
22
- <%= @error_object.dig(:error_details, :controller) %>
23
- (<%= @error_object.dig(:error_details, :action) %>)
24
- </li>
25
- <li><%= @error_object[:error_role] %></li>
26
- </ul>
27
- </div>
28
- </div>
29
- </section>
2
+ <%= render LesliView::Partials::Error.new(
3
+ id: "unauthorized",
4
+ title: "403 #{I18n.t('lesli.shared.message_error_unauthorized')}",
5
+ message: I18n.t("lesli.shared.message_error_unauthorized_credentials"),
6
+ tone: :danger
7
+ ) do |error| %>
8
+ <% error.with_illustration do %>
9
+ <span class="material-symbols lesli-error-icon">shield_lock</span>
10
+ <% end %>
11
+ <% error.with_details do %>
12
+ <ul>
13
+ <li>
14
+ <%= @error_object.dig(:error_details, :controller) %>
15
+ (<%= @error_object.dig(:error_details, :action) %>)
16
+ </li>
17
+ <li><%= @error_object[:error_role] %></li>
18
+ </ul>
19
+ <% end %>
20
+ <% end %>
30
21
  <% end %>
@@ -38,6 +38,7 @@ Building a better future, one line of code at a time.
38
38
  <%= render(partial: "lesli/partials/application-lesli-head") %>
39
39
  <%= yield :head %>
40
40
  <%= stylesheet_link_tag(lesli_asset_path(:lesli_assets, "public"), media: "all") %>
41
+ <%= stylesheet_link_tag(lesli_asset_path(:lesli_view, "view"), media: "all") %>
41
42
  <%= stylesheet_link_tag(lesli_asset_path(:lesli_shield, public_app_controller), media: "all") %>
42
43
  <%# Prevent browser history from reopening an authenticated page after logout. %>
43
44
  <% if flash[:logout] == true %>
@@ -45,8 +45,8 @@ Building a better future, one line of code at a time.
45
45
  <body class="<%= lesli_application_body_class() %>">
46
46
  <%= render(partial: "lesli/partials/application-lesli-header") %>
47
47
  <%= render(partial: "lesli/partials/application-lesli-notifications") %>
48
+ <%= render(partial: "lesli/partials/application-lesli-announcements") %>
48
49
  <main class="flex mb-10">
49
- <%= render(partial: "lesli/partials/application-lesli-sidebar") %>
50
50
  <%= render(partial: "lesli/partials/application-lesli-content") %>
51
51
  </main>
52
52
  <div id="lesli-icons" data-turbo-permanent>
@@ -0,0 +1,18 @@
1
+ <%
2
+ announcements = Array(@lesli_announcements).map do |announcement|
3
+ {
4
+ id: announcement.id,
5
+ category: announcement.category,
6
+ category_label: t("lesli.announcements.categories_#{announcement.category}", default: t("lesli.announcements.categories_info")),
7
+ message: announcement.message,
8
+ url: announcement.url,
9
+ dismiss_url: announcement.can_be_closed? ? lesli_bell.dismiss_announcement_path(announcement) : nil
10
+ }
11
+ end
12
+ %>
13
+ <%= render LesliView::Partials::Announcements.new(
14
+ announcements: announcements,
15
+ label: t("lesli.announcements.title"),
16
+ link_label: t("lesli.announcements.open_link"),
17
+ dismiss_label: t("lesli.announcements.dismiss")
18
+ ) %>
@@ -31,30 +31,27 @@ Building a better future, one line of code at a time.
31
31
  %>
32
32
 
33
33
 
34
- <%
35
- # Defining color customization
36
- # colors will be override with the ones defined in the database if custom colors exists
37
- # if there is no custom colors defined, the var() function will return the lesli colors
38
- @colors = @lesli.dig(:customization, :colors) || {}
39
- %>
34
+ <% colors = @lesli.dig(:customization, :colors) || {} %>
40
35
 
41
36
 
42
- <%# Defining color palette from users preferences from the database %>
43
- <style>
44
- :root {
45
- <% @colors.each_pair do |key, value| %>
46
- <%= "--#{ key.to_s.gsub('_','-') }: #{ value.to_s };" if value %>
47
- <% end %>
48
- }
49
- </style>
37
+ <%# Override --lesli-theme-* variables; the shared stylesheet provides defaults. %>
38
+ <% if colors.present? %>
39
+ <style data-turbo-track="dynamic">
40
+ :root {
41
+ <% colors.each_pair do |key, value| %>
42
+ <%= "--#{key.to_s.tr('_', '-')}: #{value};" if value %>
43
+ <% end %>
44
+ }
45
+ </style>
46
+ <% end %>
50
47
 
51
48
 
52
- <%# Loading stylesheets from engines %>
53
- <%= stylesheet_link_tag(lesli_asset_path(:lesli_assets, 'application'), media: "all") %>
54
- <%= stylesheet_link_tag(lesli_asset_path(:lesli_view, 'view'), media: "all") %>
55
- <%= stylesheet_link_tag(lesli_asset_path(), media: "all") %>
49
+ <%# Shared assets reload after a deploy; engine styles leave with their pages. %>
50
+ <%= stylesheet_link_tag(lesli_asset_path(:lesli_assets, 'application'), media: "all", "data-turbo-track": "reload") %>
51
+ <%= stylesheet_link_tag(lesli_asset_path(:lesli_view, 'view'), media: "all", "data-turbo-track": "reload") %>
52
+ <%= stylesheet_link_tag(lesli_asset_path(), media: "all", "data-turbo-track": "dynamic") %>
56
53
 
57
54
 
58
55
  <%# Loading javascripts from engines %>
59
- <%= javascript_include_tag(lesli_asset_path(:lesli_assets, 'application'), :defer => "defer") %>
56
+ <%= javascript_include_tag(lesli_asset_path(:lesli_assets, 'application'), defer: true, "data-turbo-track": "reload") %>
60
57
  <%= yield(:application_lesli_javascript) %>
@@ -33,109 +33,54 @@ Building a better future, one line of code at a time.
33
33
  <%
34
34
  engine_navigation_partial = navigation_partial
35
35
  notifications_count = @lesli&.dig(:notifications).to_i
36
- dashboard_path = application_dashboard_path
37
-
38
- header_action_class = "relative flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-950 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/40"
39
- logout_action_class = "relative flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-slate-500 transition-colors hover:bg-red-50 hover:text-red-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500/30"
40
-
41
- dashboard_label = I18n.t("lesli.header.dashboard", default: "Lesli Dashboard")
42
- notifications_label = if notifications_count.positive?
43
- I18n.t("lesli.header.notifications_unread", count: notifications_count, default: "%{count} unread notifications")
44
- else
45
- I18n.t("lesli.header.notifications", default: "Notifications")
36
+ actions = []
37
+
38
+ if defined?(LesliBell)
39
+ path = lesli_bell.notifications_path
40
+ label = if notifications_count.positive?
41
+ plural = notifications_count == 1 ? "one" : "other"
42
+ t("lesli.header.notifications_unread_#{plural}", count: notifications_count, default: "%{count} unread notifications")
43
+ else
44
+ t("lesli.header.notifications", default: "Notifications")
45
+ end
46
+ actions << {
47
+ url: path, label: label, active: current_page?(path),
48
+ icon: notifications_count.positive? ? "ri-notification-3-fill" : "ri-notification-3-line",
49
+ highlighted: notifications_count.positive?, count: notifications_count,
50
+ data: { turbo_frame: "_top" }
51
+ }
46
52
  end
47
- applications_label = I18n.t("lesli.header.applications", default: "Applications")
48
- profile_label = I18n.t("lesli.header.profile", default: "Profile")
49
- logout_label = I18n.t("lesli.header.logout", default: "Logout")
50
53
 
51
- action_class = ->(path) {
52
- class_names(
53
- header_action_class,
54
- current_page?(path) && "bg-sky-50 text-sky-700"
55
- )
54
+ actions << {
55
+ url: lesli.apps_path, label: t("lesli.header.applications", default: "Applications"),
56
+ icon: "ri-apps-2-line", active: current_page?(lesli.apps_path),
57
+ data: { turbo_frame: "_top" }
56
58
  }
57
- %>
58
-
59
- <header class="border-b border-slate-200/80 bg-white">
60
- <div class="mx-auto flex h-20 max-w-7xl items-center justify-between px-4 sm:px-6 lg:px-8">
61
-
62
- <!-- Logo -->
63
- <%= link_to dashboard_path,
64
- class: "flex items-center",
65
- aria: { label: dashboard_label },
66
- data: { turbo_frame: "_top" } do %>
67
59
 
68
- <div class="flex items-center [&_img]:h-12 [&_img]:w-auto">
69
- <%= customization_instance_logo_tag(
70
- logo: "app-logo",
71
- options: { alt: "Lesli app logo" }
72
- ) %>
73
- </div>
60
+ if defined?(LesliShield)
61
+ actions << {
62
+ url: lesli_shield.profile_path, label: t("lesli.header.profile", default: "Profile"),
63
+ icon: "ri-user-smile-line", data: { turbo_frame: "_top" }
64
+ }
65
+ actions << {
66
+ url: main_app.destroy_user_session_path, label: t("lesli.header.logout", default: "Logout"),
67
+ icon: "ri-logout-circle-r-line"
68
+ }
69
+ end
70
+ %>
71
+ <%= render LesliView::Partials::Header.new(
72
+ home_url: application_dashboard_path,
73
+ home_label: t("lesli.header.dashboard", default: "Lesli Dashboard"),
74
+ actions: actions,
75
+ actions_label: t("lesli.header.actions", default: "Application actions"),
76
+ navigation_label: t("lesli.header.navigation", default: "Module navigation")
77
+ ) do |header| %>
78
+ <% header.with_logo do %>
79
+ <%= customization_instance_logo_tag(logo: "app-logo", options: { alt: "Lesli app logo" }) %>
80
+ <% end %>
81
+ <% if engine_navigation_partial %>
82
+ <% header.with_navigation do %>
83
+ <%= render(engine_navigation_partial) %>
74
84
  <% end %>
75
-
76
- <%# Application actions %>
77
- <nav class="flex items-center gap-2" aria-label="Application actions">
78
-
79
- <% if defined?(LesliBell) %>
80
- <%= link_to lesli_bell.notifications_path,
81
- class: action_class.call(lesli_bell.notifications_path),
82
- aria: {
83
- label: notifications_label,
84
- current: current_page?(lesli_bell.notifications_path) ? "page" : nil
85
- },
86
- title: notifications_label,
87
- data: { turbo_frame: "_top" } do %>
88
-
89
- <i class="<%= notifications_count.positive? ? 'ri-notification-3-fill text-sky-600' : 'ri-notification-3-line' %> text-[24px] leading-none" aria-hidden="true"></i>
90
-
91
- <% if notifications_count.positive? %>
92
- <span class="absolute -right-0 -top-0 flex min-h-4 min-w-4 items-center justify-center rounded-full bg-sky-600 px-1 text-[9px] font-semibold leading-none text-white ring-2 ring-white" aria-hidden="true">
93
- <%= notifications_count > 99 ? "99+" : notifications_count %>
94
- </span>
95
- <% end %>
96
- <% end %>
97
- <% end %>
98
-
99
- <%= link_to lesli.apps_path,
100
- class: action_class.call(lesli.apps_path),
101
- aria: {
102
- label: applications_label,
103
- current: current_page?(lesli.apps_path) ? "page" : nil
104
- },
105
- title: applications_label,
106
- data: { turbo_frame: "_top" } do %>
107
- <i class="ri-apps-2-line text-[24px] leading-none" aria-hidden="true"></i>
108
- <% end %>
109
-
110
- <% if defined?(LesliShield) %>
111
-
112
- <%= link_to lesli_shield.profile_path,
113
- class: header_action_class,
114
- aria: { label: profile_label },
115
- title: profile_label,
116
- data: { turbo_frame: "_top" } do %>
117
- <i class="ri-user-smile-line text-[24px] leading-none" aria-hidden="true"></i>
118
- <% end %>
119
-
120
- <%= link_to main_app.destroy_user_session_path,
121
- class: logout_action_class,
122
- aria: { label: logout_label },
123
- title: logout_label do %>
124
- <i class="ri-logout-circle-r-line text-[24px] leading-none" aria-hidden="true"></i>
125
- <% end %>
126
- <% end %>
127
-
128
- </nav>
129
- </div>
130
- </header>
131
-
132
- <%# Build the engine navigation %>
133
- <% if engine_navigation_partial %>
134
- <nav class="border-b border-slate-200/80 bg-white" aria-label="Module navigation">
135
- <div class="mx-auto max-w-7xl overflow-x-auto px-4 sm:px-6 lg:px-8">
136
- <ul class="flex min-h-14 w-max min-w-full items-center justify-start gap-1 py-2 sm:justify-center">
137
- <%= render(engine_navigation_partial) %>
138
- </ul>
139
- </div>
140
- </nav>
85
+ <% end %>
141
86
  <% end %>
@@ -32,30 +32,5 @@ Building a better future, one line of code at a time.
32
32
  =end
33
33
  %>
34
34
 
35
- <%
36
- notification_classes = {
37
- "info" => "border-info-300 bg-info-50 text-info-900",
38
- "notice" => "border-success-300 bg-success-50 text-success-900",
39
- "success" => "border-success-300 bg-success-50 text-success-900",
40
- "warning" => "border-warning-300 bg-warning-50 text-warning-900",
41
- "alert" => "border-danger-300 bg-danger-50 text-danger-900",
42
- "danger" => "border-danger-300 bg-danger-50 text-danger-900",
43
- "error" => "border-danger-300 bg-danger-50 text-danger-900",
44
- "default" => "border-neutral-300 bg-neutral-50 text-neutral-900"
45
- }.freeze
46
- %>
47
-
48
- <section
49
- id="application-lesli-notifications"
50
- class="fixed inset-x-0 z-[999] mx-auto w-[90%] max-w-[600px]"
51
- aria-live="polite"
52
- aria-atomic="true">
53
- <% if flash.any? %>
54
- <% flash.each do |type, message| %>
55
- <div class="animate-lesli-notification my-1 break-words rounded-lg border-2 px-4 py-3 text-center text-sm font-medium shadow-sm <%= notification_classes.fetch(type.to_s, notification_classes["default"]) %>">
56
- <%= message %>
57
- </div>
58
- <% end %>
59
- <% flash.discard %>
60
- <% end %>
61
- </section>
35
+ <%= render LesliView::Partials::Notifications.new(messages: flash.to_hash) %>
36
+ <% flash.discard if flash.any? %>
@@ -38,4 +38,9 @@ Building a better future, one line of code at a time.
38
38
 
39
39
  <%# enable turbo %>
40
40
  <meta name="turbo-prefetch" content="false">
41
+ <%# Reload page-specific banners on history navigation instead of restoring
42
+ announcements that another request may have dismissed or expired. %>
43
+ <% if @lesli_announcements_enabled %>
44
+ <meta name="turbo-cache-control" content="no-cache">
45
+ <% end %>
41
46
  <meta name="view-transition" content="same-origin" />
@@ -30,4 +30,4 @@ Building a better future, one line of code at a time.
30
30
  // ·
31
31
  %>
32
32
 
33
- <%= render(template: "lesli_dashboard/dashboards/shared/edit") if defined?(LesliDashboard) %>
33
+ <%= render(template: "lesli_dashboard/shared/edit") if defined?(LesliDashboard) %>
@@ -30,4 +30,4 @@ Building a better future, one line of code at a time.
30
30
  // ·
31
31
  %>
32
32
 
33
- <%= render(template: "lesli_dashboard/dashboards/shared/show") if defined?(LesliDashboard) %>
33
+ <%= render(template: "lesli_dashboard/shared/show") if defined?(LesliDashboard) %>
@@ -97,6 +97,7 @@ Lesli.configure do |config|
97
97
  }
98
98
 
99
99
  config.babel = {
100
+ allow_web_deploy: true,
100
101
  locales: {
101
102
  :en => "English", # English
102
103
  :es => "Español", # Español/Spanish
@@ -118,7 +119,11 @@ Lesli.configure do |config|
118
119
  # Shield module configuration
119
120
  config.shield = {
120
121
  path_after_login: defined?(LesliDashboard) ? "/dashboard" : "/",
121
- default_role: "guest"
122
+ default_role: "guest",
123
+
124
+ # Invitations verify ownership of the recipient's email address. The
125
+ # invited user does not exist until the signed link is accepted.
126
+ invitation_expiration: 7.days
122
127
  }
123
128
 
124
129
 
@@ -128,8 +133,8 @@ Lesli.configure do |config|
128
133
  enable_logs: true,
129
134
  enable_journals: true,
130
135
  enable_analytics: true,
131
- journal_retention_days: 90,
132
136
  analytics_retention_days: 400,
137
+ traffic_retention_days: 400,
133
138
  audit_retention_days: nil
134
139
  }
135
140