lesli_bell 0.1.0 → 1.0.0
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.
- checksums.yaml +4 -4
- data/app/assets/images/lesli_bell/bell-logo.svg +1 -0
- data/app/assets/javascripts/lesli_bell/application.js +1 -2835
- data/app/assets/javascripts/lesli_bell/application.js.LICENSE.txt +250 -0
- data/app/assets/stylesheets/lesli_bell/application.css +4 -15
- data/app/controllers/lesli_bell/announcements_controller.rb +16 -1
- data/app/controllers/lesli_bell/dashboards_controller.rb +26 -49
- data/app/controllers/lesli_bell/notifications_controller.rb +7 -8
- data/app/models/lesli_bell/announcement/user.rb +6 -0
- data/app/models/lesli_bell/announcement.rb +12 -2
- data/app/models/lesli_bell/dashboard.rb +38 -2
- data/app/models/lesli_bell/notification.rb +15 -16
- data/app/services/lesli_bell/announcement_service.rb +84 -0
- data/app/services/lesli_bell/notification_service.rb +46 -51
- data/app/views/lesli_bell/announcements/index.html.erb +30 -11
- data/app/views/lesli_bell/dashboards/edit.html.erb +30 -7
- data/app/views/lesli_bell/dashboards/show.html.erb +33 -1
- data/app/views/lesli_bell/notifications/index.html.erb +67 -3
- data/app/views/lesli_bell/notifications/new.html.erb +30 -6
- data/app/views/lesli_bell/partials/{_engine-navigation.html.erb → _navigation.html.erb} +2 -2
- data/config/locales/translations.en.yml +2 -0
- data/config/locales/translations.es.yml +2 -0
- data/config/locales/translations.fr.yml +2 -0
- data/config/locales/translations.it.yml +2 -0
- data/config/locales/translations.pt.yml +2 -0
- data/config/routes.rb +34 -3
- data/db/migrate/v1.0/0308000110_create_lesli_bell_accounts.rb +24 -15
- data/db/migrate/v1.0/0308003010_create_lesli_bell_dashboards.rb +37 -0
- data/db/migrate/v1.0/0308100110_create_lesli_bell_notifications.rb +24 -13
- data/db/migrate/v1.0/0308110110_create_lesli_bell_announcements.rb +26 -12
- data/db/migrate/v1.0/0308110310_create_lesli_bell_announcement_users.rb +6 -7
- data/db/seed/announcements.rb +47 -0
- data/db/seed/notifications.rb +53 -0
- data/db/seed/seeds.json +36 -0
- data/db/seeds.rb +30 -15
- data/lib/lesli_bell/version.rb +2 -2
- data/lib/vue/application.js +42 -20
- data/lib/vue/apps/announcements/index.vue +49 -28
- data/lib/vue/apps/notifications/components/notification-form.vue +45 -23
- data/lib/vue/apps/notifications/index.vue +55 -40
- data/lib/vue/apps/notifications/new.vue +32 -21
- data/lib/vue/stores/announcement.js +36 -31
- data/lib/vue/stores/notification.js +56 -23
- data/lib/vue/stores/translations.json +232 -0
- data/license +674 -0
- data/readme.md +75 -18
- metadata +38 -18
- data/app/views/lesli_bell/announcements/_announcement.html.erb +0 -2
- data/app/views/lesli_bell/announcements/_form.html.erb +0 -17
- data/app/views/lesli_bell/dashboards/_dashboard.html.erb +0 -2
- data/app/views/lesli_bell/dashboards/_form.html.erb +0 -17
- data/app/views/lesli_bell/dashboards/index.html.erb +0 -14
- data/app/views/lesli_bell/dashboards/new.html.erb +0 -9
- data/db/migrate/v1.0/0308100210_create_lesli_bell_notification_activities.rb +0 -17
- data/db/seed/development.rb +0 -36
- data/db/seed/test.rb +0 -0
- /data/{db/seed/production.rb → lib/scss/application.scss} +0 -0
@@ -0,0 +1,250 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Lesli
|
4
|
+
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
This program is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
19
|
+
|
20
|
+
Lesli · Your Smart Business Assistant.
|
21
|
+
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
23
|
+
Building a better future, one line of code at a time.
|
24
|
+
|
25
|
+
@contact hello@lesli.tech
|
26
|
+
@website https://lesli.tech
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
28
|
+
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
|
+
// ·
|
31
|
+
|
32
|
+
*/
|
33
|
+
|
34
|
+
/*
|
35
|
+
|
36
|
+
Lesli
|
37
|
+
|
38
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
39
|
+
|
40
|
+
This program is free software: you can redistribute it and/or modify
|
41
|
+
it under the terms of the GNU General Public License as published by
|
42
|
+
the Free Software Foundation, either version 3 of the License, or
|
43
|
+
(at your option) any later version.
|
44
|
+
|
45
|
+
This program is distributed in the hope that it will be useful,
|
46
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
47
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
48
|
+
GNU General Public License for more details.
|
49
|
+
|
50
|
+
You should have received a copy of the GNU General Public License
|
51
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
52
|
+
|
53
|
+
Lesli · Your Smart Business Assistant.
|
54
|
+
|
55
|
+
Made with ♥ by https://www.lesli.tech
|
56
|
+
Building a better future, one line of code at a time.
|
57
|
+
|
58
|
+
@contact hello@lesli.tech
|
59
|
+
@website https://lesli.tech
|
60
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
61
|
+
|
62
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
63
|
+
// ·
|
64
|
+
*/
|
65
|
+
|
66
|
+
/*
|
67
|
+
Lesli
|
68
|
+
|
69
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
70
|
+
|
71
|
+
This program is free software: you can redistribute it and/or modify
|
72
|
+
it under the terms of the GNU General Public License as published by
|
73
|
+
the Free Software Foundation, either version 3 of the License, or
|
74
|
+
(at your option) any later version.
|
75
|
+
|
76
|
+
This program is distributed in the hope that it will be useful,
|
77
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
78
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
79
|
+
GNU General Public License for more details.
|
80
|
+
|
81
|
+
You should have received a copy of the GNU General Public License
|
82
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
83
|
+
|
84
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
85
|
+
|
86
|
+
Made with ♥ by https://www.lesli.tech
|
87
|
+
Building a better future, one line of code at a time.
|
88
|
+
|
89
|
+
@contact hello@lesli.tech
|
90
|
+
@website https://www.lesli.dev
|
91
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
92
|
+
|
93
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
94
|
+
// ·
|
95
|
+
*/
|
96
|
+
|
97
|
+
/*
|
98
|
+
Lesli
|
99
|
+
|
100
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
101
|
+
|
102
|
+
This program is free software: you can redistribute it and/or modify
|
103
|
+
it under the terms of the GNU General Public License as published by
|
104
|
+
the Free Software Foundation, either version 3 of the License, or
|
105
|
+
(at your option) any later version.
|
106
|
+
|
107
|
+
This program is distributed in the hope that it will be useful,
|
108
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
109
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
110
|
+
GNU General Public License for more details.
|
111
|
+
|
112
|
+
You should have received a copy of the GNU General Public License
|
113
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
114
|
+
|
115
|
+
Lesli · Ruby on Rails SaaS development platform.
|
116
|
+
|
117
|
+
Made with ♥ by https://www.lesli.tech
|
118
|
+
Building a better future, one line of code at a time.
|
119
|
+
|
120
|
+
@contact hello@lesli.tech
|
121
|
+
@website https://www.lesli.tech
|
122
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
123
|
+
|
124
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
125
|
+
// ·
|
126
|
+
*/
|
127
|
+
|
128
|
+
/*
|
129
|
+
Lesli
|
130
|
+
|
131
|
+
Copyright (c) 2020, Lesli Technologies, S. A.
|
132
|
+
|
133
|
+
This program is free software: you can redistribute it and/or modify
|
134
|
+
it under the terms of the GNU General Public License as published by
|
135
|
+
the Free Software Foundation, either version 3 of the License, or
|
136
|
+
(at your option) any later version.
|
137
|
+
|
138
|
+
This program is distributed in the hope that it will be useful,
|
139
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
140
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
141
|
+
GNU General Public License for more details.
|
142
|
+
|
143
|
+
You should have received a copy of the GNU General Public License
|
144
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
145
|
+
|
146
|
+
Lesli JS - JavaScript utilities for JavaScript applications
|
147
|
+
|
148
|
+
Powered by LesliTech
|
149
|
+
Building a better future, one line of code at a time.
|
150
|
+
|
151
|
+
@contact <hello@lesli.tech>
|
152
|
+
@website <https://lesli.tech>
|
153
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
154
|
+
|
155
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
156
|
+
// ·
|
157
|
+
*/
|
158
|
+
|
159
|
+
/*
|
160
|
+
Lesli
|
161
|
+
|
162
|
+
Copyright (c) 2021, Lesli Technologies, S. A.
|
163
|
+
|
164
|
+
This program is free software: you can redistribute it and/or modify
|
165
|
+
it under the terms of the GNU General Public License as published by
|
166
|
+
the Free Software Foundation, either version 3 of the License, or
|
167
|
+
(at your option) any later version.
|
168
|
+
|
169
|
+
This program is distributed in the hope that it will be useful,
|
170
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
171
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
172
|
+
GNU General Public License for more details.
|
173
|
+
|
174
|
+
You should have received a copy of the GNU General Public License
|
175
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
176
|
+
|
177
|
+
Lesli JS - JavaScript utilities for JavaScript applications
|
178
|
+
|
179
|
+
Powered by LesliTech
|
180
|
+
Building a better future, one line of code at a time.
|
181
|
+
|
182
|
+
@contact <hello@lesli.tech>
|
183
|
+
@website <https://lesli.tech>
|
184
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
185
|
+
|
186
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
187
|
+
// ·
|
188
|
+
*/
|
189
|
+
|
190
|
+
/*
|
191
|
+
Lesli
|
192
|
+
|
193
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
194
|
+
|
195
|
+
This program is free software: you can redistribute it and/or modify
|
196
|
+
it under the terms of the GNU General Public License as published by
|
197
|
+
the Free Software Foundation, either version 3 of the License, or
|
198
|
+
(at your option) any later version.
|
199
|
+
|
200
|
+
This program is distributed in the hope that it will be useful,
|
201
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
202
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
203
|
+
GNU General Public License for more details.
|
204
|
+
|
205
|
+
You should have received a copy of the GNU General Public License
|
206
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
207
|
+
|
208
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
209
|
+
|
210
|
+
Made with ♥ by https://www.lesli.tech
|
211
|
+
Building a better future, one line of code at a time.
|
212
|
+
|
213
|
+
@contact hello@lesli.tech
|
214
|
+
@website https://www.lesli.dev
|
215
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
216
|
+
|
217
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
218
|
+
// ·
|
219
|
+
*/
|
220
|
+
|
221
|
+
/*
|
222
|
+
Lesli
|
223
|
+
|
224
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
225
|
+
|
226
|
+
This program is free software: you can redistribute it and/or modify
|
227
|
+
it under the terms of the GNU General Public License as published by
|
228
|
+
the Free Software Foundation, either version 3 of the License, or
|
229
|
+
(at your option) any later version.
|
230
|
+
|
231
|
+
This program is distributed in the hope that it will be useful,
|
232
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
233
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
234
|
+
GNU General Public License for more details.
|
235
|
+
|
236
|
+
You should have received a copy of the GNU General Public License
|
237
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
238
|
+
|
239
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
240
|
+
|
241
|
+
Made with ♥ by https://www.lesli.tech
|
242
|
+
Building a better future, one line of code at a time.
|
243
|
+
|
244
|
+
@contact hello@lesli.tech
|
245
|
+
@website https://www.lesli.tech
|
246
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
247
|
+
|
248
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
249
|
+
// ·
|
250
|
+
*/
|
@@ -1,15 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
-
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
-
* It is generally better to create a new file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|
1
|
+
/*!***********************************************************************************************************************************************************!*\
|
2
|
+
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./node_modules/sass-loader/dist/cjs.js!../LesliBell/lib/scss/application.scss ***!
|
3
|
+
\***********************************************************************************************************************************************************/
|
4
|
+
|
@@ -2,9 +2,24 @@ module LesliBell
|
|
2
2
|
class AnnouncementsController < ApplicationController
|
3
3
|
before_action :set_announcement, only: %i[ show edit update destroy ]
|
4
4
|
|
5
|
+
# GET /announcements/list
|
6
|
+
def list
|
7
|
+
respond_to do |format|
|
8
|
+
format.html { }
|
9
|
+
format.json {
|
10
|
+
respond_with_pagination(AnnouncementService.new(current_user, query).list)
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
5
15
|
# GET /announcements
|
6
16
|
def index
|
7
|
-
|
17
|
+
respond_to do |format|
|
18
|
+
format.html { }
|
19
|
+
format.json {
|
20
|
+
respond_with_pagination(AnnouncementService.new(current_user, query).index)
|
21
|
+
}
|
22
|
+
end
|
8
23
|
end
|
9
24
|
|
10
25
|
# GET /announcements/1
|
@@ -1,59 +1,36 @@
|
|
1
|
-
|
2
|
-
class DashboardsController < ApplicationController
|
3
|
-
#before_action :set_dashboard, only: %i[ show edit update destroy ]
|
1
|
+
=begin
|
4
2
|
|
5
|
-
|
6
|
-
def index
|
7
|
-
end
|
3
|
+
Lesli
|
8
4
|
|
9
|
-
|
10
|
-
def show
|
11
|
-
end
|
5
|
+
Copyright (c) 2025, Lesli Technologies, S. A.
|
12
6
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
17
11
|
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
This program is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
21
16
|
|
22
|
-
|
23
|
-
|
24
|
-
@dashboard = Dashboard.new(dashboard_params)
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
25
19
|
|
26
|
-
|
27
|
-
redirect_to @dashboard, notice: "Dashboard was successfully created."
|
28
|
-
else
|
29
|
-
render :new, status: :unprocessable_entity
|
30
|
-
end
|
31
|
-
end
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
32
21
|
|
33
|
-
|
34
|
-
|
35
|
-
if @dashboard.update(dashboard_params)
|
36
|
-
redirect_to @dashboard, notice: "Dashboard was successfully updated.", status: :see_other
|
37
|
-
else
|
38
|
-
render :edit, status: :unprocessable_entity
|
39
|
-
end
|
40
|
-
end
|
22
|
+
Made with ♥ by LesliTech
|
23
|
+
Building a better future, one line of code at a time.
|
41
24
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
25
|
+
@contact hello@lesli.tech
|
26
|
+
@website https://www.lesli.tech
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
28
|
+
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
|
+
// ·
|
31
|
+
=end
|
47
32
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
@dashboard = Dashboard.find(params[:id])
|
52
|
-
end
|
53
|
-
|
54
|
-
# Only allow a list of trusted parameters through.
|
55
|
-
def dashboard_params
|
56
|
-
params.fetch(:dashboard, {})
|
57
|
-
end
|
58
|
-
end
|
33
|
+
module LesliBell
|
34
|
+
class DashboardsController < Lesli::Shared::DashboardsController
|
35
|
+
end
|
59
36
|
end
|
@@ -4,7 +4,7 @@ module LesliBell
|
|
4
4
|
|
5
5
|
# GET /notifications
|
6
6
|
def index
|
7
|
-
|
7
|
+
@notifications = respond_as_pagination(NotificationService.new(current_user, query).index)
|
8
8
|
end
|
9
9
|
|
10
10
|
# GET /notifications/1
|
@@ -13,7 +13,6 @@ module LesliBell
|
|
13
13
|
|
14
14
|
# GET /notifications/new
|
15
15
|
def new
|
16
|
-
@notification = Notification.new
|
17
16
|
end
|
18
17
|
|
19
18
|
# GET /notifications/1/edit
|
@@ -33,11 +32,9 @@ module LesliBell
|
|
33
32
|
|
34
33
|
# PATCH/PUT /notifications/1
|
35
34
|
def update
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
render :edit, status: :unprocessable_entity
|
40
|
-
end
|
35
|
+
NotificationService.new(current_user).read(params[:id])
|
36
|
+
@notifications = respond_as_pagination(NotificationService.new(current_user, query).index)
|
37
|
+
render :index
|
41
38
|
end
|
42
39
|
|
43
40
|
# DELETE /notifications/1
|
@@ -54,7 +51,9 @@ module LesliBell
|
|
54
51
|
|
55
52
|
# Only allow a list of trusted parameters through.
|
56
53
|
def notification_params
|
57
|
-
|
54
|
+
params.require(:notification).permit(
|
55
|
+
:id
|
56
|
+
)
|
58
57
|
end
|
59
58
|
end
|
60
59
|
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
module LesliBell
|
2
|
+
class Announcement::User < ApplicationRecord
|
3
|
+
belongs_to :announcement #, class_name: "CloudBell::Announcement", foreign_key: "cloud_bell_announcements_id", optional: false
|
4
|
+
#belongs_to :user, class_name: "Lesli::User", foreign_key: "users_id"
|
5
|
+
end
|
6
|
+
end
|
@@ -1,4 +1,14 @@
|
|
1
1
|
module LesliBell
|
2
|
-
|
3
|
-
|
2
|
+
class Announcement < ApplicationRecord
|
3
|
+
belongs_to :account, class_name: "LesliBell::Account"
|
4
|
+
belongs_to :user, class_name: "::Lesli::User"
|
5
|
+
has_many :users #, class_name: "::Lesli::User"
|
6
|
+
|
7
|
+
enum category: {
|
8
|
+
:info => 'info',
|
9
|
+
:danger => 'danger',
|
10
|
+
:warning => 'warning',
|
11
|
+
:success => 'success'
|
12
|
+
}
|
13
|
+
end
|
4
14
|
end
|
@@ -1,4 +1,40 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Lesli
|
4
|
+
|
5
|
+
Copyright (c) 2025, Lesli Technologies, S. A.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
This program is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
19
|
+
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
21
|
+
|
22
|
+
Made with ♥ by LesliTech
|
23
|
+
Building a better future, one line of code at a time.
|
24
|
+
|
25
|
+
@contact hello@lesli.tech
|
26
|
+
@website https://www.lesli.tech
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
28
|
+
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
|
+
// ·
|
31
|
+
=end
|
32
|
+
|
1
33
|
module LesliBell
|
2
|
-
|
3
|
-
|
34
|
+
class Dashboard < Lesli::Shared::Dashboard
|
35
|
+
self.table_name = "lesli_bell_dashboards"
|
36
|
+
belongs_to :account
|
37
|
+
|
38
|
+
COMPONENTS = %i[]
|
39
|
+
end
|
4
40
|
end
|
@@ -3,26 +3,25 @@ module LesliBell
|
|
3
3
|
belongs_to :account, class_name: "LesliBell::Account"
|
4
4
|
belongs_to :user, class_name: "::Lesli::User"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
success: "success"
|
6
|
+
enum :category, {
|
7
|
+
:info => 'info',
|
8
|
+
:danger => 'danger',
|
9
|
+
:warning => 'warning',
|
10
|
+
:success => 'success'
|
12
11
|
}
|
13
12
|
|
14
|
-
enum channel
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
enum :channel, {
|
14
|
+
:web => 'web', # notification for web interface only
|
15
|
+
:push => 'push', # webpush & mobilepush
|
16
|
+
:email => 'email', # notification sent by email only
|
17
|
+
:dialog => 'dialog', # open a dialog in the main app screen
|
18
|
+
:mobile => 'mobile' # notification for mobile only
|
20
19
|
}
|
21
20
|
|
22
|
-
enum status
|
23
|
-
|
24
|
-
sent
|
25
|
-
|
21
|
+
enum :status, {
|
22
|
+
:created => 'created',
|
23
|
+
:sent => 'sent',
|
24
|
+
:read => 'read'
|
26
25
|
}
|
27
26
|
end
|
28
27
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module LesliBell
|
2
|
+
class AnnouncementService < Lesli::ApplicationLesliService
|
3
|
+
|
4
|
+
def list
|
5
|
+
|
6
|
+
# NOTE: the query must be created in this specific order, if not ActiveRecord creates weird sql
|
7
|
+
# due the OR statement we are usign to get the announcements with a path
|
8
|
+
|
9
|
+
# Get all the announcements for the current user
|
10
|
+
announcements = current_user.account.bell.announcements
|
11
|
+
|
12
|
+
# joining to the announcement_users table, to see if the users already mark the announcement as read
|
13
|
+
announcements = announcements.left_joins(:users)
|
14
|
+
|
15
|
+
# get the announcements without a specific path (global announcements)
|
16
|
+
announcements = announcements.where(path: nil)
|
17
|
+
|
18
|
+
# get the announcements with a specific path (to show only in a specific page)
|
19
|
+
#announcements = announcements.or(Announcement.where("path = ?", filters[:base_path])) if params.dig(:f, :base_path)
|
20
|
+
|
21
|
+
# get the announcements with a start date greater than or equal to current date and with expiration date less or equal than current date
|
22
|
+
# announcements = announcements.where("start_at <= '#{Date.now.end_of_day}' or start_at is NULL")
|
23
|
+
# .where("cloud_bell_announcements.end_at >= '#{LC::Date.now.beginning_of_day}' or end_at is NULL")
|
24
|
+
|
25
|
+
# get the announcements that are not marked as read by the user
|
26
|
+
announcements = announcements.where(users: { id: nil })
|
27
|
+
|
28
|
+
announcements.select(
|
29
|
+
:id,
|
30
|
+
:name,
|
31
|
+
:category,
|
32
|
+
:message,
|
33
|
+
:can_be_closed,
|
34
|
+
:start_at,
|
35
|
+
:end_at,
|
36
|
+
:path
|
37
|
+
).page(query[:pagination][:page])
|
38
|
+
.per(query[:pagination][:perPage])
|
39
|
+
.order(:start_at)
|
40
|
+
end
|
41
|
+
|
42
|
+
def index
|
43
|
+
|
44
|
+
# work with all notifications
|
45
|
+
announcements = current_user.account.bell
|
46
|
+
.announcements
|
47
|
+
.order(:start_at)
|
48
|
+
|
49
|
+
# add pagination
|
50
|
+
announcements
|
51
|
+
.page(query[:pagination][:page])
|
52
|
+
.per(query[:pagination][:perPage])
|
53
|
+
.order(:updated_at)
|
54
|
+
end
|
55
|
+
|
56
|
+
def create(
|
57
|
+
announcements_params,
|
58
|
+
send_to_role_ids:nil,
|
59
|
+
send_to_user_ids:nil,
|
60
|
+
send_to_user_emails:nil
|
61
|
+
)
|
62
|
+
|
63
|
+
users = []
|
64
|
+
|
65
|
+
unless Announcement.categories.key?(announcements_params[:category])
|
66
|
+
announcements_params[:category] = :info
|
67
|
+
end
|
68
|
+
|
69
|
+
announcements_params[:user_id] = current_user.id
|
70
|
+
|
71
|
+
announcement = current_user.account.bell.announcements.create!(announcements_params)
|
72
|
+
|
73
|
+
self.resource = announcement
|
74
|
+
|
75
|
+
self
|
76
|
+
end
|
77
|
+
|
78
|
+
def read id
|
79
|
+
noti = current_user.account.bell.notifications.where(:id => id, :user => current_user)
|
80
|
+
noti.update(:status => :read)
|
81
|
+
self
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|