thecore_ui_rails_admin 2.1.4 → 2.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) 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} +2 -39
  3. data/app/assets/stylesheets/thecore_ui_rails_admin/animate.css +3458 -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 +13 -0
  6. data/app/assets/stylesheets/thecore_ui_rails_admin/common.scss +43 -0
  7. data/app/assets/stylesheets/thecore_ui_rails_admin/devise.scss +241 -0
  8. data/app/assets/stylesheets/{rails_admin/custom → thecore_ui_rails_admin}/flashing.scss +3 -3
  9. data/app/assets/stylesheets/thecore_ui_rails_admin/mixins.scss +18 -0
  10. data/app/assets/stylesheets/{rails_admin/custom/theming.scss → thecore_ui_rails_admin/thecore.scss} +60 -53
  11. data/app/assets/stylesheets/thecore_ui_rails_admin/thecore_rails_admin.scss +27 -0
  12. data/app/assets/stylesheets/{rails_admin/custom → thecore_ui_rails_admin}/togglable-sidebar.scss +4 -26
  13. data/app/controllers/pages_controller.rb +43 -0
  14. data/app/helpers/devise_bootstrap_errors_helper.rb +20 -0
  15. data/app/helpers/thecore_helper.rb +54 -0
  16. data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +1 -1
  17. data/app/views/layouts/rails_admin/_user_navigation.html.haml +2 -2
  18. data/app/views/layouts/rails_admin/application.html.haml +2 -2
  19. data/app/views/rails_admin/main/dashboard.html.haml +20 -7
  20. data/config/initializers/rails_admin.rb +32 -8
  21. data/config/initializers/thecore_concern.rb +6 -1
  22. data/config/initializers/thecore_ui_rails_admin_app_configs.rb +17 -0
  23. data/config/locales/thecore_settings.en.yml +31 -0
  24. data/config/locales/thecore_settings.it.yml +31 -0
  25. data/db/migrate/20161227101954_create_rails_admin_settings.rb +25 -0
  26. data/db/migrate/20161227101956_add_app_name.rb +5 -0
  27. data/lib/abilities/thecore_ui_rails_admin.rb +12 -0
  28. data/lib/concerns/rails_admin_requirements.rb +19 -0
  29. data/lib/concerns/thecore_rails_admin_bulk_delete_concern.rb +16 -0
  30. data/lib/concerns/thecore_rails_admin_export_concern.rb +16 -0
  31. data/lib/concerns/thecore_ui_rails_admin_permission.rb +32 -0
  32. data/lib/concerns/thecore_ui_rails_admin_role.rb +36 -0
  33. data/lib/concerns/thecore_ui_rails_admin_user.rb +75 -0
  34. data/lib/thecore_ui_rails_admin.rb +18 -3
  35. data/lib/thecore_ui_rails_admin/engine.rb +0 -7
  36. data/lib/thecore_ui_rails_admin/version.rb +1 -1
  37. metadata +112 -52
  38. data/app/assets/javascripts/rails_admin/custom/ckeditor_ajax.js.coffee +0 -7
  39. data/app/assets/javascripts/rails_admin/custom/timer.js +0 -135
  40. data/app/views/contact_mailer/contact_message.html.erb +0 -5
  41. data/app/views/devise/confirmations/new.html.erb +0 -16
  42. data/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
  43. data/app/views/devise/mailer/password_change.html.erb +0 -5
  44. data/app/views/devise/mailer/reset_password_instructions.html.erb +0 -8
  45. data/app/views/devise/mailer/unlock_instructions.html.erb +0 -7
  46. data/app/views/devise/menu/_login_items.html.erb +0 -7
  47. data/app/views/devise/passwords/edit.html.erb +0 -25
  48. data/app/views/devise/passwords/new.html.erb +0 -18
  49. data/app/views/devise/registrations/edit.html.erb +0 -45
  50. data/app/views/devise/registrations/new.html.erb +0 -29
  51. data/app/views/devise/sessions/new.html.erb +0 -28
  52. data/app/views/devise/shared/_links.html.erb +0 -25
  53. data/app/views/devise/unlocks/new.html.erb +0 -16
  54. data/app/views/home/index.html.erb +0 -5
  55. data/app/views/kaminari/_first_page.html.erb +0 -3
  56. data/app/views/kaminari/_gap.html.erb +0 -3
  57. data/app/views/kaminari/_last_page.html.erb +0 -3
  58. data/app/views/kaminari/_next_page.html.erb +0 -3
  59. data/app/views/kaminari/_page.html.erb +0 -9
  60. data/app/views/kaminari/_paginator.html.erb +0 -15
  61. data/app/views/kaminari/_prev_page.html.erb +0 -3
  62. data/app/views/layouts/_footer.html.erb +0 -3
  63. data/app/views/layouts/_messages.html.erb +0 -9
  64. data/app/views/layouts/_navigation.html.erb +0 -20
  65. data/app/views/layouts/_navigation_links.html.erb +0 -7
  66. data/app/views/layouts/mailer.html.erb +0 -6
  67. data/app/views/layouts/mailer.text.erb +0 -1
  68. data/app/views/layouts/thecore.html.erb +0 -42
  69. data/app/views/pages/contact.html.erb +0 -54
  70. data/app/views/pages/home.html.erb +0 -2
  71. data/app/views/pages/inside.html.erb +0 -4
  72. data/app/views/users/confirmations/new.html.erb +0 -16
  73. data/app/views/users/mailer/confirmation_instructions.html.erb +0 -5
  74. data/app/views/users/mailer/password_change.html.erb +0 -3
  75. data/app/views/users/mailer/reset_password_instructions.html.erb +0 -8
  76. data/app/views/users/mailer/unlock_instructions.html.erb +0 -7
  77. data/app/views/users/passwords/edit.html.erb +0 -19
  78. data/app/views/users/passwords/new.html.erb +0 -15
  79. data/app/views/users/registrations/edit.html.erb +0 -27
  80. data/app/views/users/registrations/new.html.erb +0 -17
  81. data/app/views/users/sessions/new.html.erb +0 -37
  82. data/app/views/users/shared/_links.html.erb +0 -26
  83. data/app/views/users/unlocks/new.html.erb +0 -16
@@ -0,0 +1,27 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= required _colors
14
+ *= require thecore_ui_commons/thecore
15
+ *= require rails_admin/rails_admin
16
+ *= require rails_admin_selectize/index
17
+ *= require_self
18
+ */
19
+ @import "thecore";
20
+
21
+ .box, .box p a.btn {
22
+ color: $RAtext !important;
23
+ }
24
+
25
+ .box:hover {
26
+ color: $RAhighlight;
27
+ }
@@ -84,29 +84,7 @@
84
84
  body.rails_admin .sidebar-nav {
85
85
  top: 0px;
86
86
  }
87
- // @media(min-width:768px) {
88
- // #wrapper {
89
- // padding-left: 250px;
90
- // }
91
- // #wrapper.toggled {
92
- // padding-left: 0;
93
- // }
94
- // #sidebar-wrapper {
95
- // width: 250px;
96
- // z-index: 10000;
97
- // }
98
- // #wrapper.toggled #sidebar-wrapper {
99
- // width: 0;
100
- // z-index: 10000;
101
- // }
102
- // #page-content-wrapper {
103
- // padding: 20px;
104
- // position: absolute;
105
- // z-index: 20000;
106
- // }
107
- // #wrapper.toggled #page-content-wrapper {
108
- // position: absolute;
109
- // margin-right: 0;
110
- // z-index: 20000;
111
- // }
112
- // }
87
+
88
+ .sub-menu a {
89
+ padding-left: 20px;
90
+ }
@@ -0,0 +1,43 @@
1
+ class PagesController < ApplicationController
2
+ before_action :authenticate_user!, only: [
3
+ :inside, :contact
4
+ ]
5
+
6
+ # So the static link navigation can be set runtime (yes it's an hack
7
+ # since I have to set this dynamically at runtime, using a class
8
+ # continously re-evaluated)
9
+ RailsAdmin.config do |config|
10
+ config.navigation_static_label = I18n.t('admin.links.label')
11
+ end
12
+
13
+ def home
14
+ end
15
+
16
+ def inside
17
+ end
18
+
19
+
20
+ def email
21
+ @name = params[:name]
22
+ @email = params[:email]
23
+ @message = params[:message]
24
+
25
+ if @name.blank?
26
+ flash[:alert] = "Please enter your name before sending your message. Thank you."
27
+ render :contact
28
+ elsif @email.blank? || @email.scan(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i).size < 1
29
+ flash[:alert] = "You must provide a valid email address before sending your message. Thank you."
30
+ render :contact
31
+ elsif @message.blank? || @message.length < 10
32
+ flash[:alert] = "Your message is empty. Requires at least 10 characters. Nothing to send."
33
+ render :contact
34
+ elsif @message.scan(/<a href=/).size > 0 || @message.scan(/\[url=/).size > 0 || @message.scan(/\[link=/).size > 0 || @message.scan(/http:\/\//).size > 0
35
+ flash[:alert] = "You can't send links. Thank you for your understanding."
36
+ render :contact
37
+ else
38
+ ContactMailer.contact_message(@name,@email,@message).deliver_now
39
+ redirect_to root_path, notice: "Your message was sent. Thank you."
40
+ end
41
+ end
42
+
43
+ end
@@ -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"
@@ -1,22 +1,35 @@
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.bg.bg-clear= 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.bg.bg-clear= 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
24
  - 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}"
25
+ - row_class = "box bg-clear #{"link" if index_path} #{abstract_model.param_key}_links #{abstract_model.config.label_plural}"
12
26
  .col-sm-4
13
27
  .box{class: row_class, :"data-link" => index_path}
14
28
  %i{class: "icon-bg #{abstract_model.config.navigation_icon.present? ? abstract_model.config.navigation_icon : 'file' }"}
15
29
  .text-center
16
30
  %p= capitalize_first_letter(abstract_model.config.label_plural)
17
31
  %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
32
+ %p= link_to content_tag("i", "", class: "fa fa-list-ul"), index_path, class: 'btn btn-black pjax'
20
33
 
21
34
  - if @auditing_adapter && authorized?(:history_index)
22
35
  #block-tables.block
@@ -1,14 +1,38 @@
1
1
  require 'rails_admin'
2
2
 
3
- require "thecore_actions"
4
-
5
- include TheCoreActions
6
-
7
3
  RailsAdmin.config do |config|
8
- # config.main_app_name = Proc.new { |controller|
9
- # [(Settings.app_name rescue (ENV["APP_NAME"] || "TheCore App")), "#{controller.params[:action].try(:titleize)} (#{Time.zone.now.to_s(:time)})"]
10
- # }
4
+ # Link for background Job
5
+ (config.navigation_static_links ||= {}).merge! "Background Monitor" => "#{ENV['RAILS_RELATIVE_URL_ROOT']}/app/sidekiq"
6
+
11
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
+
12
36
  config.model "ActiveStorage::Blob" do
13
37
  visible false
14
38
  end
@@ -28,7 +52,7 @@ RailsAdmin.config do |config|
28
52
 
29
53
  ## == PaperTrail ==
30
54
  # config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0
31
-
55
+ config.show_gravatar = false
32
56
  ### More at https://github.com/sferik/rails_admin/wiki/Base-configuration
33
57
  config.label_methods.unshift(:display_name)
34
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)
@@ -0,0 +1,17 @@
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 )
8
+
9
+ config.after_initialize do
10
+ RailsAdmin::Config::Actions::Export.send(:include, ExportConcern)
11
+ RailsAdmin::Config::Actions::BulkDelete.send(:include, BulkDeleteConcern)
12
+ RailsAdminSettings::Setting.send(:include, RailsAdminSettings::RailsAdminExtensionConfig)
13
+ User.send(:include, ThecoreUiRailsAdminUser)
14
+ Role.send(:include, ThecoreUiRailsAdminRole)
15
+ Permission.send(:include, ThecoreUiRailsAdminPermission)
16
+ end
17
+ end
@@ -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
@@ -0,0 +1,25 @@
1
+ class CreateRailsAdminSettings < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :rails_admin_settings do |t|
4
+ t.boolean :enabled, default: true
5
+ t.string :kind, null: false, default: 'string'
6
+ t.string :ns, default: 'main'
7
+ t.string :key, null: false
8
+ if Object.const_defined?('Geocoder')
9
+ t.float :latitude
10
+ t.float :longitude
11
+ end
12
+ t.text :raw
13
+ t.string :label
14
+ if defined?(Paperclip)
15
+ t.attachment :file
16
+ elsif defined?(CarrierWave)
17
+ t.string :file
18
+ end
19
+ t.timestamps
20
+ end
21
+
22
+ add_index :rails_admin_settings, :key
23
+ add_index :rails_admin_settings, [:ns, :key], unique: true
24
+ end
25
+ end