lesli_bell 1.1.1 → 1.1.3

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -0
  3. data/app/assets/stylesheets/lesli_bell/application.css +497 -4
  4. data/app/controllers/lesli_bell/announcements_controller.rb +107 -61
  5. data/app/controllers/lesli_bell/notifications_controller.rb +6 -0
  6. data/app/helpers/lesli_bell/announcements_helper.rb +20 -2
  7. data/app/models/lesli_bell/account.rb +4 -1
  8. data/app/models/lesli_bell/announcement/role_recipient.rb +20 -0
  9. data/app/models/lesli_bell/announcement/user.rb +5 -2
  10. data/app/models/lesli_bell/announcement/user_recipient.rb +20 -0
  11. data/app/models/lesli_bell/announcement.rb +97 -2
  12. data/app/services/lesli_bell/announcement_service.rb +111 -64
  13. data/app/services/lesli_bell/notification_service.rb +8 -0
  14. data/app/views/lesli_bell/announcements/_form.html.erb +34 -0
  15. data/app/views/lesli_bell/announcements/edit.html.erb +6 -10
  16. data/app/views/lesli_bell/announcements/index.html.erb +25 -33
  17. data/app/views/lesli_bell/announcements/new.html.erb +6 -9
  18. data/app/views/lesli_bell/announcements/show.html.erb +27 -10
  19. data/app/views/lesli_bell/dashboards/show.html.erb +1 -1
  20. data/app/views/lesli_bell/notifications/index.html.erb +136 -72
  21. data/config/locales/translations.en.yml +72 -1
  22. data/config/locales/translations.es.yml +72 -1
  23. data/config/locales/translations.fr.yml +2 -1
  24. data/config/locales/translations.it.yml +2 -1
  25. data/config/locales/translations.pt.yml +2 -1
  26. data/config/routes.rb +6 -2
  27. data/db/migrate/v1.0/0308100110_create_lesli_bell_notifications.rb +6 -1
  28. data/db/migrate/v1.0/0308110110_create_lesli_bell_announcements.rb +8 -8
  29. data/db/migrate/v1.0/0308110310_create_lesli_bell_announcement_users.rb +3 -3
  30. data/db/migrate/v1.0/0308110410_create_lesli_bell_announcement_recipients.rb +17 -0
  31. data/db/seed/announcements.rb +10 -14
  32. data/db/seed/seeds.json +2 -1
  33. data/lib/lesli_bell/version.rb +2 -2
  34. data/readme.md +3 -2
  35. metadata +10 -5
  36. data/app/assets/config/lesli_bell_manifest.js +0 -40
  37. data/app/assets/stylesheets/lesli_bell/application.tailwind.css +0 -2
@@ -2,7 +2,7 @@
2
2
 
3
3
  Lesli
4
4
 
5
- Copyright (c) 2023, Lesli Technologies, S. A.
5
+ Copyright (c) 2026, Lesli Technologies, S. A.
6
6
 
7
7
  This program is free software: you can redistribute it and/or modify
8
8
  it under the terms of the GNU General Public License as published by
@@ -32,82 +32,146 @@ Building a better future, one line of code at a time.
32
32
 
33
33
  <%= render(LesliView::Layout::Container.new("lesli-bell-notifications-index")) do %>
34
34
 
35
- <%= render(LesliView::Components::Header.new("Notifications")) do %>
36
- <%= render(LesliView::Elements::Button.new("mark all as read", icon:"check", solid: true)) %>
35
+ <%= render(LesliView::Components::Header.new(
36
+ "Notifications",
37
+ "Review important updates and mark them as read when you are done."
38
+ )) do %>
39
+ <span class="inline-flex w-fit items-center gap-2 rounded-full bg-sky-50 px-3 py-1.5 text-sm font-medium text-sky-700 ring-1 ring-inset ring-sky-200">
40
+ <span class="material-symbols text-lg leading-none" aria-hidden="true">notifications</span>
41
+ <%= pluralize(@notifications.dig(:pagination, :total) || @notifications[:records].size, "unread notification") %>
42
+ </span>
43
+ <%= render(LesliView::Elements::Button.new(
44
+ "Mark all as read",
45
+ url: mark_all_as_read_notifications_path,
46
+ icon: "done_all",
47
+ method: :put,
48
+ disabled: @notifications[:records].empty?,
49
+ data: { turbo_submits_with: "Marking all as read..." }
50
+ )) %>
37
51
  <% end %>
38
52
 
39
- <%= render(LesliView::Components::Toolbar.new) %>
40
-
41
53
  <% if @notifications[:records].empty? %>
42
- <%= render(LesliView::Elements::Empty.new) %>
54
+ <div class="overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm">
55
+ <%= render(LesliView::Elements::Empty.new(
56
+ text: "You're all caught up",
57
+ description: "New unread notifications will appear here."
58
+ )) %>
59
+ </div>
43
60
  <% else %>
44
- <section class="space-y-2" aria-label="Notifications">
45
- <% @notifications[:records].each do |notification| %>
46
- <%
47
- notification_classes, close_button_classes = case notification[:category].to_s
48
- when "danger"
49
- [
50
- "border-danger-300 bg-danger-50 text-danger-900",
51
- "text-danger-700 hover:bg-danger-100 focus-visible:ring-danger-500/40"
52
- ]
53
- when "warning"
54
- [
55
- "border-warning-300 bg-warning-50 text-warning-900",
56
- "text-warning-700 hover:bg-warning-100 focus-visible:ring-warning-500/40"
57
- ]
58
- when "success"
59
- [
60
- "border-success-300 bg-success-50 text-success-900",
61
- "text-success-700 hover:bg-success-100 focus-visible:ring-success-500/40"
62
- ]
63
- when "info"
64
- [
65
- "border-info-300 bg-info-50 text-info-900",
66
- "text-info-700 hover:bg-info-100 focus-visible:ring-info-500/40"
67
- ]
68
- else
69
- [
70
- "border-neutral-300 bg-neutral-50 text-neutral-900",
71
- "text-neutral-700 hover:bg-neutral-100 focus-visible:ring-neutral-500/40"
72
- ]
73
- end
74
- %>
75
-
76
- <article class="relative rounded-lg border-2 px-4 py-3 pr-14 shadow-sm <%= notification_classes %>">
77
-
78
- <!-- Close button -->
79
- <%= button_to(
80
- notification_path(notification[:id]),
81
- method: :put,
82
- class: "inline-flex size-8 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 #{close_button_classes}",
83
- form: { class: "absolute right-3 top-3" },
84
- aria: { label: "Mark notification as read" }) do %>
85
- <span class="material-symbols text-xl" aria-hidden="true">close</span>
86
- <% end %>
87
-
88
- <!-- Notification subject -->
89
- <strong class="block text-sm font-semibold"><%= notification[:subject] %></strong>
90
-
91
- <!-- Notification body (optional) -->
92
- <% if notification[:body].present? %>
93
- <p class="mt-1 text-sm leading-6"><%= notification[:body] %></p>
94
- <% end %>
95
-
96
- <!-- Notification URL (optional) -->
97
- <% if notification[:url].present? %>
98
- <p class="mt-2 text-sm">
99
- <a
100
- class="break-all font-medium underline decoration-current/40 underline-offset-2 hover:decoration-current focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current/40"
101
- href="<%= notification[:url] %>"
102
- target="_blank"
103
- rel="noopener noreferrer"
104
- >
105
- <%= notification[:url] %>
106
- </a>
107
- </p>
61
+ <section aria-label="Unread notifications">
62
+ <div class="overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm">
63
+ <ol class="divide-y divide-slate-200">
64
+ <% @notifications[:records].each do |notification| %>
65
+ <%
66
+ category_label, category_icon, accent_classes, icon_classes, badge_classes = case notification[:category].to_s
67
+ when "danger"
68
+ [
69
+ "Attention",
70
+ "error",
71
+ "bg-danger-500",
72
+ "bg-danger-50 text-danger-700",
73
+ "bg-danger-50 text-danger-700 ring-danger-200"
74
+ ]
75
+ when "warning"
76
+ [
77
+ "Warning",
78
+ "warning",
79
+ "bg-warning-500",
80
+ "bg-warning-50 text-warning-700",
81
+ "bg-warning-50 text-warning-700 ring-warning-200"
82
+ ]
83
+ when "success"
84
+ [
85
+ nil,
86
+ "check_circle",
87
+ "bg-success-500",
88
+ "bg-success-50 text-success-700",
89
+ nil
90
+ ]
91
+ when "info"
92
+ [
93
+ nil,
94
+ "info",
95
+ "bg-info-500",
96
+ "bg-info-50 text-info-700",
97
+ nil
98
+ ]
99
+ else
100
+ [
101
+ nil,
102
+ "notifications",
103
+ "bg-neutral-400",
104
+ "bg-neutral-50 text-neutral-700",
105
+ nil
106
+ ]
107
+ end
108
+ %>
109
+
110
+ <li>
111
+ <article class="group relative bg-white px-4 py-3.5 pr-14 transition-colors hover:bg-slate-50 sm:px-5 sm:py-4 sm:pr-16">
112
+ <span class="absolute inset-y-0 left-0 w-1 <%= accent_classes %>" aria-hidden="true"></span>
113
+
114
+ <%= button_to(
115
+ notification_path(notification[:id]),
116
+ method: :put,
117
+ class: "inline-flex size-8 shrink-0 items-center justify-center rounded-full border border-transparent bg-slate-100 text-slate-500 transition-colors hover:bg-sky-100 hover:text-sky-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/30 focus-visible:ring-offset-2",
118
+ form: { class: "absolute right-4 top-3.5 inline-flex sm:right-5 sm:top-4" },
119
+ data: { turbo_submits_with: "…" },
120
+ title: "Mark as read",
121
+ aria: { label: "Mark #{notification[:subject]} as read" }
122
+ ) do %>
123
+ <span class="material-symbols text-lg leading-none" aria-hidden="true">done</span>
124
+ <% end %>
125
+
126
+ <div class="flex items-start gap-3">
127
+ <div class="flex size-9 shrink-0 items-center justify-center rounded-lg <%= icon_classes %>">
128
+ <span class="material-symbols text-xl leading-none" aria-hidden="true"><%= category_icon %></span>
129
+ </div>
130
+
131
+ <div class="min-w-0 flex-1">
132
+ <div class="flex flex-wrap items-center gap-x-2 gap-y-1">
133
+ <h4 class="text-sm font-semibold leading-5 text-slate-800 sm:text-base">
134
+ <% if notification[:url].present? %>
135
+ <a
136
+ class="inline-flex items-center gap-1 rounded-md transition-colors hover:text-sky-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/30 focus-visible:ring-offset-2"
137
+ href="<%= notification[:url] %>"
138
+ target="_blank"
139
+ rel="noopener noreferrer">
140
+ <%= notification[:subject] %>
141
+ <span class="material-symbols text-base leading-none text-slate-400" aria-hidden="true">open_in_new</span>
142
+ </a>
143
+ <% else %>
144
+ <%= notification[:subject] %>
145
+ <% end %>
146
+ </h4>
147
+
148
+ <% if category_label.present? %>
149
+ <span class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-semibold ring-1 ring-inset <%= badge_classes %>">
150
+ <%= category_label %>
151
+ </span>
152
+ <% end %>
153
+ </div>
154
+
155
+ <% if notification[:body].present? %>
156
+ <p class="mt-1 text-sm leading-5 text-slate-600 <%= "line-clamp-2" if notification[:url].present? %>">
157
+ <%= notification[:body] %>
158
+ </p>
159
+ <% end %>
160
+
161
+ <% if notification[:created_at].present? %>
162
+ <time
163
+ class="mt-1.5 block text-xs text-slate-400"
164
+ datetime="<%= notification[:created_at].iso8601 %>">
165
+ <%= time_ago_in_words(notification[:created_at]) %> ago
166
+ </time>
167
+ <% end %>
168
+ </div>
169
+ </div>
170
+ </article>
171
+ </li>
108
172
  <% end %>
109
- </article>
110
- <% end %>
173
+ </ol>
174
+ </div>
111
175
  </section>
112
176
  <% end %>
113
177
  <% end %>
@@ -1,2 +1,73 @@
1
1
  ---
2
- :en: {}
2
+ en:
3
+ lesli_bell:
4
+ announcements:
5
+ audience: "Audience"
6
+ audience_hint: "Choose specific users or roles below. Matching either is sufficient. Entire account clears the selection. Use Ctrl or Command to select multiple entries."
7
+ recipient_users: "Users"
8
+ recipient_roles: "Roles"
9
+ audience_required: "Select at least one user or role for a specific audience."
10
+ invalid_users: "Selected users must belong to this account."
11
+ invalid_roles: "Selected roles must belong to this account and require LesliShield."
12
+ audience_empty: "No recipients (inactive)"
13
+ audiences:
14
+ account: "Entire account"
15
+ specific: "Specific users or roles"
16
+ dismiss_failed: "The announcement could not be dismissed."
17
+ "title": "Announcements"
18
+ "new": "Create announcement"
19
+ "edit": "Edit announcement"
20
+ "back": "All announcements"
21
+ "name": "Name"
22
+ "message": "Message"
23
+ "category": "Category"
24
+ "publication": "Publication"
25
+ "active": "Active"
26
+ "inactive": "Inactive"
27
+ "start_at": "Starts at"
28
+ "end_at": "Ends at"
29
+ "path": "Page"
30
+ "path_hint": "Leave blank for all pages, or enter an exact path such as /support."
31
+ "url": "Link"
32
+ "url_hint": "Optional internal path or HTTP/HTTPS URL."
33
+ "can_be_closed": "Allow users to dismiss"
34
+ "save": "Save"
35
+ "delete": "Delete"
36
+ "confirm_delete": "Delete this announcement?"
37
+ "created": "Announcement created."
38
+ "updated": "Announcement updated."
39
+ "deleted": "Announcement deleted."
40
+ "empty": "No announcements found"
41
+ "pagination": "Announcement pages"
42
+ "previous": "Previous"
43
+ "next": "Next"
44
+ "no_limit": "No limit"
45
+ "all_pages": "All pages"
46
+ "yes": "Yes"
47
+ "no": "No"
48
+ "open_link": "Open link"
49
+ categories:
50
+ info: "Information"
51
+ success: "Success"
52
+ warning: "Warning"
53
+ danger: "Danger"
54
+ cannot_dismiss: "This announcement cannot be dismissed."
55
+ dashboards: {}
56
+ items/attachments: {}
57
+ items/discussions: {}
58
+ items/tasks: {}
59
+ notifications: {}
60
+ shared: {}
61
+ activerecord:
62
+ attributes:
63
+ lesli_bell/announcement:
64
+ audience: "Audience"
65
+ name: "Name"
66
+ message: "Message"
67
+ category: "Category"
68
+ active: "Active"
69
+ start_at: "Starts at"
70
+ end_at: "Ends at"
71
+ path: "Page"
72
+ url: "Link"
73
+ can_be_closed: "Allow users to dismiss"
@@ -1,2 +1,73 @@
1
1
  ---
2
- :es: {}
2
+ es:
3
+ lesli_bell:
4
+ announcements:
5
+ audience: "Audiencia"
6
+ audience_hint: "Selecciona usuarios o roles abajo. Basta con coincidir con cualquiera. Toda la cuenta elimina la selección. Usa Ctrl o Command para seleccionar varias opciones."
7
+ recipient_users: "Usuarios"
8
+ recipient_roles: "Roles"
9
+ audience_required: "Selecciona al menos un usuario o rol para una audiencia específica."
10
+ invalid_users: "Los usuarios seleccionados deben pertenecer a esta cuenta."
11
+ invalid_roles: "Los roles seleccionados deben pertenecer a esta cuenta y requieren LesliShield."
12
+ audience_empty: "Sin destinatarios (inactivo)"
13
+ audiences:
14
+ account: "Toda la cuenta"
15
+ specific: "Usuarios o roles específicos"
16
+ dismiss_failed: "No se pudo cerrar el anuncio."
17
+ "title": "Anuncios"
18
+ "new": "Crear anuncio"
19
+ "edit": "Editar anuncio"
20
+ "back": "Todos los anuncios"
21
+ "name": "Nombre"
22
+ "message": "Mensaje"
23
+ "category": "Categoría"
24
+ "publication": "Publicación"
25
+ "active": "Activo"
26
+ "inactive": "Inactivo"
27
+ "start_at": "Inicio"
28
+ "end_at": "Fin"
29
+ "path": "Página"
30
+ "path_hint": "Dejar vacío para todas las páginas o indicar una ruta exacta como /support."
31
+ "url": "Enlace"
32
+ "url_hint": "Ruta interna o URL HTTP/HTTPS opcional."
33
+ "can_be_closed": "Permitir cerrar el anuncio"
34
+ "save": "Guardar"
35
+ "delete": "Eliminar"
36
+ "confirm_delete": "¿Eliminar este anuncio?"
37
+ "created": "Anuncio creado."
38
+ "updated": "Anuncio actualizado."
39
+ "deleted": "Anuncio eliminado."
40
+ "empty": "No se encontraron anuncios"
41
+ "pagination": "Páginas de anuncios"
42
+ "previous": "Anterior"
43
+ "next": "Siguiente"
44
+ "no_limit": "Sin límite"
45
+ "all_pages": "Todas las páginas"
46
+ "yes": "Sí"
47
+ "no": "No"
48
+ "open_link": "Abrir enlace"
49
+ categories:
50
+ info: "Información"
51
+ success: "Éxito"
52
+ warning: "Advertencia"
53
+ danger: "Peligro"
54
+ cannot_dismiss: "Este anuncio no se puede cerrar."
55
+ dashboards: {}
56
+ items/attachments: {}
57
+ items/discussions: {}
58
+ items/tasks: {}
59
+ notifications: {}
60
+ shared: {}
61
+ activerecord:
62
+ attributes:
63
+ lesli_bell/announcement:
64
+ audience: "Audiencia"
65
+ name: "Nombre"
66
+ message: "Mensaje"
67
+ category: "Categoría"
68
+ active: "Activo"
69
+ start_at: "Inicio"
70
+ end_at: "Fin"
71
+ path: "Página"
72
+ url: "Enlace"
73
+ can_be_closed: "Permitir cerrar el anuncio"
@@ -1,2 +1,3 @@
1
1
  ---
2
- :fr: {}
2
+ fr:
3
+ lesli_bell: {}
@@ -1,2 +1,3 @@
1
1
  ---
2
- :it: {}
2
+ it:
3
+ lesli_bell: {}
@@ -1,2 +1,3 @@
1
1
  ---
2
- :pt: {}
2
+ pt:
3
+ lesli_bell: {}
data/config/routes.rb CHANGED
@@ -32,6 +32,10 @@ Building a better future, one line of code at a time.
32
32
 
33
33
  LesliBell::Engine.routes.draw do
34
34
  Lesli::Router.mount_lesli_engine_routes(self)
35
- resources :notifications, only: [:index, :new, :update]
36
- resources :announcements, only: [:index]
35
+ resources :notifications, only: [:index, :new, :update] do
36
+ put :mark_all_as_read, on: :collection
37
+ end
38
+ resources :announcements do
39
+ post :dismiss, on: :member
40
+ end
37
41
  end
@@ -47,6 +47,11 @@ class CreateLesliBellNotifications < ActiveRecord::Migration[7.0]
47
47
  end
48
48
 
49
49
  add_reference(:lesli_bell_notifications, :user, foreign_key: { to_table: :lesli_users })
50
- add_reference(:lesli_bell_notifications, :account, foreign_key: { to_table: :lesli_accounts })
50
+ add_reference(
51
+ :lesli_bell_notifications,
52
+ :account,
53
+ null: false,
54
+ foreign_key: { to_table: :lesli_bell_accounts }
55
+ )
51
56
  end
52
57
  end
@@ -33,22 +33,22 @@ Building a better future, one line of code at a time.
33
33
  class CreateLesliBellAnnouncements < ActiveRecord::Migration[6.0]
34
34
  def change
35
35
  create_table :lesli_bell_announcements do |t|
36
- t.string :name
36
+ t.string :name, null: false
37
37
  t.string :url
38
38
  t.string :path
39
- t.string :category
40
- t.text :message
41
- t.boolean :status
39
+ t.string :category, null: false
40
+ t.string :audience, null: false
41
+ t.text :message, null: false
42
+ t.boolean :active, null: false
42
43
  t.datetime :start_at
43
44
  t.datetime :end_at
44
- t.boolean :can_be_closed, :default => true
45
+ t.boolean :can_be_closed, null: false
45
46
 
46
47
  t.datetime :deleted_at, index: true
47
48
  t.timestamps
48
49
  end
49
50
 
50
- add_reference(:lesli_bell_announcements, :user, foreign_key: { to_table: :lesli_users })
51
- add_reference(:lesli_bell_announcements, :role, foreign_key: { to_table: :lesli_roles })
52
- add_reference(:lesli_bell_announcements, :account, foreign_key: { to_table: :lesli_accounts })
51
+ add_reference(:lesli_bell_announcements, :user, null: false, foreign_key: { to_table: :lesli_users })
52
+ add_reference(:lesli_bell_announcements, :account, null: false, foreign_key: { to_table: :lesli_bell_accounts })
53
53
  end
54
54
  end
@@ -2,10 +2,10 @@ class CreateLesliBellAnnouncementUsers < ActiveRecord::Migration[7.0]
2
2
  def change
3
3
  create_table :lesli_bell_announcement_users do |t|
4
4
  t.timestamps
5
- t.datetime :deleted_at, index: true
6
5
  end
7
6
 
8
- add_reference(:lesli_bell_announcement_users, :user, foreign_key: { to_table: :lesli_users })
9
- add_reference :lesli_bell_announcement_users, :announcement, foreign_key: { to_table: :lesli_bell_announcements }, index: { name: "lesli_bell_announcements_users" }
7
+ add_reference(:lesli_bell_announcement_users, :user, null: false, foreign_key: { to_table: :lesli_users })
8
+ add_reference(:lesli_bell_announcement_users, :announcement, null: false, foreign_key: { to_table: :lesli_bell_announcements }, index: false)
9
+ add_index(:lesli_bell_announcement_users, [:announcement_id, :user_id], unique: true, name: "index_bell_dismissals_on_announcement_and_user")
10
10
  end
11
11
  end
@@ -0,0 +1,17 @@
1
+ class CreateLesliBellAnnouncementRecipients < ActiveRecord::Migration[8.1]
2
+ def change
3
+ create_table :lesli_bell_announcement_user_recipients do |t|
4
+ t.references :announcement, null: false, foreign_key: { to_table: :lesli_bell_announcements }, index: false
5
+ t.references :user, null: false, foreign_key: { to_table: :lesli_users }
6
+ t.timestamps
7
+ t.index [:announcement_id, :user_id], unique: true, name: "index_bell_audience_users"
8
+ end
9
+
10
+ create_table :lesli_bell_announcement_role_recipients do |t|
11
+ t.references :announcement, null: false, foreign_key: { to_table: :lesli_bell_announcements }, index: false
12
+ t.references :role, null: false, foreign_key: { to_table: :lesli_roles }
13
+ t.timestamps
14
+ t.index [:announcement_id, :role_id], unique: true, name: "index_bell_audience_roles"
15
+ end
16
+ end
17
+ end
@@ -31,17 +31,13 @@ Building a better future, one line of code at a time.
31
31
  =end
32
32
 
33
33
 
34
- file = File.open(LesliBell::Engine.root.join("db", "seed", "seeds.json")).read
35
- seeds = JSON.parse(file)
36
-
37
- current_user = Lesli::User.first
38
-
39
- # ·
40
- seeds["announcements"].each do |notification|
41
- LesliBell::AnnouncementService.new(current_user).create({
42
- name: notification["name"],
43
- category: notification["category"],
44
- message: notification["message"],
45
- url: notification["url"]
46
- }, send_to_user_ids: ::Lesli::User.all.pluck(:id))
47
- end
34
+ seeds = JSON.parse(File.read(LesliBell::Engine.root.join("db", "seed", "seeds.json")))
35
+ author = Lesli::User.first!
36
+
37
+ seeds.fetch("announcements").each do |attributes|
38
+ # Repeated seeds preserve edits, dismissals, and publication choices.
39
+ next if author.account.bell.announcements.with_deleted.exists?(name: attributes.fetch("name"))
40
+
41
+ service = LesliBell::AnnouncementService.new(author).create(attributes.merge("audience" => "account"))
42
+ raise ActiveRecord::RecordInvalid.new(service.result) unless service.successful?
43
+ end
data/db/seed/seeds.json CHANGED
@@ -27,7 +27,8 @@
27
27
  { "message": "Unusual login attempt detected", "category": "danger", "body": "We noticed a login attempt from an unfamiliar location. Please review your account security.", "url": "https://example.com/security-alert" }
28
28
  ],
29
29
  "announcements": [
30
- { "name": "standard", "message": "Exciting News: Welcome to our platform!", "category": "standard" },
30
+ { "name": "instance-created", "message": "Your new Lesli instance is ready. Welcome!", "category": "success" },
31
+ { "name": "standard", "message": "Exciting News: Welcome to our platform!", "category": "info" },
31
32
  { "name": "information", "message": "Upcoming Event: System Maintenance Scheduled", "category": "info", "url": "https://example.com/maintenance-info" },
32
33
  { "name": "success", "message": "Success Update: Your Profile Has Been Updated!", "category": "success" },
33
34
  { "name": "warning", "message": "Friendly Reminder: Password Expiring Soon", "category": "warning", "url": "https://example.com/update-password" },
@@ -1,4 +1,4 @@
1
1
  module LesliBell
2
- VERSION = "1.1.1"
3
- BUILD = "1791607001"
2
+ VERSION = "1.1.3"
3
+ BUILD = "1794795742"
4
4
  end
data/readme.md CHANGED
@@ -8,10 +8,10 @@
8
8
  <br />
9
9
 
10
10
  <div align="center">
11
- <a target="_blank" href="https://github.com/LesliTech/LesliBell/actions/workflows/lesli-ci-tests.yaml">
11
+ <a target="_blank" href="https://github.com/LesliTech/LesliBell/actions/workflows/lesli-ci-engine.yaml">
12
12
  <img
13
13
  alt="LesliBell test status"
14
- src="https://img.shields.io/github/actions/workflow/status/LesliTech/LesliBell/lesli-ci-tests.yaml?branch=master&style=for-the-badge&logo=github&label=tests">
14
+ src="https://img.shields.io/github/actions/workflow/status/LesliTech/LesliBell/lesli-ci-engine.yaml?branch=master&style=for-the-badge&logo=github&label=tests">
15
15
  </a>
16
16
  <a target="_blank" href="https://rubygems.org/gems/lesli_bell">
17
17
  <img alt="Gem Version" src="https://img.shields.io/gem/v/lesli_bell?style=for-the-badge&logo=ruby">
@@ -194,6 +194,7 @@ COVERAGE=true bin/rails test
194
194
  - [Installation](https://www.lesli.dev/engines/bell/about/installation/)
195
195
  - [Notifications](https://www.lesli.dev/engines/bell/notifications/overview/)
196
196
  - [Announcements](https://www.lesli.dev/engines/bell/announcements/overview/)
197
+ - [Announcement testing](https://www.lesli.dev/engines/bell/announcements/testing/)
197
198
  - [Database](https://www.lesli.dev/engines/bell/about/database/)
198
199
  - [Translations](https://www.lesli.dev/engines/bell/about/translations/)
199
200
  - [Frontend](https://www.lesli.dev/engines/bell/about/frontend/)
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lesli_bell
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Lesli Development Team
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-11-16 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: lesli
@@ -31,12 +32,10 @@ extensions: []
31
32
  extra_rdoc_files: []
32
33
  files:
33
34
  - Rakefile
34
- - app/assets/config/lesli_bell_manifest.js
35
35
  - app/assets/images/lesli_bell/bell-logo.svg
36
36
  - app/assets/javascripts/lesli_bell/application.js
37
37
  - app/assets/javascripts/lesli_bell/application.js.LICENSE.txt
38
38
  - app/assets/stylesheets/lesli_bell/application.css
39
- - app/assets/stylesheets/lesli_bell/application.tailwind.css
40
39
  - app/controllers/lesli_bell/accounts_controller.rb
41
40
  - app/controllers/lesli_bell/announcements_controller.rb
42
41
  - app/controllers/lesli_bell/application_controller.rb
@@ -51,7 +50,9 @@ files:
51
50
  - app/mailers/lesli_bell/application_mailer.rb
52
51
  - app/models/lesli_bell/account.rb
53
52
  - app/models/lesli_bell/announcement.rb
53
+ - app/models/lesli_bell/announcement/role_recipient.rb
54
54
  - app/models/lesli_bell/announcement/user.rb
55
+ - app/models/lesli_bell/announcement/user_recipient.rb
55
56
  - app/models/lesli_bell/application_record.rb
56
57
  - app/models/lesli_bell/dashboard.rb
57
58
  - app/models/lesli_bell/notification.rb
@@ -63,6 +64,7 @@ files:
63
64
  - app/views/lesli_bell/accounts/index.html.erb
64
65
  - app/views/lesli_bell/accounts/new.html.erb
65
66
  - app/views/lesli_bell/accounts/show.html.erb
67
+ - app/views/lesli_bell/announcements/_form.html.erb
66
68
  - app/views/lesli_bell/announcements/edit.html.erb
67
69
  - app/views/lesli_bell/announcements/index.html.erb
68
70
  - app/views/lesli_bell/announcements/new.html.erb
@@ -85,6 +87,7 @@ files:
85
87
  - db/migrate/v1.0/0308110110_create_lesli_bell_announcements.rb
86
88
  - db/migrate/v1.0/0308110210_create_lesli_bell_announcement_activities.rb
87
89
  - db/migrate/v1.0/0308110310_create_lesli_bell_announcement_users.rb
90
+ - db/migrate/v1.0/0308110410_create_lesli_bell_announcement_recipients.rb
88
91
  - db/seed/announcements.rb
89
92
  - db/seed/notifications.rb
90
93
  - db/seed/seeds.json
@@ -102,6 +105,7 @@ metadata:
102
105
  homepage_uri: https://www.lesli.dev/
103
106
  changelog_uri: https://github.com/LesliTech/LesliBell
104
107
  source_code_uri: https://github.com/LesliTech/LesliBell
108
+ post_install_message:
105
109
  rdoc_options: []
106
110
  require_paths:
107
111
  - lib
@@ -116,7 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
120
  - !ruby/object:Gem::Version
117
121
  version: '0'
118
122
  requirements: []
119
- rubygems_version: 3.7.1
123
+ rubygems_version: 3.5.16
124
+ signing_key:
120
125
  specification_version: 4
121
126
  summary: Notifications & Announcements System for the Lesli Framework.
122
127
  test_files: []