thecore_ui_rails_admin 2.1.3 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/rails_admin/custom/ckeditor_ajax.js.coffee +7 -0
  3. data/app/assets/javascripts/rails_admin/custom/timer.js +135 -0
  4. data/app/assets/javascripts/rails_admin/custom/ui.js +115 -0
  5. data/app/assets/javascripts/rails_admin/ra.widgets.coffee +233 -0
  6. data/app/assets/stylesheets/rails_admin/custom/flashing.scss +28 -0
  7. data/app/assets/stylesheets/rails_admin/custom/theming.scss +199 -0
  8. data/app/assets/stylesheets/rails_admin/custom/togglable-sidebar.scss +112 -0
  9. data/app/views/contact_mailer/contact_message.html.erb +5 -0
  10. data/app/views/devise/confirmations/new.html.erb +16 -0
  11. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  12. data/app/views/devise/mailer/password_change.html.erb +5 -0
  13. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  14. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  15. data/app/views/devise/menu/_login_items.html.erb +7 -0
  16. data/app/views/devise/passwords/edit.html.erb +25 -0
  17. data/app/views/devise/passwords/new.html.erb +18 -0
  18. data/app/views/devise/registrations/edit.html.erb +45 -0
  19. data/app/views/devise/registrations/new.html.erb +29 -0
  20. data/app/views/devise/sessions/new.html.erb +28 -0
  21. data/app/views/devise/shared/_links.html.erb +25 -0
  22. data/app/views/devise/unlocks/new.html.erb +16 -0
  23. data/app/views/home/index.html.erb +5 -0
  24. data/app/views/kaminari/_first_page.html.erb +3 -0
  25. data/app/views/kaminari/_gap.html.erb +3 -0
  26. data/app/views/kaminari/_last_page.html.erb +3 -0
  27. data/app/views/kaminari/_next_page.html.erb +3 -0
  28. data/app/views/kaminari/_page.html.erb +9 -0
  29. data/app/views/kaminari/_paginator.html.erb +15 -0
  30. data/app/views/kaminari/_prev_page.html.erb +3 -0
  31. data/app/views/layouts/_footer.html.erb +3 -0
  32. data/app/views/layouts/_messages.html.erb +9 -0
  33. data/app/views/layouts/_navigation.html.erb +20 -0
  34. data/app/views/layouts/_navigation_links.html.erb +7 -0
  35. data/app/views/layouts/mailer.html.erb +6 -0
  36. data/app/views/layouts/mailer.text.erb +1 -0
  37. data/app/views/layouts/rails_admin/_navigation.html.haml +13 -0
  38. data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +3 -0
  39. data/app/views/layouts/rails_admin/_sidebar_navigation.html.haml +4 -0
  40. data/app/views/layouts/rails_admin/_user_navigation.html.haml +7 -0
  41. data/app/views/layouts/rails_admin/application.html.haml +59 -0
  42. data/app/views/layouts/rails_admin/pjax.html.haml +25 -0
  43. data/app/views/layouts/thecore.html.erb +42 -0
  44. data/app/views/pages/contact.html.erb +54 -0
  45. data/app/views/pages/home.html.erb +2 -0
  46. data/app/views/pages/inside.html.erb +4 -0
  47. data/app/views/rails_admin/main/_card.html.haml +17 -0
  48. data/app/views/rails_admin/main/_modal_interaction.html.erb +53 -0
  49. data/app/views/rails_admin/main/dashboard.html.haml +25 -0
  50. data/app/views/rails_admin/main/index.html.haml +90 -0
  51. data/app/views/shared/_flash.html.erb +10 -0
  52. data/app/views/users/confirmations/new.html.erb +16 -0
  53. data/app/views/users/mailer/confirmation_instructions.html.erb +5 -0
  54. data/app/views/users/mailer/password_change.html.erb +3 -0
  55. data/app/views/users/mailer/reset_password_instructions.html.erb +8 -0
  56. data/app/views/users/mailer/unlock_instructions.html.erb +7 -0
  57. data/app/views/users/passwords/edit.html.erb +19 -0
  58. data/app/views/users/passwords/new.html.erb +15 -0
  59. data/app/views/users/registrations/edit.html.erb +27 -0
  60. data/app/views/users/registrations/new.html.erb +17 -0
  61. data/app/views/users/sessions/new.html.erb +37 -0
  62. data/app/views/users/shared/_links.html.erb +26 -0
  63. data/app/views/users/unlocks/new.html.erb +16 -0
  64. data/config/initializers/rails_admin.rb +49 -0
  65. data/config/initializers/thecore_concern.rb +125 -0
  66. data/config/locales/en.index_cards.custom.yml +8 -0
  67. data/config/locales/en.main.yml +27 -0
  68. data/config/locales/en.rails_admin.yml +34 -0
  69. data/config/locales/en.rollincode.yml +5 -0
  70. data/config/locales/it.index_cards.custom.yml +20 -0
  71. data/config/locales/it.main.yml +27 -0
  72. data/config/locales/it.rails_admin.yml +4 -0
  73. data/config/locales/it.rollincode.yml +5 -0
  74. data/config/routes.rb +10 -0
  75. data/lib/thecore_ui_rails_admin.rb +3 -0
  76. data/lib/thecore_ui_rails_admin/engine.rb +7 -0
  77. data/lib/thecore_ui_rails_admin/version.rb +1 -1
  78. metadata +88 -2
@@ -0,0 +1,125 @@
1
+ require 'active_support/concern'
2
+
3
+ module ThecoreConcern
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ # Prevent CSRF attacks by raising an exception.
8
+ # For APIs, you may want to use :null_session instead.
9
+ layout 'thecore'
10
+ protect_from_forgery with: :exception, prepend: true
11
+ rescue_from CanCan::AccessDenied do |exception|
12
+ redirect_to main_app.root_url, :alert => exception.message
13
+ end
14
+ include HttpAcceptLanguage::AutoLocale
15
+ Rails.logger.debug "Selected Locale: #{I18n.locale}"
16
+ before_action :store_user_location!, if: :storable_location?
17
+ before_action :configure_permitted_parameters, if: :devise_controller?
18
+ before_action :reject_locked!, if: :devise_controller?
19
+
20
+ helper_method :reject_locked!
21
+ helper_method :require_admin!
22
+ helper_method :line_break
23
+ helper_method :title
24
+ helper_method :bootstrap_class_for
25
+
26
+ # Redirects on successful sign in
27
+ def after_sign_in_path_for resource
28
+ # Rails.logger.debug("SUCCESFULL SIGNIN, USER IS ADMIN? #{current_user.admin?}")
29
+ #if current_user.admin?
30
+ # GETTING JUST THE ROOT ACTIONS I (CURRENT_USER) CAN MANAGE
31
+ root_actions = RailsAdmin::Config::Actions.all(:root).select {|action| can? action.action_name, :all }
32
+ # Rails.logger.debug "ROOT ACTIONS: #{root_actions.inspect}"
33
+ # GETTING THE FIRST ACTION I CAN MANAGE
34
+ action = root_actions.collect(&:action_name).first
35
+ # Rails.logger.debug "FIRST ACTION: #{action}"
36
+ # REDIRECT TO THAT ACTION
37
+ stored_location_for(resource) || rails_admin.send("#{action}_path").sub("#{ENV['RAILS_RELATIVE_URL_ROOT']}#{ENV['RAILS_RELATIVE_URL_ROOT']}", "#{ENV['RAILS_RELATIVE_URL_ROOT']}")
38
+ end
39
+ end
40
+
41
+ def title value = "Thecore"
42
+ @title = value
43
+ end
44
+
45
+ def bootstrap_class_for flash_type
46
+ case flash_type
47
+ when 'success'
48
+ 'alert-success'
49
+ when 'error'
50
+ 'alert-danger'
51
+ when 'alert'
52
+ 'alert-warning'
53
+ when 'notice'
54
+ 'alert-info'
55
+ else
56
+ flash_type.to_s
57
+ end
58
+ end
59
+
60
+ def line_break s
61
+ s.gsub("\n", "<br/>")
62
+ end
63
+ # Devise permitted params
64
+ def configure_permitted_parameters
65
+ devise_parameter_sanitizer.permit(:sign_in) {
66
+ |u| u.permit(
67
+ :username,
68
+ :password,
69
+ :password_confirmation,
70
+ :remember_me)
71
+ }
72
+ devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(
73
+ :username,
74
+ :password,
75
+ :password_confirmation)
76
+ }
77
+ devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(
78
+ :username,
79
+ :password,
80
+ :password_confirmation,
81
+ :current_password)
82
+ }
83
+ end
84
+
85
+ # Auto-sign out locked users
86
+ def reject_locked!
87
+ if current_user && current_user.locked?
88
+ sign_out current_user
89
+ user_session = nil
90
+ current_user = nil
91
+ flash[:alert] = "Your account is locked."
92
+ flash[:notice] = nil
93
+ redirect_to root_url
94
+ end
95
+ end
96
+
97
+ # Only permits admin users
98
+ def require_admin!
99
+ authenticate_user!
100
+
101
+ if current_user && !current_user.admin?
102
+ redirect_to inside_path
103
+ end
104
+ end
105
+
106
+ # Its important that the location is NOT stored if:
107
+ # - The request method is not GET (non idempotent)
108
+ # - The request is handled by a Devise controller such as
109
+ # Devise::SessionsController as that could cause an
110
+ # infinite redirect loop.
111
+ # - The request is an Ajax request as this can lead to very unexpected
112
+ # behaviour.
113
+ def storable_location?
114
+ request.get? && is_navigational_format? && !devise_controller? && !request.xhr?
115
+ end
116
+
117
+ def store_user_location!
118
+ # :user is the scope we are authenticating
119
+ store_location_for(:user, request.fullpath)
120
+ end
121
+ end
122
+
123
+ # include the extension
124
+ ActionController::Base.send(:include, ThecoreConcern)
125
+
@@ -0,0 +1,8 @@
1
+ en:
2
+ admin:
3
+ export:
4
+ found: Export found
5
+ misc:
6
+ order_by: Order by
7
+ select:
8
+ toggle: Toggle Selection
@@ -0,0 +1,27 @@
1
+ it:
2
+ yes: Yes
3
+ no: Cancel
4
+ error: Error
5
+ question: Question
6
+ root_actions: Root Actions
7
+ admin:
8
+ js:
9
+ true: True
10
+ false: False
11
+ is_present: Is present
12
+ is_blank: Is blank
13
+ date: Date ...
14
+ between_and_: Between ... and ...
15
+ today: Today
16
+ yesterday: Yesterday
17
+ this_week: This week
18
+ last_week: Last week
19
+ number: Number ...
20
+ contains: Contains
21
+ is_exactly: Is exactly
22
+ starts_with: Starts with
23
+ ends_with: Ends with
24
+ too_many_objects: "Too many objects, use search box above"
25
+ no_objects: "No objects found"
26
+ loading: "Loading..."
27
+ toggle_navigation: Toggle navigation
@@ -0,0 +1,34 @@
1
+ en:
2
+ admin:
3
+ misc:
4
+ scopes: Fast Filters
5
+ scopes:
6
+ all: All
7
+ order_by_name: Order By Name
8
+ order_by_insert_date: Order By Date
9
+ starts_with_a: Starts with A
10
+ starts_with_b: Starts with B
11
+ starts_with_c: Starts with C
12
+ starts_with_d: Starts with D
13
+ starts_with_e: Starts with E
14
+ starts_with_f: Starts with F
15
+ starts_with_g: Starts with G
16
+ starts_with_h: Starts with H
17
+ starts_with_i: Starts with I
18
+ starts_with_j: Starts with J
19
+ starts_with_k: Starts with K
20
+ starts_with_l: Starts with L
21
+ starts_with_m: Starts with M
22
+ starts_with_n: Starts with N
23
+ starts_with_o: Starts with O
24
+ starts_with_p: Starts with P
25
+ starts_with_q: Starts with Q
26
+ starts_with_r: Starts with R
27
+ starts_with_s: Starts with S
28
+ starts_with_t: Starts with T
29
+ starts_with_u: Starts with U
30
+ starts_with_v: Starts with V
31
+ starts_with_w: Starts with W
32
+ starts_with_x: Starts with X
33
+ starts_with_y: Starts with Y
34
+ starts_with_z: Starts with Z
@@ -0,0 +1,5 @@
1
+ en:
2
+ admin:
3
+ rollincode:
4
+ number: "Number"
5
+ show: "Show"
@@ -0,0 +1,20 @@
1
+ it:
2
+ admin:
3
+ actions:
4
+ new:
5
+ menu: ""
6
+ index:
7
+ menu: ""
8
+ export:
9
+ menu: ""
10
+ export:
11
+ found: ➦
12
+ misc:
13
+ order_by: ⇅
14
+ scopes: ⋔
15
+ add_filter: ⋔
16
+ add_new: ⋔
17
+ refresh: ""
18
+ bulk_menu_title: ☰✔
19
+ select:
20
+ toggle: ☑
@@ -0,0 +1,27 @@
1
+ it:
2
+ yes: Si
3
+ no: Annulla
4
+ error: Errore
5
+ question: Domanda
6
+ root_actions: "Operazioni"
7
+ admin:
8
+ js:
9
+ true: Vero
10
+ false: Falso
11
+ is_present: Is present
12
+ is_blank: Is blank
13
+ date: Date ...
14
+ between_and_: Between ... and ...
15
+ today: Today
16
+ yesterday: Yesterday
17
+ this_week: This week
18
+ last_week: Last week
19
+ number: Number ...
20
+ contains: Contains
21
+ is_exactly: Is exactly
22
+ starts_with: Starts with
23
+ ends_with: Ends with
24
+ too_many_objects: "Too many objects, use search box above"
25
+ no_objects: "No objects found"
26
+ loading: "Loading..."
27
+ toggle_navigation: Toggle navigation
@@ -0,0 +1,4 @@
1
+ it:
2
+ admin:
3
+ scopes:
4
+ _all: Tutti
@@ -0,0 +1,5 @@
1
+ it:
2
+ admin:
3
+ rollincode:
4
+ number: Quantità
5
+ show: "Mostra gli elementi"
data/config/routes.rb CHANGED
@@ -1,2 +1,12 @@
1
1
  Rails.application.routes.draw do
2
+ mount RailsAdmin::Engine => '/app', as: 'rails_admin'
3
+
4
+ get "home", to: "pages#home", as: "home"
5
+ get "inside", to: "pages#inside", as: "inside"
6
+ get "/contact", to: "pages#contact", as: "contact"
7
+ post "/emailconfirmation", to: "pages#email", as: "email_confirmation"
8
+
9
+ devise_scope :user do
10
+ root to: "devise/sessions#new"
11
+ end
2
12
  end
@@ -2,10 +2,13 @@ require "thecore_ui_rails_admin/engine"
2
2
 
3
3
  require 'thecore_ui_commons'
4
4
  # Rails Admin
5
+ ENV['RAILS_ADMIN_THEME'] ||= 'rollincode'
5
6
  require 'rails_admin_rollincode'
6
7
  require 'rails_admin'
7
8
  require 'rails_admin-i18n'
8
9
  require 'rails_admin_toggleable'
10
+ # Rails Admin Buildups
11
+ require 'jquery-ui-rails'
9
12
 
10
13
  module ThecoreUiRailsAdmin
11
14
  # Your code goes here...
@@ -1,5 +1,12 @@
1
1
  module ThecoreUiRailsAdmin
2
2
  class Engine < ::Rails::Engine
3
+ # This code makes the static assets present in this
4
+ # engine available to main app, even if this gem is
5
+ # just a dependency of another engine
6
+ initializer 'thecore_ui_rails_admin.load_static_assets' do |app|
7
+ # puts "Loading static assets for #{root}"
8
+ app.middleware.use ::ActionDispatch::Static, "#{root}/app"
9
+ end
3
10
  initializer 'thecore_ui_rails_admin.add_to_migrations' do |app|
4
11
  unless app.root.to_s.match root.to_s
5
12
  # APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
@@ -1,3 +1,3 @@
1
1
  module ThecoreUiRailsAdmin
2
- VERSION = '2.1.3'
2
+ VERSION = '2.1.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_ui_rails_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-27 00:00:00.000000000 Z
11
+ date: 2020-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_ui_commons
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.7'
83
+ - !ruby/object:Gem::Dependency
84
+ name: jquery-ui-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '6.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '6.0'
83
97
  description: Holds all base dependencies and configurations to have a thecore integrated
84
98
  with Rails Admin.
85
99
  email:
@@ -92,6 +106,78 @@ files:
92
106
  - README.md
93
107
  - Rakefile
94
108
  - app/assets/config/thecore_ui_rails_admin_manifest.js
109
+ - app/assets/javascripts/rails_admin/custom/ckeditor_ajax.js.coffee
110
+ - app/assets/javascripts/rails_admin/custom/timer.js
111
+ - app/assets/javascripts/rails_admin/custom/ui.js
112
+ - app/assets/javascripts/rails_admin/ra.widgets.coffee
113
+ - app/assets/stylesheets/rails_admin/custom/flashing.scss
114
+ - app/assets/stylesheets/rails_admin/custom/theming.scss
115
+ - app/assets/stylesheets/rails_admin/custom/togglable-sidebar.scss
116
+ - app/views/contact_mailer/contact_message.html.erb
117
+ - app/views/devise/confirmations/new.html.erb
118
+ - app/views/devise/mailer/confirmation_instructions.html.erb
119
+ - app/views/devise/mailer/password_change.html.erb
120
+ - app/views/devise/mailer/reset_password_instructions.html.erb
121
+ - app/views/devise/mailer/unlock_instructions.html.erb
122
+ - app/views/devise/menu/_login_items.html.erb
123
+ - app/views/devise/passwords/edit.html.erb
124
+ - app/views/devise/passwords/new.html.erb
125
+ - app/views/devise/registrations/edit.html.erb
126
+ - app/views/devise/registrations/new.html.erb
127
+ - app/views/devise/sessions/new.html.erb
128
+ - app/views/devise/shared/_links.html.erb
129
+ - app/views/devise/unlocks/new.html.erb
130
+ - app/views/home/index.html.erb
131
+ - app/views/kaminari/_first_page.html.erb
132
+ - app/views/kaminari/_gap.html.erb
133
+ - app/views/kaminari/_last_page.html.erb
134
+ - app/views/kaminari/_next_page.html.erb
135
+ - app/views/kaminari/_page.html.erb
136
+ - app/views/kaminari/_paginator.html.erb
137
+ - app/views/kaminari/_prev_page.html.erb
138
+ - app/views/layouts/_footer.html.erb
139
+ - app/views/layouts/_messages.html.erb
140
+ - app/views/layouts/_navigation.html.erb
141
+ - app/views/layouts/_navigation_links.html.erb
142
+ - app/views/layouts/mailer.html.erb
143
+ - app/views/layouts/mailer.text.erb
144
+ - app/views/layouts/rails_admin/_navigation.html.haml
145
+ - app/views/layouts/rails_admin/_secondary_navigation.html.haml
146
+ - app/views/layouts/rails_admin/_sidebar_navigation.html.haml
147
+ - app/views/layouts/rails_admin/_user_navigation.html.haml
148
+ - app/views/layouts/rails_admin/application.html.haml
149
+ - app/views/layouts/rails_admin/pjax.html.haml
150
+ - app/views/layouts/thecore.html.erb
151
+ - app/views/pages/contact.html.erb
152
+ - app/views/pages/home.html.erb
153
+ - app/views/pages/inside.html.erb
154
+ - app/views/rails_admin/main/_card.html.haml
155
+ - app/views/rails_admin/main/_modal_interaction.html.erb
156
+ - app/views/rails_admin/main/dashboard.html.haml
157
+ - app/views/rails_admin/main/index.html.haml
158
+ - app/views/shared/_flash.html.erb
159
+ - app/views/users/confirmations/new.html.erb
160
+ - app/views/users/mailer/confirmation_instructions.html.erb
161
+ - app/views/users/mailer/password_change.html.erb
162
+ - app/views/users/mailer/reset_password_instructions.html.erb
163
+ - app/views/users/mailer/unlock_instructions.html.erb
164
+ - app/views/users/passwords/edit.html.erb
165
+ - app/views/users/passwords/new.html.erb
166
+ - app/views/users/registrations/edit.html.erb
167
+ - app/views/users/registrations/new.html.erb
168
+ - app/views/users/sessions/new.html.erb
169
+ - app/views/users/shared/_links.html.erb
170
+ - app/views/users/unlocks/new.html.erb
171
+ - config/initializers/rails_admin.rb
172
+ - config/initializers/thecore_concern.rb
173
+ - config/locales/en.index_cards.custom.yml
174
+ - config/locales/en.main.yml
175
+ - config/locales/en.rails_admin.yml
176
+ - config/locales/en.rollincode.yml
177
+ - config/locales/it.index_cards.custom.yml
178
+ - config/locales/it.main.yml
179
+ - config/locales/it.rails_admin.yml
180
+ - config/locales/it.rollincode.yml
95
181
  - config/routes.rb
96
182
  - lib/tasks/thecore_ui_rails_admin_tasks.rake
97
183
  - lib/thecore_ui_rails_admin.rb