lesli 5.0.9 → 5.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,14 +41,14 @@ module Lesli
41
41
 
42
42
  #before_action :set_locale_public
43
43
 
44
- # def initialize
45
- # @account = {
46
- # company: {
47
- # name: Rails.application.config.lesli.dig(:account, :name)
48
- # }
49
- # }
50
- # super
51
- # end
44
+ def initialize
45
+ @lesli = {
46
+ company: {
47
+ name: Lesli.config.company[:name]
48
+ }
49
+ }
50
+ super
51
+ end
52
52
 
53
53
  end
54
54
  end
@@ -39,21 +39,21 @@ module AccountInitializer
39
39
 
40
40
  # create initial descriptors
41
41
  descriptor_owner = self.descriptors.find_or_create_by(name: "owner")
42
- descriptor_sysadmin = self.descriptors.find_or_create_by(name: "sysadmin")
42
+ descriptor_admin = self.descriptors.find_or_create_by(name: "admin")
43
43
  descriptor_profile = self.descriptors.find_or_create_by(name: "profile")
44
44
 
45
45
  # create default roles for the new account
46
46
  owner = self.roles.create({ name: "owner", active: true, object_level_permission: 2147483647 })
47
47
 
48
48
  # platform administrator role
49
- sysadmin = self.roles.create({ name: "sysadmin", active: true, object_level_permission: 100000 })
49
+ admin = self.roles.create({ name: "admin", active: true, object_level_permission: 100000 })
50
50
 
51
51
  # access only to user profile
52
52
  limited = self.roles.create({ name: "limited", active: true, object_level_permission: 10, path_default: "/administration/profile" })
53
53
 
54
54
  # assign descriptors with appropriate privileges
55
55
  owner.powers.create(:descriptor => descriptor_owner, :plist => true, :pindex => true, :pshow => true, :pcreate => true, :pupdate => true, :pdestroy => true)
56
- sysadmin.powers.create(:descriptor => descriptor_sysadmin, :plist => true, :pindex => true, :pshow => true, :pcreate => true, :pupdate => true, :pdestroy => true)
56
+ admin.powers.create(:descriptor => descriptor_admin, :plist => true, :pindex => true, :pshow => true, :pcreate => true, :pupdate => true, :pdestroy => true)
57
57
  limited.powers.create(:descriptor => descriptor_profile, :plist => true, :pindex => true, :pshow => true, :pcreate => true, :pupdate => true, :pdestroy => true)
58
58
  end
59
59
 
@@ -42,13 +42,15 @@ module Lesli
42
42
 
43
43
  validates :name, presence: true
44
44
 
45
+ after_create :initialize_descriptor_privileges
46
+
45
47
  def initialize_descriptor_privileges
46
48
 
47
49
  descriptor_operator = DescriptorPrivilegeOperator.new(self)
48
50
 
49
51
  descriptor_operator.add_profile_privileges(self) if self.name == "profile"
50
52
 
51
- descriptor_operator.add_owner_privileges(self) if ["owner", "sysadmin"].include?(self.name)
53
+ descriptor_operator.add_owner_privileges(self) if ["owner", "admin"].include?(self.name)
52
54
 
53
55
  end
54
56
  end
@@ -35,8 +35,9 @@ Building a better future, one line of code at a time.
35
35
  <!DOCTYPE html>
36
36
  <html>
37
37
  <head>
38
+ <script>const Lesli = <%= @lesli.to_json.html_safe %></script>
38
39
  <%= render partial: "lesli/partials/application-head" %>
39
- <%#= render partial: "lesli/partials/application-data" %>
40
+ <%# render partial: "lesli/partials/application-data" %>
40
41
  <%= render partial: "lesli/partials/application-public-scss" %>
41
42
  <%= yield :application_custom_assets %>
42
43
  <%# Disable back button in browser after Logout using JavaScript %>
@@ -53,6 +54,6 @@ Building a better future, one line of code at a time.
53
54
  <%#= yield :application_public_custom_header %>
54
55
  <%= yield %>
55
56
  <%= render partial: "lesli/partials/application-public-javascript" %>
56
- <%#= render partial: "lesli/partials/application-analytics" %>
57
+ <%= render partial: "lesli/partials/application-analytics" %>
57
58
  </body>
58
59
  </html>
@@ -52,6 +52,6 @@ Building a better future, one line of code at a time.
52
52
  </main>
53
53
  <%= render partial: "lesli/partials/application-lesli-javascript" %>
54
54
  <%= render partial: "lesli/partials/application-lesli-icons" %>
55
- <%#= render partial: "lesli/partials/application-analytics" %>
55
+ <%= render partial: "lesli/partials/application-analytics" %>
56
56
  </body>
57
57
  </html>
@@ -54,6 +54,6 @@ Building a better future, one line of code at a time.
54
54
  <h1>public layout</h1>
55
55
  <%#= yield %>
56
56
  <%= render partial: "lesli/partials/application-public-javascript" %>
57
- <%#= render partial: "lesli/partials/application-analytics" %>
57
+ <%= render partial: "lesli/partials/application-analytics" %>
58
58
  </body>
59
59
  </html>
@@ -32,40 +32,26 @@ Building a better future, one line of code at a time.
32
32
  =end
33
33
  %>
34
34
 
35
- <%# %>
36
- <% protected_controllers = ['confirmations2'] %>
35
+
36
+ <% protected_controllers = ["confirmations"] %>
37
37
 
38
38
  <% # Get an specific site tracking id or use the development default %>
39
- <% tracking_id = Rails.application.credentials.dig(:providers, :analytics) || '1' %>
39
+ <% tracking_id = Rails.application.credentials.dig(:providers, :analytics) || "" %>
40
40
 
41
41
  <% # check if analytics is enabled in the settings file %>
42
- <% enable_analytics = Rails.application.config.lesli.dig(:security, :enable_analytics) %>
42
+ <% enable_analytics = Lesli.config.security[:enable_analytics] %>
43
43
 
44
44
  <% if Rails.env.production? && enable_analytics %>
45
45
 
46
46
  <% if !protected_controllers.include?(controller_name) %>
47
47
 
48
- <script type="text/javascript">
49
-
50
- function loadMatomoAnalytics() {
51
- var _paq = window._paq = window._paq || [];
52
- _paq.push(['trackPageView']);
53
- _paq.push(['enableLinkTracking']);
54
- (function() {
55
- var u="https://analytics.lesli.tech/";
56
- _paq.push(['setTrackerUrl', u+'matomo.php']);
57
- _paq.push(['setSiteId', <%= tracking_id %>]);
58
- var d=document,
59
- g=d.createElement('script'),
60
- s=d.getElementsByTagName('script')[0];
61
- g.async=true;
62
- g.src=u+'matomo.js';
63
- s.parentNode.insertBefore(g,s);
64
- })();
65
- }
66
-
67
- setTimeout(() => { loadMatomoAnalytics() }, 2000);
68
-
48
+ <!-- Google tag (gtag.js) -->
49
+ <script async src="https://www.googletagmanager.com/gtag/js?id=<%= tracking_id %>"></script>
50
+ <script>
51
+ window.dataLayer = window.dataLayer || [];
52
+ function gtag(){dataLayer.push(arguments);}
53
+ gtag('js', new Date());
54
+ gtag('config', '<%= tracking_id %>');
69
55
  </script>
70
56
  <% end %>
71
57
  <% end %>
@@ -39,28 +39,34 @@ Building a better future, one line of code at a time.
39
39
  <%= "show-tickets" if defined?(LesliHelp) %>
40
40
  engine-path="<%= defined?(LesliDashboard) ? lesli_dashboard.root_path : lesli_engine(:path)%>">
41
41
 
42
+ <template v-slot:brand>
43
+ <%= customization_instance_logo_tag(logo: "app-icon", options: { alt: "App logo", class: "is-hidden-desktop" }) %>
44
+ <%= customization_instance_logo_tag(logo: "app-logo", options: { alt: "App logo", class: "is-hidden-touch" }) %>
45
+ </template>
42
46
 
43
- <%# language selector %>
44
- <% if I18n.available_locales.length > 1 %>
45
- <div class="dropdown is-hoverable header-language-selector">
46
- <div class="dropdown-trigger">
47
- <span class="icon has-text-link">
48
- <%= lesli_svg("locale-#{locale}") %>
49
- </span>
50
- </div>
51
- <div class="dropdown-menu" id="dropdown-menu-locale" role="menu">
52
- <div class="dropdown-content">
53
- <% I18n.available_locales.each do |locale| %>
54
- <% next if locale == I18n.locale %>
55
- <%= link_to language_url(locale), { :class => "dropdown-item" } do %>
56
- <span class="icon has-text-grey-light">
57
- <%= lesli_svg("locale-#{locale}") %>
58
- </span>
59
- <span><%= language_name(locale) %></span>
47
+ <template>
48
+ <%# language selector %>
49
+ <% if I18n.available_locales.length > 1 %>
50
+ <div class="dropdown is-hoverable header-language-selector">
51
+ <div class="dropdown-trigger">
52
+ <span class="icon has-text-link">
53
+ <%= lesli_svg("locale-#{locale}") %>
54
+ </span>
55
+ </div>
56
+ <div class="dropdown-menu" id="dropdown-menu-locale" role="menu">
57
+ <div class="dropdown-content">
58
+ <% I18n.available_locales.each do |locale| %>
59
+ <% next if locale == I18n.locale %>
60
+ <%= link_to language_url(locale), { :class => "dropdown-item" } do %>
61
+ <span class="icon has-text-grey-light">
62
+ <%= lesli_svg("locale-#{locale}") %>
63
+ </span>
64
+ <span><%= language_name(locale) %></span>
65
+ <% end %>
60
66
  <% end %>
61
- <% end %>
67
+ </div>
62
68
  </div>
63
69
  </div>
64
- </div>
65
- <% end %>
70
+ <% end %>
71
+ </template>
66
72
  </lesli-application-header>