lesli_admin 0.3.0 → 0.4.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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/lesli_admin/application.js +284 -841
  3. data/app/controllers/lesli_admin/accounts_controller.rb +3 -5
  4. data/app/controllers/lesli_admin/dashboard/components_controller.rb +60 -0
  5. data/app/controllers/lesli_admin/dashboards_controller.rb +26 -50
  6. data/app/models/lesli_admin/account.rb +6 -0
  7. data/app/{controllers/lesli_admin/profiles_controller.rb → models/lesli_admin/dashboard/component.rb} +13 -19
  8. data/app/models/lesli_admin/dashboard.rb +58 -0
  9. data/app/services/lesli_admin/account_service.rb +39 -0
  10. data/app/views/lesli_admin/dashboards/edit.html.erb +29 -7
  11. data/app/views/lesli_admin/dashboards/index.html.erb +29 -11
  12. data/app/views/lesli_admin/dashboards/new.html.erb +29 -6
  13. data/app/views/lesli_admin/dashboards/show.html.erb +31 -0
  14. data/app/views/lesli_admin/partials/_engine-navigation.html.erb +0 -1
  15. data/config/locales/translations.en.yml +26 -0
  16. data/config/locales/translations.es.yml +26 -0
  17. data/config/routes.rb +46 -5
  18. data/db/migrate/0101050110_create_lesli_admin_dashboards.rb +51 -0
  19. data/db/migrate/0101050210_create_lesli_admin_dashboard_components.rb +53 -0
  20. data/lib/lesli_admin/engine.rb +1 -0
  21. data/lib/lesli_admin/version.rb +1 -1
  22. data/lib/vue/application.js +28 -15
  23. data/lib/vue/apps/account/components/{address-form.vue → form-address.vue} +27 -42
  24. data/lib/vue/apps/account/components/form-contact.vue +122 -0
  25. data/lib/vue/apps/account/components/form-information.vue +12 -30
  26. data/lib/vue/apps/account/show.vue +13 -12
  27. data/lib/vue/apps/{users/components/integrations-information.vue → dashboards/components/lesli-version.vue} +36 -26
  28. data/lib/vue/apps/{profile/components/change-email.vue → dashboards/show.vue} +9 -6
  29. data/lib/vue/stores/translations.json +52 -18
  30. metadata +17 -30
  31. data/app/controllers/lesli_admin/users_controller.rb +0 -238
  32. data/app/services/lesli_admin/user_service.rb +0 -265
  33. data/app/views/lesli_admin/dashboards/_dashboard.html.erb +0 -2
  34. data/app/views/lesli_admin/dashboards/_form.html.erb +0 -17
  35. data/lib/vue/apps/account/components/contact-form.vue +0 -162
  36. data/lib/vue/apps/dashboard/show.vue +0 -30
  37. data/lib/vue/apps/profile/components/subscriptions.vue +0 -94
  38. data/lib/vue/apps/profile/show.vue +0 -152
  39. data/lib/vue/apps/users/components/information-card.vue +0 -116
  40. data/lib/vue/apps/users/components/information-form.vue +0 -177
  41. data/lib/vue/apps/users/components/management-roles.vue +0 -109
  42. data/lib/vue/apps/users/components/management-security.vue +0 -113
  43. data/lib/vue/apps/users/components/management-sessions.vue +0 -106
  44. data/lib/vue/apps/users/components/management-settings.vue +0 -94
  45. data/lib/vue/apps/users/index.vue +0 -206
  46. data/lib/vue/apps/users/new.vue +0 -181
  47. data/lib/vue/apps/users/show.vue +0 -116
  48. data/lib/vue/stores/user.js +0 -331
  49. data/lib/vue/stores/users.js +0 -175
@@ -32,7 +32,7 @@ Building a better future, one line of code at a time.
32
32
 
33
33
  module LesliAdmin
34
34
  class AccountsController < ApplicationController
35
- before_action :set_account, only: %i[show edit update destroy]
35
+ before_action :set_account, only: %i[update]
36
36
 
37
37
  # GET /accounts/1
38
38
  # GET /accounts/1.json
@@ -41,7 +41,7 @@ module LesliAdmin
41
41
  format.html {}
42
42
  format.json do
43
43
  set_account
44
- respond_with_successful(@account)
44
+ respond_with_successful(AccountService.new(current_user, query).show)
45
45
  end
46
46
  end
47
47
  end
@@ -92,9 +92,7 @@ module LesliAdmin
92
92
 
93
93
  # Use callbacks to share common setup or constraints between actions.
94
94
  def set_account
95
- #@account = current_user.account
96
- @account = Account.first
97
- return respond_with_not_found unless @account
95
+ @account = current_user.account
98
96
  end
99
97
 
100
98
  # Only allow a list of trusted parameters through.
@@ -0,0 +1,60 @@
1
+ module LesliAudit
2
+ class Dashboard::ComponentsController < ApplicationController
3
+ before_action :set_dashboard_component, only: %i[ show edit update destroy ]
4
+
5
+ # GET /dashboard/components
6
+ def index
7
+ @dashboard_components = Dashboard::Component.all
8
+ end
9
+
10
+ # GET /dashboard/components/1
11
+ def show
12
+ end
13
+
14
+ # GET /dashboard/components/new
15
+ def new
16
+ @dashboard_component = Dashboard::Component.new
17
+ end
18
+
19
+ # GET /dashboard/components/1/edit
20
+ def edit
21
+ end
22
+
23
+ # POST /dashboard/components
24
+ def create
25
+ @dashboard_component = Dashboard::Component.new(dashboard_component_params)
26
+
27
+ if @dashboard_component.save
28
+ redirect_to @dashboard_component, notice: "Component was successfully created."
29
+ else
30
+ render :new, status: :unprocessable_entity
31
+ end
32
+ end
33
+
34
+ # PATCH/PUT /dashboard/components/1
35
+ def update
36
+ if @dashboard_component.update(dashboard_component_params)
37
+ redirect_to @dashboard_component, notice: "Component was successfully updated.", status: :see_other
38
+ else
39
+ render :edit, status: :unprocessable_entity
40
+ end
41
+ end
42
+
43
+ # DELETE /dashboard/components/1
44
+ def destroy
45
+ @dashboard_component.destroy
46
+ redirect_to dashboard_components_url, notice: "Component was successfully destroyed.", status: :see_other
47
+ end
48
+
49
+ private
50
+ # Use callbacks to share common setup or constraints between actions.
51
+ def set_dashboard_component
52
+ @dashboard_component = Dashboard::Component.find(params[:id])
53
+ end
54
+
55
+ # Only allow a list of trusted parameters through.
56
+ def dashboard_component_params
57
+ params.fetch(:dashboard_component, {})
58
+ end
59
+ end
60
+ end
@@ -1,60 +1,36 @@
1
- module LesliAdmin
2
- class DashboardsController < ApplicationController
3
- #before_action :set_dashboard, only: %i[ show edit update destroy ]
1
+ =begin
4
2
 
5
- # GET /dashboards
6
- def index
7
- @dashboards = Dashboard.all
8
- end
3
+ Lesli
9
4
 
10
- # GET /dashboards/1
11
- def show
12
- end
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
13
6
 
14
- # GET /dashboards/new
15
- def new
16
- @dashboard = Dashboard.new
17
- end
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.
18
11
 
19
- # GET /dashboards/1/edit
20
- def edit
21
- end
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.
22
16
 
23
- # POST /dashboards
24
- def create
25
- @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/.
26
19
 
27
- if @dashboard.save
28
- redirect_to @dashboard, notice: "Dashboard was successfully created."
29
- else
30
- render :new, status: :unprocessable_entity
31
- end
32
- end
20
+ Lesli · Ruby on Rails SaaS Development Framework.
33
21
 
34
- # PATCH/PUT /dashboards/1
35
- def update
36
- if @dashboard.update(dashboard_params)
37
- redirect_to @dashboard, notice: "Dashboard was successfully updated.", status: :see_other
38
- else
39
- render :edit, status: :unprocessable_entity
40
- end
41
- end
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
42
24
 
43
- # DELETE /dashboards/1
44
- def destroy
45
- @dashboard.destroy
46
- redirect_to dashboards_url, notice: "Dashboard was successfully destroyed.", status: :see_other
47
- end
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
48
32
 
49
- private
50
- # Use callbacks to share common setup or constraints between actions.
51
- def set_dashboard
52
- @dashboard = Dashboard.find(params[:id])
53
- end
54
-
55
- # Only allow a list of trusted parameters through.
56
- def dashboard_params
57
- params.fetch(:dashboard, {})
58
- end
59
- end
33
+ module LesliAdmin
34
+ class DashboardsController < Lesli::Shared::DashboardsController
35
+ end
60
36
  end
@@ -34,5 +34,11 @@ module LesliAdmin
34
34
  class Account < ApplicationRecord
35
35
  belongs_to :account, class_name: "Lesli::Account"
36
36
  has_many :users, class_name: "Lesli::User"
37
+
38
+ after_create :initialize_account
39
+
40
+ def initialize_account
41
+ Dashboard.initialize_account(self)
42
+ end
37
43
  end
38
44
  end
@@ -29,28 +29,22 @@ Building a better future, one line of code at a time.
29
29
  // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
30
  // ·
31
31
  =end
32
- module LesliAdmin
33
- class ProfilesController < ApplicationController
34
- before_action :set_profile, only: %i[ show ]
35
-
36
- # GET /profiles/1
37
- def show
38
- respond_to do |format|
39
- format.html
40
- format.json { respond_with_successful(@profile.show) }
41
- end
42
- end
43
32
 
44
- private
33
+ module LesliAdmin
34
+ class Dashboard::Component < ApplicationRecord
45
35
 
46
- # Use callbacks to share common setup or constraints between actions.
47
- def set_profile
48
- @profile = UserService.new(current_user, query).find(current_user.id)
49
- end
36
+ belongs_to :dashboard, inverse_of: :components
50
37
 
51
- # Only allow a list of trusted parameters through.
52
- def profile_params
53
- params.fetch(:profile, {})
38
+ def self.component_ids
39
+ ["version"]
54
40
  end
41
+ # components_ids: {
42
+ # list_new_tickets: "list_new_tickets",
43
+ # list_my_tickets: "list_my_tickets",
44
+ # list_unassigned_tickets: "list_unassigned_tickets",
45
+ # chart_tickets_by_type: "chart_tickets_by_type",
46
+ # chart_tickets_by_category: "chart_tickets_by_category",
47
+ # hours_worked: "hours_worked"
48
+ # }
55
49
  end
56
50
  end
@@ -0,0 +1,58 @@
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 Dashboard < Lesli::Shared::Dashboard
35
+ self.table_name = "lesli_admin_dashboards"
36
+ belongs_to :account
37
+
38
+ has_many :components, inverse_of: :dashboard, autosave: true, dependent: :destroy
39
+ accepts_nested_attributes_for :components, allow_destroy: true
40
+
41
+ def self.initialize_account(account)
42
+ self.create_with(
43
+ default: true,
44
+ main: false,
45
+ components_attributes: [{
46
+ name: "Lesli version",
47
+ component_id: "admin-lesli-version",
48
+ layout: 3,
49
+ query_configuration: {},
50
+ custom_configuration: {}
51
+ }]
52
+ ).find_or_create_by!(
53
+ account: account,
54
+ name: "Admin Default Dashboard"
55
+ )
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,39 @@
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 AccountService < Lesli::ApplicationLesliService
35
+ def show
36
+ current_user.account
37
+ end
38
+ end
39
+ end
@@ -1,10 +1,32 @@
1
- <h1>Editing dashboard</h1>
1
+ <%#
2
2
 
3
- <%= render "form", dashboard: @dashboard %>
3
+ Lesli
4
4
 
5
- <br>
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
6
 
7
- <div>
8
- <%= link_to "Show this dashboard", @dashboard %> |
9
- <%= link_to "Back to dashboards", dashboards_path %>
10
- </div>
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
+ %>
32
+ <router-view></router-view>
@@ -1,14 +1,32 @@
1
- <p style="color: green"><%= notice %></p>
1
+ <%#
2
2
 
3
- <h1>Dashboards</h1>
3
+ Lesli
4
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>
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
13
6
 
14
- <%= link_to "New dashboard", new_dashboard_path %>
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
+ %>
32
+ <router-view></router-view>
@@ -1,9 +1,32 @@
1
- <h1>New dashboard</h1>
1
+ <%#
2
2
 
3
- <%= render "form", dashboard: @dashboard %>
3
+ Lesli
4
4
 
5
- <br>
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
6
 
7
- <div>
8
- <%= link_to "Back to dashboards", dashboards_path %>
9
- </div>
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
+ %>
32
+ <router-view></router-view>
@@ -1 +1,32 @@
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 · 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
+ %>
1
32
  <router-view></router-view>
@@ -34,7 +34,6 @@ Building a better future, one line of code at a time.
34
34
 
35
35
  <%= navigation_item(lesli_admin.dashboard_path, "Dashboard", "ri-dashboard-3-line"); %>
36
36
  <%= navigation_item(lesli_admin.account_path, "Account", "ri-building-4-line"); %>
37
- <%= navigation_item(lesli_admin.users_path, "Users", "ri-user-line"); %>
38
37
 
39
38
  <%#= navigation_item(lesli.account_path, "Localization", "ri-time-line"); %>
40
39
  <%#= navigation_item(lesli.account_path, "Theming", "ri-paint-brush-line"); %>
@@ -1,5 +1,31 @@
1
1
  ---
2
2
  :en:
3
3
  lesli_admin:
4
+ accounts:
5
+ view_title: Account information
6
+ tab_general_information: General Information
7
+ column_company_name: Company name
8
+ column_company_name_legal: Legal name
9
+ column_city: City
10
+ column_tag_line: Slogan
11
+ column_postal_code: Postal code
12
+ column_region: Region
13
+ tab_contact: Contact
14
+ tab_address: Address
15
+ column_country: Country
16
+ column_address: Address
17
+ column_public_email: Public email
18
+ column_phone_number: Phonenumber
19
+ column_website: Website
20
+ view_subtitle_social_media: Social media
21
+ lesli:
4
22
  shared:
23
+ view_discussions: Discussions
24
+ button_add_new: Add new
25
+ button_reload: Reload
26
+ view_files: Files
27
+ view_quick_actions: Quick actions
28
+ button_list: List
5
29
  button_save: Save
30
+ button_delete: Delete
31
+ button_edit: Edit
@@ -1,5 +1,31 @@
1
1
  ---
2
2
  :es:
3
3
  lesli_admin:
4
+ accounts:
5
+ view_title: Informacion de cuenta
6
+ tab_general_information: Información General
7
+ column_company_name: Nombre de Empresa
8
+ column_company_name_legal: Razon social
9
+ column_city: Ciudad
10
+ column_tag_line: Slogan
11
+ column_postal_code: Código postal
12
+ column_region: Región
13
+ tab_contact: Contacto
14
+ tab_address: Dirección
15
+ column_country: País
16
+ column_address: Dirección
17
+ column_public_email: Email publico
18
+ column_phone_number: Teléfono
19
+ column_website: Sitio web
20
+ view_subtitle_social_media: Redes sociales
21
+ lesli:
4
22
  shared:
23
+ view_discussions: Discusiones
24
+ button_add_new: Agregar nuevo
25
+ button_reload: Recargar
26
+ view_files: Archivos
27
+ view_quick_actions: Acciones rapidas
28
+ button_list: Lista
5
29
  button_save: Guardar
30
+ button_delete: Eliminar
31
+ button_edit: Editar
data/config/routes.rb CHANGED
@@ -1,10 +1,51 @@
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
+
1
33
  LesliAdmin::Engine.routes.draw do
2
-
34
+
35
+ # Dashboard alias
3
36
  root to: "dashboards#show"
4
- resource :dashboard, only: [:show]
5
37
 
6
- resource :profile, only: [:show]
38
+ # Dashboard management
39
+ resource :dashboard, only: [:show]
40
+ resources :dashboards do
41
+ collection do
42
+ post "list" => :index
43
+ get :options
44
+ end
45
+ scope module: :dashboard do
46
+ resources :components
47
+ end
48
+ end
7
49
 
8
- resource :account, only: [:show]
9
- resources :users, only: [:index, :show, :new]
50
+ resource :account, only: [:show, :update]
10
51
  end
@@ -0,0 +1,51 @@
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
+ class CreateLesliAdminDashboards < ActiveRecord::Migration[6.1]
34
+ def change
35
+ gem_path = Lesli::System.engine("Lesli", "dir")
36
+ table_base_structure = JSON.parse(File.read(File.join(gem_path, "db", "structure", "00000501_dashboards.json")))
37
+ create_table :lesli_admin_dashboards do |t|
38
+ table_base_structure.each do |column|
39
+ t.send(
40
+ column["type"].parameterize.underscore.to_sym,
41
+ column["name"].parameterize.underscore.to_sym
42
+ )
43
+ end
44
+ t.timestamps
45
+ end
46
+
47
+ add_reference(:lesli_admin_dashboards, :account, foreign_key: { to_table: :lesli_admin_accounts })
48
+ add_reference(:lesli_admin_dashboards, :user, foreign_key: { to_table: :lesli_users })
49
+ #add_reference(:lesli_admin_dashboards, :role, foreign_key: { to_table: :roles })
50
+ end
51
+ end