thecore_ui_rails_admin 2.1.5 → 2.1.12

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/javascripts/{rails_admin/custom/ui.js → thecore_ui_rails_admin/thecore_rails_admin.js} +3 -26
  3. data/app/assets/stylesheets/{animate.css → thecore_ui_rails_admin/animate.css} +0 -0
  4. data/app/assets/stylesheets/thecore_ui_rails_admin/apexcharts.scss +7 -0
  5. data/app/assets/stylesheets/thecore_ui_rails_admin/colors.scss +21 -0
  6. data/app/assets/stylesheets/thecore_ui_rails_admin/common.scss +43 -0
  7. data/app/assets/stylesheets/{devise.scss → thecore_ui_rails_admin/devise.scss} +19 -26
  8. data/app/assets/stylesheets/{rails_admin → thecore_ui_rails_admin}/flashing.scss +3 -3
  9. data/app/assets/stylesheets/{mixins.scss → thecore_ui_rails_admin/mixins.scss} +0 -0
  10. data/app/assets/stylesheets/{thecore_rails_admin.scss → thecore_ui_rails_admin/thecore.scss} +19 -7
  11. data/app/assets/stylesheets/thecore_ui_rails_admin/thecore_rails_admin.scss +290 -0
  12. data/app/assets/stylesheets/{rails_admin → thecore_ui_rails_admin}/togglable-sidebar.scss +5 -2
  13. data/app/helpers/devise_bootstrap_errors_helper.rb +20 -0
  14. data/app/helpers/thecore_helper.rb +54 -0
  15. data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +1 -1
  16. data/app/views/layouts/rails_admin/_user_navigation.html.haml +2 -2
  17. data/app/views/layouts/rails_admin/application.html.haml +2 -2
  18. data/app/views/layouts/rails_admin/pjax.html.haml +4 -1
  19. data/app/views/rails_admin/main/_card.html.haml +2 -1
  20. data/app/views/rails_admin/main/dashboard.html.haml +22 -11
  21. data/app/views/rails_admin/main/index.html.haml +19 -20
  22. data/app/views/shared/_flash.html.erb +10 -0
  23. data/config/initializers/rails_admin.rb +32 -4
  24. data/config/initializers/thecore_concern.rb +6 -1
  25. data/config/initializers/thecore_ui_rails_admin_app_configs.rb +9 -4
  26. data/config/locales/it.index_cards.custom.yml +1 -1
  27. data/config/locales/thecore_settings.en.yml +31 -0
  28. data/config/locales/thecore_settings.it.yml +31 -0
  29. data/db/migrate/20161227101954_create_rails_admin_settings.rb +25 -0
  30. data/db/migrate/20161227101956_add_app_name.rb +5 -0
  31. data/lib/abilities/thecore_ui_rails_admin.rb +12 -0
  32. data/lib/concerns/rails_admin_requirements.rb +19 -0
  33. data/lib/concerns/thecore_ui_rails_admin_permission.rb +32 -0
  34. data/lib/concerns/thecore_ui_rails_admin_role.rb +36 -0
  35. data/lib/concerns/thecore_ui_rails_admin_user.rb +58 -77
  36. data/lib/thecore_ui_rails_admin.rb +11 -1
  37. data/lib/thecore_ui_rails_admin/engine.rb +0 -7
  38. data/lib/thecore_ui_rails_admin/version.rb +1 -1
  39. metadata +66 -11
  40. data/app/assets/javascripts/rails_admin/custom/timer.js +0 -135
  41. data/app/assets/stylesheets/rails_admin/theming.scss +0 -213
@@ -32,13 +32,12 @@
32
32
  width: 100%;
33
33
  position: absolute;
34
34
  padding: 15px;
35
- background-color: rgb(59,78,89);
35
+ background-color: $background;
36
36
  min-height: 100vh;
37
37
  }
38
38
  #wrapper.toggled #page-content-wrapper {
39
39
  position: absolute;
40
40
  margin-right: -250px;
41
- background-color: rgb(59,78,89);
42
41
  }
43
42
  /* Sidebar Styles */
44
43
 
@@ -83,4 +82,8 @@
83
82
 
84
83
  body.rails_admin .sidebar-nav {
85
84
  top: 0px;
85
+ }
86
+
87
+ .sub-menu a {
88
+ padding-left: 20px;
86
89
  }
@@ -0,0 +1,20 @@
1
+ module DeviseBootstrapErrorsHelper
2
+ def devise_bootstrap_error_messages!
3
+ return '' if resource.errors.empty?
4
+
5
+ messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
6
+ sentence = I18n.t('errors.messages.not_saved',
7
+ count: resource.errors.count,
8
+ resource: resource.class.model_name.human.downcase)
9
+
10
+ html = <<-HTML
11
+ <div class="alert alert-danger alert-block devise-bs">
12
+ <button type="button" class="close" data-dismiss="alert">&times;</button>
13
+ <h5>#{sentence}</h5>
14
+ <ul>#{messages}</ul>
15
+ </div>
16
+ HTML
17
+
18
+ html.html_safe
19
+ end
20
+ end
@@ -0,0 +1,54 @@
1
+ module ThecoreHelper
2
+ def bootstrap_class_for(flash_type)
3
+ {
4
+ success: "alert-success",
5
+ error: "alert-error",
6
+ alert: "alert-danger",
7
+ notice: "alert-info"
8
+ }[flash_type.to_sym] || flash_type.to_s
9
+ end
10
+
11
+ def bootstrap_glyphs_icon(flash_type)
12
+ {
13
+ success: "glyphicon-ok",
14
+ error: "glyphicon-exclamation-sign",
15
+ alert: "glyphicon-warning-sign",
16
+ notice: "glyphicon-info-sign"
17
+ }[flash_type.to_sym] || 'glyphicon-screenshot'
18
+ end
19
+
20
+ def title(title)
21
+ content_for(:title) { title }
22
+ end
23
+
24
+ def meta_description(meta_description)
25
+ content_for(:meta_description) { meta_description }
26
+ end
27
+
28
+ def og_title(og_title)
29
+ content_for(:og_title) { og_title }
30
+ end
31
+
32
+ def og_description(og_description)
33
+ content_for(:og_description) { og_description }
34
+ end
35
+
36
+ def og_image(og_image)
37
+ content_for(:og_image) { og_image }
38
+ end
39
+
40
+ def bootstrap_class_for(flash_type)
41
+ case flash_type
42
+ when 'success'
43
+ 'alert-success'
44
+ when 'error'
45
+ 'alert-danger'
46
+ when 'alert'
47
+ 'alert-warning'
48
+ when 'notice'
49
+ 'alert-info'
50
+ else
51
+ flash_type.to_s
52
+ end
53
+ end
54
+ end
@@ -1,3 +1,3 @@
1
1
  -# %ul.sidebar-nav
2
2
  - actions(:root).each do |action|
3
- %li= link_to wording_for(:menu, action), { action: action.action_name, controller: 'rails_admin/main' }, class: action.pjax? ? "pjax" : "", style: "padding-left: 0px;"
3
+ %li= link_to wording_for(:menu, action), { action: action.action_name, controller: 'rails_admin/main' }, class: action.pjax? ? "pjax" : "", style: "padding-left: 0px;text-indent:20px"
@@ -2,6 +2,6 @@
2
2
  -# %ul.sidebar-nav
3
3
  %li.dropdown-header=t :current_user
4
4
  - if user_link = edit_user_link
5
- %li.edit_user_root_link= user_link
5
+ %li.edit_user_root_link= link_to content_tag('i', "", class: 'fa fa-user', style: 'text-indent: 0') + _current_user.email, show_path(:user, _current_user.id)
6
6
  - if logout_path.present?
7
- %li=link_to content_tag('span', t('admin.misc.log_out'), class: 'label label-danger'), logout_path, method: logout_method
7
+ %li=link_to content_tag('i', "", class: 'fa fa-unlink', style: 'text-indent: 0') + t('admin.misc.log_out'), logout_path, method: logout_method
@@ -11,8 +11,8 @@
11
11
  div.sub-menu-container li.sub-menu a.pjax { padding-left: 0px }
12
12
  div#wrapper div#sidebar-wrapper { overflow: hidden }
13
13
 
14
- = stylesheet_link_tag "rails_admin/rails_admin.css", media: :all
15
- = javascript_include_tag "rails_admin/rails_admin.js"
14
+ -# Getting all the assets needed by thecore_rails_admin from all the gems
15
+ = get_asset_tags_for("thecore_rails_admin")
16
16
 
17
17
  = favicon_link_tag 'apple-touch-icon.png', rel: 'apple-touch-icon', sizes: "180x180"
18
18
  = favicon_link_tag 'favicon-32x32.png', rel: 'icon', sizes: "32x32"
@@ -16,10 +16,13 @@
16
16
  - if @abstract_model
17
17
  = breadcrumb
18
18
  .well.well-sm
19
- %ul.nav.nav-pills
19
+ %ul.nav.nav-pills#action-menu
20
20
  = menu_for((@abstract_model ? (@object.try(:persisted?) ? :member : :collection) : :root), @abstract_model, @object)
21
21
  = content_for :contextual_tabs
22
22
  .well.well-sm
23
23
  = yield
24
24
  - else
25
25
  = yield
26
+
27
+ %script
28
+ $('.dropdown-toggle').dropdown()
@@ -1,4 +1,4 @@
1
- %div.panel.panel-success
1
+ %div.panel
2
2
  %div.panel-heading
3
3
  %ul.inline.list-inline.pull-right
4
4
  = menu_for :member, @abstract_model, object, true
@@ -6,6 +6,7 @@
6
6
  = check_box_tag "bulk_ids[]", object.id, false, id: "bulk_ids_#{object.id}"
7
7
  %a{:"data-toggle" => "collapse", href: "#object-id-#{object.id}"}
8
8
  = (object.resume rescue false || object.display_name rescue false || object.title rescue false || object.name rescue false || object.code rescue false)
9
+ %b.caret
9
10
  %div{id: "object-id-#{object.id}", class: "panel-collapse collapse"}
10
11
  %div.panel-body
11
12
  - properties.map{ |property| property.bind(:object, object) }.each do |property|
@@ -1,22 +1,33 @@
1
1
  = breadcrumb
2
- - @list_bg = ['info', 'success', 'danger', 'success', 'info', 'warning', 'danger', 'info', 'success']
2
+ - charts_high = []
3
+ - charts_medium = []
4
+ - self.methods.each do |m|
5
+ - charts_high << m if m.start_with? "charts_high_"
6
+ - charts_medium << m if m.start_with? "charts_medium_"
7
+
8
+ - charts_high.in_groups_of(2, false).each_with_index do |group, i|
9
+ .row
10
+ - group.each do |item|
11
+ .col-sm-6
12
+ .box= self.send(item)
13
+
14
+ - charts_medium.in_groups_of(3, false).each_with_index do |group, i|
15
+ .row
16
+ - group.each do |item|
17
+ .col-sm-4
18
+ .box= self.send(item)
19
+
3
20
  - if @abstract_models
4
21
  .row
5
- - index = 0
6
22
  - @abstract_models.each do |abstract_model|
7
23
  - index_path = index_path(model_name: abstract_model.to_param)
8
- - if authorized?(:index, abstract_model) && !index_path.include?("ckeditor")
9
- - if index == @list_bg.length
10
- - index = 0
11
- - row_class = "box bg-#{ @list_bg[index].to_s } #{"link" if index_path} #{abstract_model.param_key}_links #{abstract_model.config.label_plural}"
24
+ - if authorized?(:index, abstract_model)
12
25
  .col-sm-4
13
- .box{class: row_class, :"data-link" => index_path}
26
+ %a.box.pjax{href: index_path}
14
27
  %i{class: "icon-bg #{abstract_model.config.navigation_icon.present? ? abstract_model.config.navigation_icon : 'file' }"}
15
28
  .text-center
16
- %p= capitalize_first_letter(abstract_model.config.label_plural)
17
- %strong= @count[abstract_model.model.name].to_s
18
- %p= link_to t('admin.rollincode.show'), index_path, class: 'btn btn-black pjax'
19
- - index += 1
29
+ %p.model= capitalize_first_letter(abstract_model.config.label_plural)
30
+ %strong.count= @count[abstract_model.model.name].to_s
20
31
 
21
32
  - if @auditing_adapter && authorized?(:history_index)
22
33
  #block-tables.block
@@ -24,10 +24,10 @@
24
24
  = bulk_menu
25
25
  - if filterable_fields.present?
26
26
  %li.dropdown{style: 'float:right'}
27
- %a.dropdown-toggle{href: '#', :'data-toggle' => "dropdown"}
27
+ %a.dropdown-toggle#filters-menu{ :'data-toggle' => "dropdown", :'aria-haspopup'=>"true", :'aria-expanded'=>"true"}
28
28
  = t('admin.misc.add_filter')
29
29
  %b.caret
30
- %ul.dropdown-menu#filters{style: 'left:auto; right:0;'}
30
+ %ul.dropdown-menu#filters{style: 'left:auto; right:0;', :'aria-labelledby'=>"filters-menu"}
31
31
  - filterable_fields.each do |field|
32
32
  - field_options = case field.type
33
33
  - when :enum
@@ -44,27 +44,26 @@
44
44
 
45
45
  #list
46
46
  = form_tag(index_path(params.except(*%w[page f query])), method: :get, class: "pjax-form form-inline") do
47
- .well
48
- %span#filters_box{data: {options: ordered_filter_options.to_json}}
49
- %hr.filters_box{style: "display:#{ordered_filters.empty? ? 'none' : 'block'}"}
50
- .input-group
51
- %input.form-control.input-small{name: "query", type: "search", value: query, placeholder: t("admin.misc.filter")}
52
- %span.input-group-btn
53
- %button.btn.btn-primary{type: 'submit', :'data-disable-with' => '<i class="icon-white icon-refresh"></i> '.html_safe + t('admin.misc.refresh')}
54
- %i.icon-white.icon-refresh
55
- = t('admin.misc.refresh')
56
- %button#remove_filter.btn.btn-info{title: "Reset filters"}
57
- %i.icon-white.icon-remove
58
- - if export_action
59
- %span{style: 'float:right'}= link_to wording_for(:link, export_action), export_path(params.except('set').except('page')), class: 'btn btn-info'
47
+ %span#filters_box{data: {options: ordered_filter_options.to_json}}
48
+ %hr.filters_box{style: "display:#{ordered_filters.empty? ? 'none' : 'block'}"}
49
+ .input-group
50
+ %input.form-control.input-small{name: "query", type: "search", value: query, placeholder: t("admin.misc.filter")}
51
+ %span.input-group-btn
52
+ %button.btn.btn-primary{type: 'submit', :'data-disable-with' => '<i class="icon-white icon-refresh"></i> '.html_safe + t('admin.misc.refresh')}
53
+ %i.icon-white.icon-refresh
54
+ = t('admin.misc.refresh')
55
+ %button#remove_filter.btn.btn-info{title: "Reset filters"}
56
+ %i.icon-white.icon-remove
57
+ - if export_action
58
+ %span{style: 'float:right'}= link_to wording_for(:link, export_action), export_path(params.except('set').except('page')), class: 'btn btn-info'
60
59
 
61
60
  - unless @model_config.list.scopes.empty?
62
- %ul.nav.nav-tabs#scope_selector
63
- - @model_config.list.scopes.each_with_index do |scope, index|
61
+ %ul.nav.nav-tabs.nav-justified#scope_selector
62
+ - @model_config.list.scopes.each do |scope|
64
63
  - scope = '_all' if scope.nil?
65
- %li{class: "#{'active' if scope.to_s == params[:scope] || (params[:scope].blank? && index == 0)}"}
66
- %a{href: index_path(params.merge(scope: scope, page: nil)), class: 'pjax'}= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", default: I18n.t("admin.scopes.#{scope}", default: scope.to_s.titleize))
67
-
64
+ %li{ class: "#{ scope.to_s == params[:scope] || (params[:scope].nil? && scope == "_all") ? "selected" : "inactive"}"}
65
+ %a.nav-link{href: index_path(params.merge(scope: scope, page: nil)), class: 'pjax'}= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", default: I18n.t("admin.scopes.#{scope}", default: scope.to_s.titleize))
66
+
68
67
  = form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: ["form", frozen_columns ? 'ra-sidescroll' : nil], data: (frozen_columns ? {ra_sidescroll: frozen_columns} : {}) do
69
68
  = hidden_field_tag :bulk_action
70
69
  - if description.present?
@@ -0,0 +1,10 @@
1
+ <% flash.each do |type, message| %>
2
+ <%-unless [true, "true", :true].include? message%>
3
+ <div class="alert <%= bootstrap_class_for(type) %> fade in" role='alert'>
4
+ <button class="close" data-dismiss="alert">×</button>
5
+ <span class="glyphicon <%= bootstrap_glyphs_icon(type)%>" aria-hidden="true"></span>
6
+ <span class="sr-only"><%= type.capitalize%>:</span>
7
+ <%= message %>
8
+ </div>
9
+ <%-end%>
10
+ <% end %>
@@ -1,10 +1,38 @@
1
1
  require 'rails_admin'
2
2
 
3
3
  RailsAdmin.config do |config|
4
- # config.main_app_name = Proc.new { |controller|
5
- # [(Settings.app_name rescue (ENV["APP_NAME"] || "TheCore App")), "#{controller.params[:action].try(:titleize)} (#{Time.zone.now.to_s(:time)})"]
6
- # }
4
+ # Link for background Job
5
+ (config.navigation_static_links ||= {}).merge! "Background Monitor" => "#{ENV['RAILS_RELATIVE_URL_ROOT']}/app/sidekiq"
6
+
7
7
  ### Popular gems integration
8
+ config.model "RoleUser" do
9
+ visible false
10
+ end
11
+
12
+ config.model "Predicate" do
13
+ visible false
14
+ end
15
+
16
+ config.model "Target" do
17
+ visible false
18
+ end
19
+
20
+ config.model "Action" do
21
+ visible false
22
+ end
23
+
24
+ config.model "PermissionRole" do
25
+ visible false
26
+ end
27
+
28
+ config.model "Permission" do
29
+ visible false
30
+ end
31
+
32
+ config.model "ActionText::RichText" do
33
+ visible false
34
+ end
35
+
8
36
  config.model "ActiveStorage::Blob" do
9
37
  visible false
10
38
  end
@@ -24,7 +52,7 @@ RailsAdmin.config do |config|
24
52
 
25
53
  ## == PaperTrail ==
26
54
  # config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0
27
-
55
+ config.show_gravatar = false
28
56
  ### More at https://github.com/sferik/rails_admin/wiki/Base-configuration
29
57
  config.label_methods.unshift(:display_name)
30
58
 
@@ -12,7 +12,6 @@ module ThecoreConcern
12
12
  redirect_to main_app.root_url, :alert => exception.message
13
13
  end
14
14
  include HttpAcceptLanguage::AutoLocale
15
- Rails.logger.debug "Selected Locale: #{I18n.locale}"
16
15
  before_action :store_user_location!, if: :storable_location?
17
16
  before_action :configure_permitted_parameters, if: :devise_controller?
18
17
  before_action :reject_locked!, if: :devise_controller?
@@ -66,16 +65,22 @@ module ThecoreConcern
66
65
  |u| u.permit(
67
66
  :username,
68
67
  :password,
68
+ :email,
69
+ :login,
69
70
  :password_confirmation,
70
71
  :remember_me)
71
72
  }
72
73
  devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(
73
74
  :username,
74
75
  :password,
76
+ :email,
77
+ :login,
75
78
  :password_confirmation)
76
79
  }
77
80
  devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(
78
81
  :username,
82
+ :email,
83
+ :login,
79
84
  :password,
80
85
  :password_confirmation,
81
86
  :current_password)
@@ -1,12 +1,17 @@
1
1
  Rails.application.configure do
2
+ # config.assets.paths << root.join("app", "assets", "stylesheets", "thecore_ui_rails_admin")
3
+ # config.assets.paths << root.join("app", "assets", "javascripts", "thecore_ui_rails_admin")
4
+ # Login Page and pages not in RailsAdmin
5
+ config.assets.precompile += %w( thecore_ui_rails_admin/thecore.css thecore_ui_rails_admin/thecore.js )
6
+ # Pages under Rails Admin
7
+ config.assets.precompile += %w( thecore_ui_rails_admin/thecore_rails_admin.css thecore_ui_rails_admin/thecore_rails_admin.js )
2
8
 
3
- config.assets.precompile += %w( thecore_rails_admin.css )
4
-
5
- puts "ASSETS PRECOMPILE: #{config.assets.precompile.inspect}"
6
-
7
9
  config.after_initialize do
8
10
  RailsAdmin::Config::Actions::Export.send(:include, ExportConcern)
9
11
  RailsAdmin::Config::Actions::BulkDelete.send(:include, BulkDeleteConcern)
12
+ RailsAdminSettings::Setting.send(:include, RailsAdminSettings::RailsAdminExtensionConfig)
10
13
  User.send(:include, ThecoreUiRailsAdminUser)
14
+ Role.send(:include, ThecoreUiRailsAdminRole)
15
+ Permission.send(:include, ThecoreUiRailsAdminPermission)
11
16
  end
12
17
  end
@@ -14,7 +14,7 @@ it:
14
14
  scopes: ⋔
15
15
  add_filter: ⋔
16
16
  add_new: ⋔
17
- refresh: ""
17
+ refresh: Apply Filters
18
18
  bulk_menu_title: ☰✔
19
19
  select:
20
20
  toggle: ☑
@@ -0,0 +1,31 @@
1
+ en:
2
+ settings:
3
+ namespaces:
4
+ main: Main
5
+ names:
6
+ app_name: Application Name
7
+ admin:
8
+ settings:
9
+ label: Settings
10
+ phone_invalid: Invalid Telephone
11
+ phones_invalid: "Invalid Telephones: %{phones}"
12
+ email_invalid: Invalid Email
13
+ yaml_invalid: Invalid Email
14
+ color_invalid: Invalid Color
15
+ mongoid: &mongoid
16
+ models:
17
+ rails_admin_settings/setting: Configurations
18
+ attributes:
19
+ rails_admin_settings/setting:
20
+ c_at: Created
21
+ u_at: Modified
22
+ enabled: Enabled
23
+ ns: Group
24
+ name: Name
25
+ key: Key
26
+ raw: Value
27
+ type: Type
28
+ kind: Type
29
+ label: Label
30
+ activerecord:
31
+ <<: *mongoid
@@ -0,0 +1,31 @@
1
+ it:
2
+ settings:
3
+ namespaces:
4
+ main: Principale
5
+ names:
6
+ app_name: Nome dell'applicazione
7
+ admin:
8
+ settings:
9
+ label: 'Impostazioni'
10
+ phone_invalid: Telefono non valido
11
+ phones_invalid: "Telefono non valido: %{phones}"
12
+ email_invalid: Email non valida
13
+ yaml_invalid: YAML non valido
14
+ color_invalid: Colore non valido
15
+ mongoid: &mongoid
16
+ models:
17
+ rails_admin_settings/setting: Configurazioni
18
+ attributes:
19
+ rails_admin_settings/setting:
20
+ c_at: Creato
21
+ u_at: Modificato
22
+ enabled: Abilitato
23
+ ns: Gruppo
24
+ name: Nome
25
+ key: Chiave
26
+ raw: Valore
27
+ type: Tipo
28
+ kind: Tipo
29
+ label: Etichetta
30
+ activerecord:
31
+ <<: *mongoid