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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/lesli_bell/bell-logo.svg +1 -0
  3. data/app/assets/javascripts/lesli_bell/application.js +1 -2835
  4. data/app/assets/javascripts/lesli_bell/application.js.LICENSE.txt +250 -0
  5. data/app/assets/stylesheets/lesli_bell/application.css +4 -15
  6. data/app/controllers/lesli_bell/announcements_controller.rb +16 -1
  7. data/app/controllers/lesli_bell/dashboards_controller.rb +26 -49
  8. data/app/controllers/lesli_bell/notifications_controller.rb +7 -8
  9. data/app/models/lesli_bell/announcement/user.rb +6 -0
  10. data/app/models/lesli_bell/announcement.rb +12 -2
  11. data/app/models/lesli_bell/dashboard.rb +38 -2
  12. data/app/models/lesli_bell/notification.rb +15 -16
  13. data/app/services/lesli_bell/announcement_service.rb +84 -0
  14. data/app/services/lesli_bell/notification_service.rb +46 -51
  15. data/app/views/lesli_bell/announcements/index.html.erb +30 -11
  16. data/app/views/lesli_bell/dashboards/edit.html.erb +30 -7
  17. data/app/views/lesli_bell/dashboards/show.html.erb +33 -1
  18. data/app/views/lesli_bell/notifications/index.html.erb +67 -3
  19. data/app/views/lesli_bell/notifications/new.html.erb +30 -6
  20. data/app/views/lesli_bell/partials/{_engine-navigation.html.erb → _navigation.html.erb} +2 -2
  21. data/config/locales/translations.en.yml +2 -0
  22. data/config/locales/translations.es.yml +2 -0
  23. data/config/locales/translations.fr.yml +2 -0
  24. data/config/locales/translations.it.yml +2 -0
  25. data/config/locales/translations.pt.yml +2 -0
  26. data/config/routes.rb +34 -3
  27. data/db/migrate/v1.0/0308000110_create_lesli_bell_accounts.rb +24 -15
  28. data/db/migrate/v1.0/0308003010_create_lesli_bell_dashboards.rb +37 -0
  29. data/db/migrate/v1.0/0308100110_create_lesli_bell_notifications.rb +24 -13
  30. data/db/migrate/v1.0/0308110110_create_lesli_bell_announcements.rb +26 -12
  31. data/db/migrate/v1.0/0308110310_create_lesli_bell_announcement_users.rb +6 -7
  32. data/db/seed/announcements.rb +47 -0
  33. data/db/seed/notifications.rb +53 -0
  34. data/db/seed/seeds.json +36 -0
  35. data/db/seeds.rb +30 -15
  36. data/lib/lesli_bell/version.rb +2 -2
  37. data/lib/vue/application.js +42 -20
  38. data/lib/vue/apps/announcements/index.vue +49 -28
  39. data/lib/vue/apps/notifications/components/notification-form.vue +45 -23
  40. data/lib/vue/apps/notifications/index.vue +55 -40
  41. data/lib/vue/apps/notifications/new.vue +32 -21
  42. data/lib/vue/stores/announcement.js +36 -31
  43. data/lib/vue/stores/notification.js +56 -23
  44. data/lib/vue/stores/translations.json +232 -0
  45. data/license +674 -0
  46. data/readme.md +75 -18
  47. metadata +38 -18
  48. data/app/views/lesli_bell/announcements/_announcement.html.erb +0 -2
  49. data/app/views/lesli_bell/announcements/_form.html.erb +0 -17
  50. data/app/views/lesli_bell/dashboards/_dashboard.html.erb +0 -2
  51. data/app/views/lesli_bell/dashboards/_form.html.erb +0 -17
  52. data/app/views/lesli_bell/dashboards/index.html.erb +0 -14
  53. data/app/views/lesli_bell/dashboards/new.html.erb +0 -9
  54. data/db/migrate/v1.0/0308100210_create_lesli_bell_notification_activities.rb +0 -17
  55. data/db/seed/development.rb +0 -36
  56. data/db/seed/test.rb +0 -0
  57. /data/{db/seed/production.rb → lib/scss/application.scss} +0 -0
@@ -1,25 +1,44 @@
1
1
  <script setup>
2
2
  /*
3
- Copyright (c) 2022, all rights reserved.
3
+ Lesli
4
4
 
5
- All the information provided by this platform is protected by international laws related to
6
- industrial property, intellectual property, copyright and relative international laws.
7
- All intellectual or industrial property rights of the code, texts, trade mark, design,
8
- pictures and any other information belongs to the owner of this platform.
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
9
6
 
10
- Without the written permission of the owner, any replication, modification,
11
- transmission, publication is strictly forbidden.
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.
12
11
 
13
- For more information read the license file including with this software.
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.
14
16
 
15
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
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
+ // ·
17
31
  */
18
32
 
19
33
 
20
34
  // · import vue tools
21
35
  import { ref, reactive, onMounted, watch, computed, inject } from "vue"
22
- import { useRouter, useRoute } from 'vue-router'
36
+ import { useRouter, useRoute } from "vue-router"
37
+
38
+ import dayjs from "dayjs"
39
+ import relativeTime from 'dayjs/plugin/relativeTime'
40
+
41
+ dayjs.extend(relativeTime)
23
42
 
24
43
 
25
44
  // · initialize/inject plugins
@@ -30,7 +49,7 @@ const date = inject("date")
30
49
 
31
50
 
32
51
  // · import lesli stores
33
- import { useBellNotification } from "LesliBell/stores/notification"
52
+ import { useBellNotification } from "LesliBell/vue/stores/notification"
34
53
 
35
54
 
36
55
  // · implement stores
@@ -39,17 +58,19 @@ const storeNotification = useBellNotification()
39
58
 
40
59
  // ·
41
60
  const translations = {
61
+ shared: i18n.t("lesli.shared"),
62
+ bell: {
63
+ notifications: i18n.t("lesli_bell.notifications")
64
+ },
65
+
42
66
  core: {
43
67
  shared: I18n.t("core.shared")
44
- },
45
- bell: {
46
- notifications: I18n.t("bell.notifications")
47
68
  }
48
69
  }
49
70
 
50
71
  const columns = [{
51
72
  field: "id",
52
- label: "ID"
73
+ label: ""
53
74
  }, {
54
75
  field: "subject",
55
76
  label: "Notification"
@@ -65,29 +86,35 @@ const columns = [{
65
86
  label: "Sent at"
66
87
  }]
67
88
 
89
+
68
90
  // · initializing
69
91
  onMounted(() => {
70
92
  storeNotification.fetch()
71
93
  })
72
94
 
95
+
73
96
  </script>
74
97
  <template>
75
- <section class="application-component">
76
-
77
- <lesli-header :title="translations.bell.notifications.view_title_notifications">
78
- <lesli-button :to="url.bell('notifications/new')" icon="add">
79
- {{ translations.core.shared.view_btn_add }}
98
+ <lesli-application-container>
99
+ <lesli-header :title="translations.bell.notifications.view_title">
100
+ <lesli-button icon="refresh">
101
+ {{ translations.shared.button_reload }}
80
102
  </lesli-button>
103
+ <!--
104
+ <lesli-link button solid icon="add" :to="url.bell('notifications/new')">
105
+ {{ translations.shared.button_add_new }}
106
+ </lesli-link>
107
+ -->
81
108
  </lesli-header>
82
109
 
83
110
  <lesli-table
84
111
  :columns="columns"
85
- :records="storeNotification.records"
86
- :pagination="storeNotification.pagination"
112
+ :records="storeNotification.index.records"
113
+ :pagination="storeNotification.index.pagination"
87
114
  @paginate="storeNotification.paginate">
88
- <template #id="{ value, record }">
89
- <span :class="['tag', 'is-medium', 'is-' + record.category]">
90
- {{ value }}
115
+ <template #id="{ value, record }" class="ldonis">
116
+ <span :class="['material-icons', 'has-text-' + record.category]">
117
+ info
91
118
  </span>
92
119
  </template>
93
120
  <template #subject="{ column, value, record }">
@@ -106,24 +133,12 @@ onMounted(() => {
106
133
  </span>
107
134
  </span>
108
135
  <span>
109
- {{ date.date(value) }}
110
- </span>
111
- </span>
112
- </p>
113
- <p>
114
- <span class="icon-text">
115
- <span class="icon">
116
- <span class="has-text-grey material-icons">
117
- schedule
118
- </span>
119
- </span>
120
- <span>
121
- {{ date.time(value) }}
136
+ {{ date.dateTime(value) }}
122
137
  </span>
123
138
  </span>
124
139
  </p>
125
140
  </template>
126
141
  </lesli-table>
127
142
 
128
- </section>
143
+ </lesli-application-container>
129
144
  </template>
@@ -1,45 +1,56 @@
1
1
  <script setup>
2
2
  /*
3
- Copyright (c) 2022, all rights reserved.
3
+ Lesli
4
4
 
5
- All the information provided by this platform is protected by international laws related to
6
- industrial property, intellectual property, copyright and relative international laws.
7
- All intellectual or industrial property rights of the code, texts, trade mark, design,
8
- pictures and any other information belongs to the owner of this platform.
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
9
6
 
10
- Without the written permission of the owner, any replication, modification,
11
- transmission, publication is strictly forbidden.
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.
12
11
 
13
- For more information read the license file including with this software.
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.
14
16
 
15
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
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
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
16
30
  // ·
17
31
  */
18
32
 
33
+
19
34
  // · import vue tools
20
35
  import { onMounted } from "vue"
21
36
 
22
- // · import components and lazy loading implementation
23
- import ComponentNotificationForm from "LesliBell/apps/notifications/components/notification-form.vue"
37
+
38
+ // ·
39
+ import ComponentNotificationForm from "./components/notification-form.vue"
24
40
 
25
41
 
26
42
  // ·
27
43
  const translations = {
28
- core: {
29
- shared: I18n.t("core.shared")
30
- },
31
44
  bell: {
32
- notifications: I18n.t("bell.notifications")
45
+ notifications: i18n.t("lesli_bell.notifications")
33
46
  }
34
47
  }
35
48
 
36
49
  </script>
37
50
  <template>
38
- <section class="application-component">
39
-
40
- <lesli-header :title="translations.bell.notifications.view_title_new_notification"></lesli-header>
41
-
51
+ <lesli-application-container>
52
+ <lesli-header :title="translations.bell.notifications.view_create_notification">
53
+ </lesli-header>
42
54
  <component-notification-form></component-notification-form>
43
-
44
- </section>
55
+ </lesli-application-container>
45
56
  </template>
@@ -1,18 +1,32 @@
1
1
  /*
2
- Copyright (c) 2022, all rights reserved.
2
+ Lesli
3
3
 
4
- All the information provided by this platform is protected by international laws related to
5
- industrial property, intellectual property, copyright and relative international laws.
6
- All intellectual or industrial property rights of the code, texts, trade mark, design,
7
- pictures and any other information belongs to the owner of this platform.
4
+ Copyright (c) 2023, Lesli Technologies, S. A.
8
5
 
9
- Without the written permission of the owner, any replication, modification,
10
- transmission, publication is strictly forbidden.
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
11
10
 
12
- For more information read the license file including with this software.
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
13
15
 
14
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
15
- // ·
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see http://www.gnu.org/licenses/.
18
+
19
+ Lesli · Ruby on Rails SaaS Development Framework.
20
+
21
+ Made with ♥ by LesliTech
22
+ Building a better future, one line of code at a time.
23
+
24
+ @contact hello@lesli.tech
25
+ @website https://www.lesli.tech
26
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
27
+
28
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
+ // ·
16
30
  */
17
31
 
18
32
 
@@ -20,6 +34,8 @@ For more information read the license file including with this software.
20
34
  import { defineStore } from "pinia"
21
35
  import { useRouter } from 'vue-router'
22
36
 
37
+
38
+ // ·
23
39
  const translations = {
24
40
  core: {
25
41
  shared: I18n.t("core.shared")
@@ -33,6 +49,11 @@ const translations = {
33
49
  export const useBellAnnouncement = defineStore("bell.Announcement", {
34
50
  state: () => {
35
51
  return {
52
+ announcements: {
53
+ pagination: {},
54
+ records: []
55
+ },
56
+
36
57
  router: useRouter(),
37
58
  loading: false,
38
59
  users: [],
@@ -64,31 +85,22 @@ export const useBellAnnouncement = defineStore("bell.Announcement", {
64
85
  },
65
86
  actions: {
66
87
 
67
- /**
68
- * @description This action is used to add pagination to announcement index
69
- * @param {Integer} page the actual page showing in the index
70
- */
71
88
  paginate(page) {
72
- this.pagination.page = page
89
+ this.announcements.pagination.page = page
73
90
  this.fetch()
74
91
  },
75
92
 
76
- /**
77
- * @description This action is used to fetch all the announcements for the current user
78
- */
79
93
  fetch() {
80
94
  this.http.get(
81
95
  this.url.bell("announcements")
82
- .paginate(this.pagination.page)
96
+ .paginate(this.announcements.pagination.page)
83
97
  ).then(result => {
84
- this.pagination = result.pagination
85
- this.records = result.records
98
+ this.announcements = result
99
+ }).catch(error => {
100
+ console.log(error)
86
101
  })
87
102
  },
88
103
 
89
- /**
90
- * @description This action is used to create a new announcement
91
- */
92
104
  post() {
93
105
  this.loading = true
94
106
  this.http.post(this.url.bell("announcements"), {
@@ -110,9 +122,6 @@ export const useBellAnnouncement = defineStore("bell.Announcement", {
110
122
  })
111
123
  },
112
124
 
113
- /**
114
- * @description This action is used to get the list of users
115
- */
116
125
  getUsers() {
117
126
  this.loading = true
118
127
  this.http.get(this.url.admin('users/list')).then(result => {
@@ -124,9 +133,6 @@ export const useBellAnnouncement = defineStore("bell.Announcement", {
124
133
  })
125
134
  },
126
135
 
127
- /**
128
- * @description This action is used to get the list of roles
129
- */
130
136
  getRoles() {
131
137
  this.loading = true
132
138
  this.http.get(this.url.admin('roles/list')).then(result => {
@@ -137,6 +143,5 @@ export const useBellAnnouncement = defineStore("bell.Announcement", {
137
143
  this.loading = false
138
144
  })
139
145
  },
140
-
141
146
  }
142
147
  })
@@ -1,27 +1,50 @@
1
1
  /*
2
- Copyright (c) 2022, all rights reserved.
2
+ Lesli
3
3
 
4
- All the information provided by this platform is protected by international laws related to
5
- industrial property, intellectual property, copyright and relative international laws.
6
- All intellectual or industrial property rights of the code, texts, trade mark, design,
7
- pictures and any other information belongs to the owner of this platform.
4
+ Copyright (c) 2023, Lesli Technologies, S. A.
8
5
 
9
- Without the written permission of the owner, any replication, modification,
10
- transmission, publication is strictly forbidden.
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
11
10
 
12
- For more information read the license file including with this software.
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
13
15
 
14
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
15
- // ·
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see http://www.gnu.org/licenses/.
18
+
19
+ Lesli · Ruby on Rails SaaS Development Framework.
20
+
21
+ Made with ♥ by LesliTech
22
+ Building a better future, one line of code at a time.
23
+
24
+ @contact hello@lesli.tech
25
+ @website https://www.lesli.tech
26
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
27
+
28
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
+ // ·
16
30
  */
17
31
 
18
32
 
19
- // ·
33
+ // ·
20
34
  import { defineStore } from "pinia"
21
35
 
36
+
37
+ // ·
22
38
  export const useBellNotification = defineStore("bell.Notification", {
23
39
  state: () => {
24
40
  return {
41
+ index: {
42
+ loading: false,
43
+ records: [],
44
+ pagination: {}
45
+ },
46
+
47
+
25
48
  loading: false,
26
49
  users: [],
27
50
  roles: [],
@@ -42,25 +65,35 @@ export const useBellNotification = defineStore("bell.Notification", {
42
65
  }
43
66
  },
44
67
  actions: {
45
- /**
46
- * @description This action is used to add pagination to notification index
47
- * @param {Integer} page the actual page showing in the index
48
- */
68
+
49
69
  paginate(page) {
50
70
  this.pagination.page = page
51
71
  this.fetch()
52
72
  },
53
- /**
54
- * @description This action is used to fetch all notifications
55
- */
73
+
56
74
  fetch() {
57
- this.http.get(
58
- this.url.bell("notifications").paginate(this.pagination.page)
59
- ).then(result => {
60
- this.pagination = result.pagination
61
- this.records = result.records
75
+ if (this.index.records.length <= 0) {
76
+ this.get()
77
+ }
78
+ },
79
+
80
+ get() {
81
+ this.index.loading = true
82
+ let url = this.url.bell("notifications").paginate(this.pagination.page)
83
+
84
+ this.http.get(url).then(result => {
85
+ this.index.pagination = result.pagination
86
+ this.index.records = result.records
87
+ }).catch(error => {
88
+ console.log(error)
89
+ }).finally(() => {
90
+ this.index.loading = false
62
91
  })
63
92
  },
93
+
94
+
95
+
96
+
64
97
  /**
65
98
  * @description This action is used to create a new notification
66
99
  */