lesli 5.0.18 → 5.0.20

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/lesli/application.css +1 -0
  3. data/app/controllers/lesli/abouts_controller.rb +3 -0
  4. data/app/controllers/lesli/application_controller.rb +3 -1
  5. data/app/controllers/lesli/application_lesli_controller.rb +1 -1
  6. data/app/helpers/lesli/navigation_helper.rb +6 -0
  7. data/app/interfaces/lesli/responder_interface.rb +35 -19
  8. data/app/models/concerns/account_initializer.rb +2 -3
  9. data/app/models/concerns/user_security.rb +5 -4
  10. data/app/models/lesli/role/action.rb +3 -2
  11. data/app/models/lesli/shared/dashboard.rb +2 -2
  12. data/app/models/lesli/user/session.rb +1 -1
  13. data/app/operators/lesli/role_operator.rb +9 -4
  14. data/app/services/lesli/role/action_service.rb +2 -3
  15. data/app/views/lesli/abouts/welcome.html.erb +8 -5
  16. data/app/views/lesli/apps/show.html.erb +23 -40
  17. data/app/views/lesli/errors/not_found.html.erb +32 -0
  18. data/app/views/lesli/errors/unauthorized.html.erb +48 -0
  19. data/app/views/lesli/layouts/application-lesli.html.erb +1 -2
  20. data/app/views/lesli/partials/_application-analytics.html.erb +2 -2
  21. data/app/views/lesli/partials/_application-lesli-header.html.erb +68 -65
  22. data/app/views/lesli/partials/_application-lesli-navigation.html.erb +22 -6
  23. data/config/importmap.rb +0 -10
  24. data/config/initializers/devise.rb +28 -0
  25. data/config/initializers/devise_rails_8_patch.rb +8 -0
  26. data/config/initializers/lesli.rb +27 -23
  27. data/db/migrate/v1/0000120310_create_lesli_role_privileges.rb +2 -2
  28. data/db/seed/users.rb +13 -9
  29. data/lib/generators/lesli/install/USAGE +5 -0
  30. data/lib/generators/lesli/install/install_generator.rb +49 -0
  31. data/lib/generators/lesli/install/templates/lesli.rb +6 -0
  32. data/lib/lesli/engine.rb +2 -14
  33. data/lib/lesli/routing.rb +8 -14
  34. data/lib/lesli/version.rb +2 -2
  35. data/lib/rspec/testers/request.rb +15 -6
  36. data/lib/scss/_apps.scss +93 -0
  37. data/lib/scss/application.scss +34 -0
  38. data/lib/tasks/lesli/db.rake +6 -6
  39. data/lib/tasks/lesli_tasks.rake +3 -0
  40. data/readme.md +11 -21
  41. metadata +48 -8
@@ -30,92 +30,95 @@ Building a better future, one line of code at a time.
30
30
  // ·
31
31
  %>
32
32
 
33
- <%# check if custom navigation partial exists, getting the path from application helper %>
34
- <% custom_navigation_path = "partials/application-lesli-header" %>
33
+ <%# Get the navigation partial for every engine %>
34
+ <% engine_navigation_partial = navigation_partial %>
35
35
 
36
- <%# validate the path to be sure the partial exists when trying to render it %>
37
- <% custom_navigation_exists = lookup_context.exists?(custom_navigation_path, nil, true) %>
38
-
39
- <%# render navigation partial %>
40
- <% if custom_navigation_exists %>
41
-
42
- <%= render partial: custom_navigation_path %>
43
-
44
- <% else %>
45
36
  <header class="lesli-application-header">
46
- <nav class="lesli-navbar navbar unresponsive" role="navigation" aria-label="main navigation">
47
- <div class="container">
37
+ <div class="container" x-data="{ navActive: false }">
38
+ <nav class="navbar" role="navigation" aria-label="main navigation">
48
39
  <div class="navbar-brand">
49
- <a href="<%= defined?(LesliDashboard) ? '/dashboard' : '/' %>" class="application-navbar-brand">
40
+ <a
41
+ class="navbar-item p-0"
42
+ href="<%= defined?(LesliDashboard) ? '/dashboard' : '/' %>">
50
43
  <%= customization_instance_logo_tag(logo: "app-logo", options: { alt: "Lesli app logo" }) %>
51
44
  </a>
52
- <a class="navbar-burger" role="button" aria-label="menu" aria-expanded="false">
45
+ <a
46
+ class="navbar-burger"
47
+ role="button"
48
+ aria-label="menu"
49
+ aria-expanded="false"
50
+ @click="navActive = !navActive"
51
+ :class="{ 'is-active': navActive }">
52
+ <span aria-hidden="true"></span>
53
53
  <span aria-hidden="true"></span>
54
54
  <span aria-hidden="true"></span>
55
55
  <span aria-hidden="true"></span>
56
56
  </a>
57
57
  </div>
58
- <div class="navbar-menu">
59
- <div class="navbar-start">
60
- </div>
61
- <div class="navbar-end">
58
+ <div class="navbar-menu" :class="{ 'is-active': navActive }">
59
+ <div class="navbar-end is-flex is-justify-content-center">
62
60
 
61
+ <!-- tickets -->
63
62
  <div class="navbar-item">
64
- <div class="header-icons field is-grouped is-justify-content-center">
65
- <div class="control">
66
-
67
- <!-- tasks -->
68
- <% if defined?(LesliFocus) %>
69
- <a v-if="props.showFocus" class="header-indicator"
70
- @click="() => { storeLayout.showSuppor = true }">
71
- <span class="ri-list-check-3">
72
- </span>
73
- <span class="count" v-if="storeLayout.header.support > 0">
74
- </span>
75
- </a>
76
- <% end %>
77
-
78
- <!-- tickets -->
79
- <% if defined?(LesliSupport) %>
80
- <%= link_to(
81
- lesli_support.tickets_path,
82
- :class => "header-indicator",
83
- :data => { turbo_frame: '_top' }) do %>
84
- <span class="ri-ticket-2-line"></span>
85
- <% if @lesli[:tickets] > 0 %>
86
- <span class="count"></span>
87
- <% end %>
88
- <% end %>
63
+ <% if defined?(LesliSupport) %>
64
+ <%= link_to(
65
+ lesli_support.tickets_path,
66
+ :class => "header-indicator",
67
+ :data => { turbo_frame: '_top' }) do %>
68
+ <span class="ri-ticket-2-line"></span>
69
+ <% if @lesli[:tickets] > 0 %>
70
+ <span class="count"></span>
89
71
  <% end %>
72
+ <% end %>
73
+ <% end %>
74
+ </div>
90
75
 
91
- <!-- notifications -->
92
- <% if defined?(LesliBell) %>
93
- <%= link_to(
94
- lesli_bell.notifications_path,
95
- :class => "header-indicator",
96
- :data => { turbo_frame: '_top' }) do %>
97
- <% if @lesli[:notifications] > 0 %>
98
- <span class="ri-notification-3-fill has-text-primary"></span>
99
- <% else %>
100
- <span class="ri-notification-3-line"></span>
101
- <% end %>
102
- <% end %>
76
+ <!-- notifications -->
77
+ <div class="navbar-item">
78
+ <% if defined?(LesliBell) %>
79
+ <%= link_to(
80
+ lesli_bell.notifications_path,
81
+ :class => "header-indicator",
82
+ :data => { turbo_frame: '_top' }) do %>
83
+ <% if @lesli[:notifications] > 0 %>
84
+ <span class="ri-notification-3-fill has-text-primary"></span>
85
+ <% else %>
86
+ <span class="ri-notification-3-line"></span>
103
87
  <% end %>
88
+ <% end %>
89
+ <% end %>
90
+ </div>
104
91
 
105
- <!-- module selector -->
106
- <%= navigation_link(lesli.apps_path, nil, "ri-apps-2-line") %>
92
+ <!-- app selector -->
93
+ <div class="navbar-item">
94
+ <%= navigation_link(lesli.apps_path, nil, "ri-apps-2-line") %>
95
+ </div>
107
96
 
108
- <!-- user profile -->
109
- <%= navigation_link(lesli.apps_path, nil, "ri-user-smile-line") %>
97
+ <!-- user profile -->
98
+ <div class="navbar-item">
99
+ <%= navigation_link(lesli.apps_path, nil, "ri-user-smile-line") %>
100
+ </div>
110
101
 
111
- <!-- logout from session -->
112
- <%= navigation_link(main_app.destroy_user_session_path, nil, "ri-logout-circle-r-line") if defined?(LesliShield) %>
113
- </div>
114
- </div>
102
+ <!-- logout from session -->
103
+ <div class="navbar-item">
104
+ <%= navigation_link(main_app.destroy_user_session_path, nil, "ri-logout-circle-r-line") if defined?(LesliShield) %>
115
105
  </div>
116
106
  </div>
107
+ <div class="navbar-end is-hidden-desktop">
108
+ <%= render(engine_navigation_partial) if engine_navigation_partial %>
109
+ </div>
110
+ </div>
111
+ </nav>
112
+ </div>
113
+ </header>
114
+
115
+ <%# Build the engine navigation %>
116
+ <% if engine_navigation_partial %>
117
+ <nav class="navbar lesli-application-navigation is-hidden-touch">
118
+ <div class="navbar-menu">
119
+ <div class="navbar-start is-flex-grow-1 is-justify-content-center">
120
+ <%= render(engine_navigation_partial) %>
117
121
  </div>
118
122
  </div>
119
123
  </nav>
120
- </header>
121
124
  <% end %>
@@ -48,12 +48,28 @@ Building a better future, one line of code at a time.
48
48
 
49
49
  <%# render navigation partial %>
50
50
  <% if custom_sidebar_exists %>
51
- <nav class="lesli-navbar navbar lesli-application-navigation" role="navigation" aria-label="main navigation">
52
- <div class="container">
53
- <div class="navbar-menu">
54
- <div class="navbar-end">
55
- <%= render partial: custom_sidebar_path %>
56
- </div>
51
+ <nav
52
+ class="navbar lesli-application-navigation"
53
+ role="navigation"
54
+ aria-label="main navigation"
55
+ x-data="{ navActive: false }">
56
+ <div class="navbar-brand">
57
+ <a
58
+ class="navbar-burger"
59
+ role="button"
60
+ aria-label="menu"
61
+ aria-expanded="false"
62
+ @click="navActive = !navActive"
63
+ :class="{ 'is-active': navActive }">
64
+ <span aria-hidden="true"></span>
65
+ <span aria-hidden="true"></span>
66
+ <span aria-hidden="true"></span>
67
+ <span aria-hidden="true"></span>
68
+ </a>
69
+ </div>
70
+ <div class="navbar-menu" :class="{ 'is-active': navActive }">
71
+ <div class="navbar-start is-flex-grow-1 is-justify-content-center">
72
+ <%= render partial: custom_sidebar_path %>
57
73
  </div>
58
74
  </div>
59
75
  </nav>
data/config/importmap.rb CHANGED
@@ -2,13 +2,3 @@
2
2
 
3
3
  pin "application", to: "lesli/application.js", preload: true
4
4
  pin "@hotwired/turbo-rails", to: "turbo.min.js"
5
-
6
-
7
-
8
- #pin "chart.js", to: "https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.1/chart.umd.js"
9
- #pin "chart.js", to: "https://ga.jspm.io/npm:chart.js@4.5.1/dist/chart.esm.js"
10
-
11
-
12
-
13
- # my_engine/config/importmap.rb
14
- #pin_all_from File.expand_path("../app/assets/javascripts", __dir__)
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ Devise.setup do |config|
4
+
5
+ # config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
6
+
7
+ require 'devise/orm/active_record'
8
+
9
+ # config.case_insensitive_keys = [:email]
10
+
11
+ # config.strip_whitespace_keys = [:email]
12
+
13
+ # config.skip_session_storage = [:http_auth]
14
+
15
+ # config.stretches = Rails.env.test? ? 1 : 12
16
+
17
+ # config.reconfirmable = true
18
+
19
+ # config.expire_all_remember_me_on_sign_out = true
20
+
21
+ # config.password_length = 6..128
22
+
23
+ # config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
24
+
25
+ # config.reset_password_within = 6.hours
26
+
27
+ # config.sign_out_via = :delete
28
+ end
@@ -0,0 +1,8 @@
1
+ require 'devise'
2
+
3
+ module Devise
4
+ def self.mappings
5
+ Rails.application.try(:reload_routes_unless_loaded)
6
+ @@mappings
7
+ end
8
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Lesli
4
4
 
5
- Copyright (c) 2023, Lesli Technologies, S. A.
5
+ Copyright (c) 2025, Lesli Technologies, S. A.
6
6
 
7
7
  This program is free software: you can redistribute it and/or modify
8
8
  it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
19
19
 
20
20
  Lesli · Ruby on Rails SaaS Development Framework.
21
21
 
22
- Made with ♥ by https://www.lesli.tech
22
+ Made with ♥ by LesliTech
23
23
  Building a better future, one line of code at a time.
24
24
 
25
25
  @contact hello@lesli.tech
@@ -33,7 +33,7 @@ Building a better future, one line of code at a time.
33
33
  Lesli.configure do |config|
34
34
 
35
35
 
36
- # Start Lesli as demo
36
+ # Enable or disable demo mode.
37
37
  config.demo = false
38
38
 
39
39
 
@@ -41,7 +41,7 @@ Lesli.configure do |config|
41
41
  config.instance = "Lesli"
42
42
 
43
43
 
44
- # Information about the main account in the platform
44
+ # Provides organization details displayed throughout the system.
45
45
  config.company = {
46
46
  name: "Lesli",
47
47
  email: "hello@lesli.tech",
@@ -49,26 +49,26 @@ Lesli.configure do |config|
49
49
  }
50
50
 
51
51
 
52
- # Available languages globally (Requires LesliBabel)
52
+ # List of supported languages (requires `LesliBabel`).
53
53
  config.locales = {
54
54
  :en => "English", # English
55
- :de => "Deutsch", # Deutsch/German
56
- # :pl => "Polski", # Polski/Polish/Poland
57
- # :nl => "Dutch", # Dutch/Nederlands/Netherlands
55
+ :de => "Deutsch", # Deutsch/German
56
+ :pl => "Polski", # Polski/Polish/Poland
57
+ :nl => "Dutch", # Dutch/Nederlands/Netherlands
58
58
  :es => "Español", # Español/Spanish
59
- # :uk => "украї́нська", # украї́нська/Ukrainian
60
- # :sr => "Српски", # Српски/Srpski/Serbian
61
- :it => "Italiano", # Italiano/Italian
62
- # :hr => "Hrvatski", # Hrvatski/Croatian
63
- #:fr => "Français", # French
64
- #:pt => "Português", # Portuguese
65
- # :tr => "Türkçe", # Turkish
66
- # :ro => "Română", # Romanian
67
- # :bg => "български" # Bulgarian
59
+ :uk => "украї́нська", # украї́нська/Ukrainian
60
+ :sr => "Српски", # Српски/Srpski/Serbian
61
+ :it => "Italiano", # Italiano/Italian
62
+ :hr => "Hrvatski", # Hrvatski/Croatian
63
+ :fr => "Français", # French
64
+ :pt => "Português", # Portuguese
65
+ :tr => "Türkçe", # Turkish
66
+ :ro => "Română", # Romanian
67
+ :bg => "български" # Bulgarian
68
68
  }
69
69
 
70
70
 
71
- # Time localization
71
+ # Define time zone, week start day, and custom date/time formats.
72
72
  config.datetime = {
73
73
  :time_zone => "America/Guatemala",
74
74
  :start_week_on => "monday",
@@ -84,9 +84,9 @@ Lesli.configure do |config|
84
84
  }
85
85
 
86
86
 
87
- # Instance security settings
87
+ # Customize system-wide security behavior.
88
88
  config.security = {
89
- password: "Test123!",
89
+ password: "Test123!", # Default password for development, test & demo environments
90
90
  enable_debug: false,
91
91
  enable_becoming: false,
92
92
  enable_analytics: true,
@@ -97,7 +97,7 @@ Lesli.configure do |config|
97
97
  }
98
98
 
99
99
 
100
- # Main color palette for Lesli
100
+ # Customize the color palette and layout.
101
101
  config.theme = {
102
102
  color_primary: "#193d8d",
103
103
  color_sidebar: "#ffffff",
@@ -110,15 +110,19 @@ Lesli.configure do |config|
110
110
 
111
111
  #
112
112
  config.layout = {
113
- locale: false
113
+ tasks: true,
114
+ babel: false,
115
+ profile: true,
116
+ notifications: true
114
117
  }
115
118
 
116
119
 
117
- #
120
+ # Specify default paths for email templates.
118
121
  config.mailer = {
119
122
  templates: "lesli_mailer/emails/lesli"
120
123
  }
121
124
 
125
+ # Control redirection paths after login.
122
126
  config.path_after_login = "/"
123
127
  config.path_after_login = "/dashboard" if defined?(LesliDashboard)
124
128
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Lesli
4
4
 
5
- Copyright (c) 2023, Lesli Technologies, S. A.
5
+ Copyright (c) 2025, Lesli Technologies, S. A.
6
6
 
7
7
  This program is free software: you can redistribute it and/or modify
8
8
  it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
19
19
 
20
20
  Lesli · Ruby on Rails SaaS Development Framework.
21
21
 
22
- Made with ♥ by https://www.lesli.tech
22
+ Made with ♥ by LesliTech
23
23
  Building a better future, one line of code at a time.
24
24
 
25
25
  @contact hello@lesli.tech
data/db/seed/users.rb CHANGED
@@ -46,17 +46,21 @@ emailadmin = "admin@#{email_domain}"
46
46
  emailguest = "guest@#{email_domain}"
47
47
 
48
48
 
49
- # build a random password for the owner, admin and guest users
50
- passowner = Devise.friendly_token(40)
51
- passadmin = Devise.friendly_token(40)
52
- passguest = Devise.friendly_token(40)
49
+ # Use the default password for development
50
+ passowner = Lesli.config.security.dig(:password)
51
+ passadmin = passowner
52
+ passguest = passowner
53
53
 
54
54
 
55
- if Rails.env.development? || Rails.env.test? || Lesli.config.demo
56
- passowner = Lesli.config.security.dig(:password)
57
- passadmin = passowner
58
- passguest = passowner
59
- end
55
+ # build a random password for the owner, admin and guest users
56
+ # only for production and only when LesliShield is installed and
57
+ # only if the "demo mode" is not active in the
58
+ # config/initializers/lesli.rb file
59
+ if Rails.env.production? && defined?(LesliShield) && !Lesli.config.demo
60
+ passowner = LesliShield::Tokens.friendly_token
61
+ passadmin = LesliShield::Tokens.friendly_token
62
+ passguest = LesliShield::Tokens.friendly_token
63
+ end
60
64
 
61
65
 
62
66
  # create the owner user for the account,
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Adds Lesli route to routes.rb and creates a default initializer.
3
+
4
+ Example:
5
+ rails generate lesli:install
@@ -0,0 +1,49 @@
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
+
33
+ module Lesli
34
+ module Generators
35
+ class InstallGenerator < Rails::Generators::Base
36
+ source_root File.expand_path("templates", __dir__)
37
+
38
+ desc "Adds Lesli route and initializer"
39
+
40
+ def add_route_to_routes_file
41
+ route "Lesli::Routing.mount"
42
+ end
43
+
44
+ def create_initializer_file
45
+ template "lesli.rb", "config/initializers/lesli.rb"
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Configuration for Lesli Framework
4
+ Lesli.configure do |config|
5
+ config.demo = false
6
+ end
data/lib/lesli/engine.rb CHANGED
@@ -39,6 +39,8 @@ require "L2"
39
39
  require "useragent"
40
40
  require "acts_as_paranoid"
41
41
 
42
+ require "devise"
43
+
42
44
  require "lesli_date"
43
45
  require "lesli_view"
44
46
  require "lesli_assets"
@@ -91,23 +93,9 @@ module Lesli
91
93
  # Lesli Framework Mailer configuration
92
94
 
93
95
 
94
- # Development mailer by default
95
- config.action_mailer.delivery_method ||= :letter_opener
96
-
97
96
  # Add the Lesli root folder for email development tempaltes
98
97
  config.action_mailer.preview_paths << root.join("lib", "mailer_previews")
99
98
 
100
- #
101
- config.action_mailer.default_options ||= {
102
-
103
- # Use the main email in the lesli settings as email sender
104
- from: Lesli.config.company.dig(:email)
105
- }
106
-
107
- # Mailer url options for development
108
- config.action_mailer.default_url_options ||= {
109
- host: "http://0.0.0.0:3000"
110
- }
111
99
 
112
100
  # Does not work too well
113
101
  # if Lesli.config.security.dig(:enable_debug)
data/lib/lesli/routing.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Lesli
4
4
 
5
- Copyright (c) 2023, Lesli Technologies, S. A.
5
+ Copyright (c) 2025, Lesli Technologies, S. A.
6
6
 
7
7
  This program is free software: you can redistribute it and/or modify
8
8
  it under the terms of the GNU General Public License as published by
@@ -66,8 +66,7 @@ module Lesli
66
66
  end
67
67
  end
68
68
 
69
- def self.mount_dashboard_for lesli_engine
70
-
69
+ def self.mount_routes_for lesli_engine
71
70
  lesli_engine::Engine.routes.draw do
72
71
 
73
72
  # Dashboard alias
@@ -76,18 +75,13 @@ module Lesli
76
75
  # Dashboard management
77
76
  resource :dashboard, only: [:show, :edit]
78
77
 
79
- # uncomment this to enable multiple dashboards
80
- #resources :dashboards, only: [:show, :edit]
81
- # resources :dashboards do
82
- # collection do
83
- # post "list" => :index
84
- # get :options
85
- # end
86
- # scope module: :dashboard do
87
- # resources :components
88
- # end
89
- # end
78
+ #
79
+ get "up" => "/rails/health#show"
90
80
  end
91
81
  end
82
+
83
+ def self.mount_dashboard_for lesli_engine
84
+ self.mount_routes_for(lesli_engine)
85
+ end
92
86
  end
93
87
  end
data/lib/lesli/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Lesli
2
- VERSION = "5.0.18"
3
- BUILD = "1752157715"
2
+ VERSION = "5.0.20"
3
+ BUILD = "1754023334"
4
4
  end
@@ -36,12 +36,21 @@ require Lesli::Engine.root.join("lib/rspec/helpers/rails_helper")
36
36
  require Lesli::Engine.root.join("lib/rspec/helpers/lesli_helper")
37
37
  require Lesli::Engine.root.join("lib/rspec/helpers/response_request_helper")
38
38
 
39
- # ·
40
- LESLI_ENGINE_MOUNTED_PATH = Lesli::Engine.routes.find_script_name({}) if defined?(Lesli)
41
- LESLI_ADMIN_ENGINE_MOUNTED_PATH = LesliAdmin::Engine.routes.find_script_name({}) if defined?(LesliAdmin)
42
- LESLI_BABEL_ENGINE_MOUNTED_PATH = LesliBabel::Engine.routes.find_script_name({}) if defined?(LesliBabel)
43
- LESLI_CALENDAR_ENGINE_MOUNTED_PATH = LesliCalendar::Engine.routes.find_script_name({}) if defined?(LesliCalendar)
44
- LESLI_DASHBOARD_ENGINE_MOUNTED_PATH = LesliDashboard::Engine.routes.find_script_name({}) if defined?(LesliDashboard)
39
+
40
+ # · Dynamically build a path where the engine is mounted
41
+ def build_engine_path(engine_name, path)
42
+
43
+ # get the engine information
44
+ engine = LesliSystem.engine(engine_name)
45
+
46
+ # return the path if no engine found
47
+ return path unless engine
48
+
49
+ engine_constant = engine[:name].constantize
50
+
51
+ # build the path inside the engine mounted path
52
+ "#{engine_constant::Engine.routes.find_script_name({})}/#{path}"
53
+ end
45
54
 
46
55
 
47
56
  # · Authentication context