lesli_admin 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +5 -0
  3. data/app/assets/config/lesli_admin_manifest.js +38 -0
  4. data/app/assets/javascripts/lesli_admin/application.js +3713 -0
  5. data/app/assets/stylesheets/lesli_admin/application.css +15 -0
  6. data/app/controllers/lesli_admin/accounts_controller.rb +125 -0
  7. data/app/controllers/lesli_admin/application_controller.rb +4 -0
  8. data/app/controllers/lesli_admin/dashboards_controller.rb +60 -0
  9. data/app/controllers/lesli_admin/users_controller.rb +244 -0
  10. data/app/helpers/lesli_admin/application_helper.rb +4 -0
  11. data/app/helpers/lesli_admin/dashboards_helper.rb +4 -0
  12. data/app/jobs/lesli_admin/application_job.rb +4 -0
  13. data/app/mailers/lesli_admin/application_mailer.rb +6 -0
  14. data/app/models/lesli_admin/account.rb +66 -0
  15. data/app/models/lesli_admin/application_record.rb +5 -0
  16. data/app/models/lesli_admin/dashboard.rb +4 -0
  17. data/app/models/lesli_admin/user.rb +4 -0
  18. data/app/services/lesli_admin/user_service.rb +300 -0
  19. data/app/views/layouts/lesli_admin/application.html.erb +15 -0
  20. data/app/views/lesli_admin/accounts/_account.html.erb +2 -0
  21. data/app/views/lesli_admin/accounts/_form.html.erb +17 -0
  22. data/app/views/lesli_admin/accounts/edit.html.erb +10 -0
  23. data/app/views/lesli_admin/accounts/index.html.erb +34 -0
  24. data/app/views/lesli_admin/accounts/new.html.erb +9 -0
  25. data/app/views/lesli_admin/accounts/show.html.erb +34 -0
  26. data/app/views/lesli_admin/dashboards/_dashboard.html.erb +2 -0
  27. data/app/views/lesli_admin/dashboards/_form.html.erb +17 -0
  28. data/app/views/lesli_admin/dashboards/edit.html.erb +10 -0
  29. data/app/views/lesli_admin/dashboards/index.html.erb +14 -0
  30. data/app/views/lesli_admin/dashboards/new.html.erb +9 -0
  31. data/app/views/lesli_admin/dashboards/show.html.erb +1 -0
  32. data/app/views/lesli_admin/partials/_engine-navigation.html.erb +52 -0
  33. data/app/views/lesli_admin/users/edit.html.erb +10 -0
  34. data/app/views/lesli_admin/users/index.html.erb +34 -0
  35. data/app/views/lesli_admin/users/new.html.erb +34 -0
  36. data/app/views/lesli_admin/users/show.html.erb +10 -0
  37. data/config/routes.rb +13 -0
  38. data/lib/lesli_admin/engine.rb +18 -0
  39. data/lib/lesli_admin/version.rb +3 -0
  40. data/lib/lesli_admin.rb +6 -0
  41. data/lib/tasks/lesli_admin_tasks.rake +4 -0
  42. data/lib/vue/application.js +153 -0
  43. data/lib/vue/apps/account/components/address-form.vue +134 -0
  44. data/lib/vue/apps/account/components/contact-form.vue +162 -0
  45. data/lib/vue/apps/account/components/form-information.vue +107 -0
  46. data/lib/vue/apps/account/show.vue +89 -0
  47. data/lib/vue/apps/dashboard/show.vue +33 -0
  48. data/lib/vue/apps/profile/components/change-email.vue +38 -0
  49. data/lib/vue/apps/profile/components/subscriptions.vue +94 -0
  50. data/lib/vue/apps/profile/show.vue +141 -0
  51. data/lib/vue/apps/users/components/information-card.vue +119 -0
  52. data/lib/vue/apps/users/components/information-form.vue +180 -0
  53. data/lib/vue/apps/users/components/integrations-information.vue +61 -0
  54. data/lib/vue/apps/users/components/management-roles.vue +109 -0
  55. data/lib/vue/apps/users/components/management-security.vue +113 -0
  56. data/lib/vue/apps/users/components/management-sessions.vue +106 -0
  57. data/lib/vue/apps/users/components/management-settings.vue +94 -0
  58. data/lib/vue/apps/users/index.vue +201 -0
  59. data/lib/vue/apps/users/new.vue +181 -0
  60. data/lib/vue/apps/users/show.vue +101 -0
  61. data/lib/vue/stores/account.js +113 -0
  62. data/lib/vue/stores/accountSettings.js +342 -0
  63. data/lib/vue/stores/descriptor.js +116 -0
  64. data/lib/vue/stores/descriptors.js +167 -0
  65. data/lib/vue/stores/integration.js +103 -0
  66. data/lib/vue/stores/role.js +243 -0
  67. data/lib/vue/stores/roles.js +89 -0
  68. data/lib/vue/stores/systemController.js +67 -0
  69. data/lib/vue/stores/user.js +319 -0
  70. data/lib/vue/stores/users.js +150 -0
  71. data/readme.md +28 -0
  72. metadata +130 -0
@@ -0,0 +1,300 @@
1
+ =begin
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 · Ruby on Rails SaaS Development Framework.
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://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ module LesliAdmin
34
+ class UserService < Lesli::ApplicationLesliService
35
+
36
+
37
+ # Return a list of users that belongs to the account of the current_user
38
+ # this list is meant to be used in selectors, autocomplets, etc
39
+ def list query=nil, params=nil
40
+ #users = current_user.account.users
41
+ users = Lesli::Account.first.users
42
+
43
+ if params[:role].present?
44
+ # add simple quotes to the roles so the sql can manage the query
45
+ roles = params[:role].split(",").map { |role| "'#{role}'" }.join(", ")
46
+ users = users.joins("
47
+ inner join (
48
+ select
49
+ ur.users_id, string_agg(r.\"name\", ', ') role_names
50
+ from user_roles ur
51
+ join roles r
52
+ on r.id = ur.role_id
53
+ and r.name in ( #{ roles } )
54
+ where ur.deleted_at is null
55
+ group by ur.users_id
56
+ ) roles on roles.users_id = users.id
57
+ ")
58
+ end
59
+
60
+ users.order(name: :asc).select(
61
+ :id,
62
+ :email,
63
+ "CONCAT_WS(' ', first_name, last_name) as name",
64
+ :alias
65
+ ).as_json
66
+ end
67
+
68
+
69
+ # @return [Array] Paginated index of users.
70
+ # @description Return a paginated array of users, used mostly in frontend views
71
+ # TODO: Implement pg_search
72
+ def index query, params
73
+
74
+ # sql string to join to user_roles and get all the roles assigned to a user
75
+ sql_string_for_user_roles = "left join (
76
+ select
77
+ ur.user_id, string_agg(r.\"name\", ', ') rolenames
78
+ from user_roles ur
79
+ join roles r
80
+ on r.id = ur.role_id
81
+ where ur.deleted_at is null
82
+ group by ur.user_id
83
+ ) roles on roles.user_id = users.id"
84
+
85
+ # sql string to joing to user_sessions and get all the active sessions of a user
86
+ sql_string_for_user_sessions = "left join (
87
+ select
88
+ max(last_used_at) as last_action_performed_at,
89
+ user_id
90
+ from user_sessions us
91
+ where us.deleted_at is null
92
+ group by(us.user_id)
93
+ ) sessions on sessions.user_id = users.id"
94
+
95
+ #users = current_user.account.users
96
+ users = Lesli::Account.first.users
97
+ #.joins(sql_string_for_user_roles)
98
+ #.joins(sql_string_for_user_sessions)
99
+ users = users.page(query[:pagination][:page])
100
+ .per(query[:pagination][:perPage])
101
+ .order("#{query[:order][:by]} #{query[:order][:dir]} NULLS LAST")
102
+
103
+ users.select(
104
+ :id,
105
+ "CONCAT(COALESCE(first_name, ''), ' ', COALESCE(last_name, '')) as name",
106
+ :email,
107
+ :active,
108
+ #:rolenames,
109
+ #Date2.new.date_time.db_column("current_sign_in_at"),
110
+ #Date2.new.date_time.db_column("last_action_performed_at")
111
+ )
112
+
113
+ end
114
+
115
+
116
+ # Creates a query that selects all user information from several tables if CloudLock is present
117
+ def show
118
+
119
+ user = resource
120
+
121
+ return {
122
+ id: user[:id],
123
+ email: user[:email],
124
+ alias: user[:alias],
125
+ active: user[:active],
126
+ full_name: user.full_name,
127
+ salutation: user[:salutation],
128
+ first_name: user[:first_name],
129
+ last_name: user[:last_name],
130
+ telephone: user[:telephone],
131
+
132
+ locale: user.settings.select(:value).find_by(:name => "locale"),
133
+
134
+ roles: user.roles.map { |r| { id: r[:id], name: r[:name], permission_level: r[:object_level_permission]} },
135
+
136
+ mfa_enabled: user.mfa_settings[:enabled],
137
+ mfa_method: user.mfa_settings[:method],
138
+
139
+ created_at: user[:created_at],
140
+ updated_at: user[:updated_at],
141
+
142
+ detail_attributes: {
143
+ title: user.detail[:title],
144
+ address: user.detail[:address],
145
+ work_city: user.detail[:work_city],
146
+ work_region: user.detail[:work_region],
147
+ work_address: user.detail[:work_address]
148
+ }
149
+ }
150
+ end
151
+
152
+ def create user_params
153
+
154
+ # check if request has an email to create the user
155
+ if user_params[:email].blank?
156
+ self.error(I18n.t("core.users.messages_danger_not_valid_email_found"))
157
+ end
158
+
159
+
160
+ # register the new user
161
+ user = User.new({
162
+ :active => true,
163
+ :email => user_params[:email],
164
+ :alias => user_params[:alias] || "",
165
+ :first_name => user_params[:first_name] || "",
166
+ :last_name => user_params[:last_name] || "",
167
+ :telephone => user_params[:telephone] || "",
168
+ #:detail_attributes => user_params[:detail_attributes] || {}
169
+ })
170
+
171
+
172
+
173
+ # assign a random password
174
+ user.password = Devise.friendly_token
175
+
176
+ # enrol user to my own account
177
+ user.account = current_user.account
178
+
179
+ # users created through the administration area does not need to confirm their accounts
180
+ # instead we send a password reset link, so they can have access to the platform
181
+ #user.confirm
182
+
183
+ if user.save
184
+
185
+ # if a role is provided to assign to the new user
186
+ # unless user_params[:roles_id].blank?
187
+ # # check if current user can work with the sent role
188
+ # if current_user.can_work_with_role?(user_params[:roles_id])
189
+ # # Search the role assigned
190
+ # role = current_user.account.roles.find_by(id: user_params[:roles_id])
191
+ # # assign role to the new user
192
+ # user.user_roles.create({ role: role })
193
+ # end
194
+ # end
195
+
196
+ # role validation - if new user does not have any role assigned
197
+ # if user.roles.blank?
198
+
199
+ # default_role_id = current_user.account.settings.find_by(:name => "default_role_id")&.value
200
+ # owner_role_id = current_user.account.roles.find_by(:name => "owner").id
201
+ # if default_role_id.present? && default_role_id != owner_role_id
202
+ # # assign default role
203
+ # user.user_roles.create({ role: current_user.account.roles.find_by(:id => default_role_id)})
204
+
205
+ # else
206
+ # # assign limited role
207
+ # user.user_roles.create({ role: current_user.account.roles.find_by(:name => "limited") })
208
+ # end
209
+ # end
210
+
211
+ # saving logs with information about the creation of the user
212
+ # user.logs.create({ title: "user_created_at", description: Date2.new.date_time.to_s })
213
+ # user.logs.create({ title: "user_created_by", description: current_user.email })
214
+ # user.logs.create({ title: "user_created_with_role", description: user.user_roles.first.role.name + " " + user.user_roles.first.role.id.to_s})
215
+ # User.log_activity_create(current_user, user)
216
+
217
+ self.resource = user
218
+
219
+ begin
220
+ # users created through the administration area does not need to confirm their accounts
221
+ # instead we send a password reset link, so they can have access to the platform
222
+ #UserMailer.with(user: user).invitation_instructions.deliver_now
223
+ rescue => exception
224
+ #Honeybadger.notify(exception)
225
+ #user.logs.create({ title: "user_creation_email_failed ", description: exception.message })
226
+ end
227
+
228
+ else
229
+ self.error(user.errors.full_messages.to_sentence)
230
+ end
231
+
232
+ self
233
+
234
+ end
235
+
236
+ def update params
237
+
238
+ old_attributes = resource.detail.attributes.merge({
239
+ active: resource.active
240
+ })
241
+
242
+ if resource.update(params)
243
+ new_attributes = resource.detail.attributes.merge({
244
+ active: resource.active
245
+ })
246
+
247
+ resource.log_activity_update(current_user, resource, old_attributes, new_attributes)
248
+ else
249
+ self.error(resource.errors.full_messages.to_sentence)
250
+ end
251
+
252
+ self
253
+ end
254
+
255
+
256
+ # force the user to change the password (at next login)
257
+ def request_password
258
+
259
+ # expire password
260
+ resource.set_password_as_expired
261
+
262
+ resource.logs.create({ title: "request_password", description: "by_user: " + current_user.email })
263
+ end
264
+
265
+
266
+ # generate a random password for the user
267
+ def password_reset
268
+
269
+ # generate random password
270
+ pass = resource.password_reset
271
+
272
+ resource.logs.create({ title: "password_reset", description: "by_user: " + current_user.email })
273
+
274
+ pass
275
+ end
276
+
277
+ def logout
278
+ # delete user active sessions
279
+ resource.sessions.destroy_all
280
+
281
+ resource.logs.create({ title: "close_sessions", description: "by_user: " + current_user.email })
282
+ end
283
+
284
+ def revoke_access
285
+
286
+ # delete user active sessions
287
+ self.logout
288
+
289
+ # add delete date to the last active session
290
+ resource.revoke_access
291
+
292
+ resource.logs.create({ title: "revoke_access", description: "by_user: " + current_user.email })
293
+ end
294
+
295
+ def find id
296
+ #super(current_user.account.users.joins(:detail).find_by(id: id))
297
+ super(current_user.account.users.find_by(id: id))
298
+ end
299
+ end
300
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Lesli admin</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag "lesli_admin/application", media: "all" %>
9
+ </head>
10
+ <body>
11
+
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1,2 @@
1
+ <div id="<%= dom_id account %>">
2
+ </div>
@@ -0,0 +1,17 @@
1
+ <%= form_with(model: account) do |form| %>
2
+ <% if account.errors.any? %>
3
+ <div style="color: red">
4
+ <h2><%= pluralize(account.errors.count, "error") %> prohibited this account from being saved:</h2>
5
+
6
+ <ul>
7
+ <% account.errors.each do |error| %>
8
+ <li><%= error.full_message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div>
15
+ <%= form.submit %>
16
+ </div>
17
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <h1>Editing account</h1>
2
+
3
+ <%= render "form", account: @account %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Show this account", @account %> |
9
+ <%= link_to "Back to accounts", accounts_path %>
10
+ </div>
@@ -0,0 +1,34 @@
1
+ <%
2
+ =begin
3
+
4
+ Lesli
5
+
6
+ Copyright (c) 2023, Lesli Technologies, S. A.
7
+
8
+ This program is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation, either version 3 of the License, or
11
+ (at your option) any later version.
12
+
13
+ This program is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with this program. If not, see http://www.gnu.org/licenses/.
20
+
21
+ Lesli · Ruby on Rails SaaS development platform.
22
+
23
+ Made with ♥ by https://www.lesli.tech
24
+ Building a better future, one line of code at a time.
25
+
26
+ @contact hello@lesli.tech
27
+ @website https://www.lesli.tech
28
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
+
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
+ // ·
32
+ =end
33
+ %>
34
+ <router-view></router-view>
@@ -0,0 +1,9 @@
1
+ <h1>New account</h1>
2
+
3
+ <%= render "form", account: @account %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Back to accounts", accounts_path %>
9
+ </div>
@@ -0,0 +1,34 @@
1
+ <%
2
+ =begin
3
+
4
+ Lesli
5
+
6
+ Copyright (c) 2023, Lesli Technologies, S. A.
7
+
8
+ This program is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation, either version 3 of the License, or
11
+ (at your option) any later version.
12
+
13
+ This program is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with this program. If not, see http://www.gnu.org/licenses/.
20
+
21
+ Lesli · Ruby on Rails SaaS development platform.
22
+
23
+ Made with ♥ by https://www.lesli.tech
24
+ Building a better future, one line of code at a time.
25
+
26
+ @contact hello@lesli.tech
27
+ @website https://www.lesli.tech
28
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
+
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
+ // ·
32
+ =end
33
+ %>
34
+ <router-view></router-view>
@@ -0,0 +1,2 @@
1
+ <div id="<%= dom_id dashboard %>">
2
+ </div>
@@ -0,0 +1,17 @@
1
+ <%= form_with(model: dashboard) do |form| %>
2
+ <% if dashboard.errors.any? %>
3
+ <div style="color: red">
4
+ <h2><%= pluralize(dashboard.errors.count, "error") %> prohibited this dashboard from being saved:</h2>
5
+
6
+ <ul>
7
+ <% dashboard.errors.each do |error| %>
8
+ <li><%= error.full_message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div>
15
+ <%= form.submit %>
16
+ </div>
17
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <h1>Editing dashboard</h1>
2
+
3
+ <%= render "form", dashboard: @dashboard %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Show this dashboard", @dashboard %> |
9
+ <%= link_to "Back to dashboards", dashboards_path %>
10
+ </div>
@@ -0,0 +1,14 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <h1>Dashboards</h1>
4
+
5
+ <div id="dashboards">
6
+ <% @dashboards.each do |dashboard| %>
7
+ <%= render dashboard %>
8
+ <p>
9
+ <%= link_to "Show this dashboard", dashboard %>
10
+ </p>
11
+ <% end %>
12
+ </div>
13
+
14
+ <%= link_to "New dashboard", new_dashboard_path %>
@@ -0,0 +1,9 @@
1
+ <h1>New dashboard</h1>
2
+
3
+ <%= render "form", dashboard: @dashboard %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Back to dashboards", dashboards_path %>
9
+ </div>
@@ -0,0 +1 @@
1
+ <router-view></router-view>
@@ -0,0 +1,52 @@
1
+ <%
2
+ =begin
3
+
4
+ Lesli
5
+
6
+ Copyright (c) 2023, Lesli Technologies, S. A.
7
+
8
+ This program is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation, either version 3 of the License, or
11
+ (at your option) any later version.
12
+
13
+ This program is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with this program. If not, see http://www.gnu.org/licenses/.
20
+
21
+ Lesli · Ruby on Rails SaaS development platform.
22
+
23
+ Made with ♥ by https://www.lesli.tech
24
+ Building a better future, one line of code at a time.
25
+
26
+ @contact hello@lesli.tech
27
+ @website https://www.lesli.tech
28
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
+
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
+ // ·
32
+ =end
33
+ %>
34
+
35
+ <%= navigation_item(lesli_admin.dashboard_path, "Dashboard", "ri-dashboard-3-line"); %>
36
+ <%= navigation_item(lesli_admin.account_path, "Account", "ri-building-4-line"); %>
37
+ <%= navigation_item(lesli_admin.users_path, "Users", "ri-user-line"); %>
38
+
39
+ <%#= navigation_item(lesli.account_path, "Localization", "ri-time-line"); %>
40
+ <%#= navigation_item(lesli.account_path, "Theming", "ri-paint-brush-line"); %>
41
+
42
+ <%#= navigation_item(lesli.account_path, I18n.t("core.shared.sidebar_nav_account"), "ri-building-4-line"); %>
43
+ <%#= navigation_item(lesli.users_path, I18n.t("core.shared.sidebar_nav_users"), "ri-user-line"); %>
44
+
45
+ <%#= navigation_item(main_app.descriptors_path, "Role descriptors", "ri-shield-check-line"); %>
46
+ <%#= navigation_item(main_app.roles_path, I18n.t("core.shared.sidebar_nav_roles_privileges"), "ri-shield-user-line"); %>
47
+
48
+ <%#= navigation_item(main_app.security_account_settings_path, I18n.t("core.account/settings.view_tab_title_security_settings"), "ri-lock-line"); %>
49
+ <%#= navigation_item(main_app.account_currencies_path, I18n.t("core.shared.sidebar_nav_currencies"), "ri-time-line"); %>
50
+ <%#= navigation_item(main_app.date_time_account_settings_path, I18n.t("core.account/settings.view_tab_title_time_settings"), "ri-time-line"); %>
51
+ <%#= navigation_item(main_app.branding_account_settings_path, I18n.t("core.account/settings.view_tab_title_branding"), "ri-image-line") %>
52
+ <%#= navigation_item(main_app.theme_account_settings_path, I18n.t("core.account/settings.view_tab_title_theme"), "ri-paint-brush-line"); %>
@@ -0,0 +1,10 @@
1
+ <h1>Editing user</h1>
2
+
3
+ <%= render "form", user: @user %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Show this user", @user %> |
9
+ <%= link_to "Back to users", users_path %>
10
+ </div>
@@ -0,0 +1,34 @@
1
+ <%
2
+ =begin
3
+
4
+ Lesli
5
+
6
+ Copyright (c) 2023, Lesli Technologies, S. A.
7
+
8
+ This program is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation, either version 3 of the License, or
11
+ (at your option) any later version.
12
+
13
+ This program is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with this program. If not, see http://www.gnu.org/licenses/.
20
+
21
+ Lesli · Ruby on Rails SaaS development platform.
22
+
23
+ Made with ♥ by https://www.lesli.tech
24
+ Building a better future, one line of code at a time.
25
+
26
+ @contact hello@lesli.tech
27
+ @website https://www.lesli.tech
28
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
+
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
+ // ·
32
+ =end
33
+ %>
34
+ <router-view></router-view>
@@ -0,0 +1,34 @@
1
+ <%
2
+ =begin
3
+
4
+ Lesli
5
+
6
+ Copyright (c) 2023, Lesli Technologies, S. A.
7
+
8
+ This program is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation, either version 3 of the License, or
11
+ (at your option) any later version.
12
+
13
+ This program is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with this program. If not, see http://www.gnu.org/licenses/.
20
+
21
+ Lesli · Ruby on Rails SaaS development platform.
22
+
23
+ Made with ♥ by https://www.lesli.tech
24
+ Building a better future, one line of code at a time.
25
+
26
+ @contact hello@lesli.tech
27
+ @website https://www.lesli.tech
28
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
+
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
+ // ·
32
+ =end
33
+ %>
34
+ <router-view></router-view>
@@ -0,0 +1,10 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <%= render @user %>
4
+
5
+ <div>
6
+ <%= link_to "Edit this user", edit_user_path(@user) %> |
7
+ <%= link_to "Back to users", users_path %>
8
+
9
+ <%= button_to "Destroy this user", @user, method: :delete %>
10
+ </div>
data/config/routes.rb ADDED
@@ -0,0 +1,13 @@
1
+ LesliAdmin::Engine.routes.draw do
2
+ root to: "dashboards#show"
3
+ resource :dashboard, only: [:show]
4
+
5
+ resource :account, only: [:show, :update]
6
+ resources :users, only: [:index, :show, :new, :update, :create, :destroy] do
7
+
8
+ # extensions to the users methods
9
+ collection do
10
+ get :list
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ module LesliAdmin
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace LesliAdmin
4
+
5
+ initializer :lesli_admin do |app|
6
+
7
+ # register assets manifest
8
+ config.assets.precompile += %w[lesli_admin_manifest.js]
9
+
10
+ # register engine migrations path
11
+ unless app.root.to_s.match root.to_s
12
+ config.paths["db/migrate"].expanded.each do |expanded_path|
13
+ app.config.paths["db/migrate"] << expanded_path
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ module LesliAdmin
2
+ VERSION = "0.1.0"
3
+ end