thecore_ui_rails_admin 2.1.3 → 2.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/rails_admin/ra.widgets.coffee +233 -0
  3. data/app/assets/javascripts/thecore_ui_rails_admin/thecore_rails_admin.js +78 -0
  4. data/app/assets/stylesheets/thecore_ui_rails_admin/animate.css +3458 -0
  5. data/app/assets/stylesheets/thecore_ui_rails_admin/apexcharts.scss +7 -0
  6. data/app/assets/stylesheets/thecore_ui_rails_admin/common.scss +36 -0
  7. data/app/assets/stylesheets/thecore_ui_rails_admin/devise.scss +248 -0
  8. data/app/assets/stylesheets/thecore_ui_rails_admin/flashing.scss +28 -0
  9. data/app/assets/stylesheets/thecore_ui_rails_admin/mixins.scss +18 -0
  10. data/app/assets/stylesheets/thecore_ui_rails_admin/thecore.scss +25 -0
  11. data/app/assets/stylesheets/thecore_ui_rails_admin/thecore_rails_admin.scss +204 -0
  12. data/app/assets/stylesheets/thecore_ui_rails_admin/togglable-sidebar.scss +90 -0
  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/_navigation.html.haml +13 -0
  17. data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +3 -0
  18. data/app/views/layouts/rails_admin/_sidebar_navigation.html.haml +4 -0
  19. data/app/views/layouts/rails_admin/_user_navigation.html.haml +7 -0
  20. data/app/views/layouts/rails_admin/application.html.haml +59 -0
  21. data/app/views/layouts/rails_admin/pjax.html.haml +25 -0
  22. data/app/views/rails_admin/main/_card.html.haml +17 -0
  23. data/app/views/rails_admin/main/_modal_interaction.html.erb +53 -0
  24. data/app/views/rails_admin/main/dashboard.html.haml +43 -0
  25. data/app/views/rails_admin/main/index.html.haml +90 -0
  26. data/app/views/shared/_flash.html.erb +10 -0
  27. data/config/initializers/rails_admin.rb +73 -0
  28. data/config/initializers/thecore_concern.rb +130 -0
  29. data/config/initializers/thecore_ui_rails_admin_app_configs.rb +17 -0
  30. data/config/locales/en.index_cards.custom.yml +8 -0
  31. data/config/locales/en.main.yml +27 -0
  32. data/config/locales/en.rails_admin.yml +34 -0
  33. data/config/locales/en.rollincode.yml +5 -0
  34. data/config/locales/it.index_cards.custom.yml +20 -0
  35. data/config/locales/it.main.yml +27 -0
  36. data/config/locales/it.rails_admin.yml +4 -0
  37. data/config/locales/it.rollincode.yml +5 -0
  38. data/config/locales/thecore_settings.en.yml +31 -0
  39. data/config/locales/thecore_settings.it.yml +31 -0
  40. data/config/routes.rb +10 -0
  41. data/db/migrate/20161227101954_create_rails_admin_settings.rb +25 -0
  42. data/db/migrate/20161227101956_add_app_name.rb +5 -0
  43. data/lib/abilities/thecore_ui_rails_admin.rb +12 -0
  44. data/lib/concerns/rails_admin_requirements.rb +19 -0
  45. data/lib/concerns/thecore_rails_admin_bulk_delete_concern.rb +16 -0
  46. data/lib/concerns/thecore_rails_admin_export_concern.rb +16 -0
  47. data/lib/concerns/thecore_ui_rails_admin_permission.rb +32 -0
  48. data/lib/concerns/thecore_ui_rails_admin_role.rb +36 -0
  49. data/lib/concerns/thecore_ui_rails_admin_user.rb +75 -0
  50. data/lib/thecore_ui_rails_admin.rb +21 -3
  51. data/lib/thecore_ui_rails_admin/version.rb +1 -1
  52. metadata +147 -2
@@ -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"
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,5 @@
1
+ class AddAppName < ActiveRecord::Migration[5.0]
2
+ def change
3
+ Settings.app_name = "The Core by Gabriele Tassoni"
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ module Abilities
2
+ class ThecoreUiRailsAdmin
3
+ include CanCan::Ability
4
+ def initialize user
5
+ # No one is allowed to add or destroy settings
6
+ # just list or edit existing
7
+ cannot :create, RailsAdminSettings::Setting
8
+ cannot :destroy, RailsAdminSettings::Setting
9
+ cannot :show, RailsAdminSettings::Setting
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,19 @@
1
+ module RailsAdminSettings
2
+ module RailsAdminExtensionConfig
3
+ def self.included(base)
4
+ # IMPORTANT: To extend rails admin section in model, directly, instead of using concerns, I can
5
+ # extend the included method. Be sure to use a different module name, otherwis it will be overwritten
6
+ # See thecore_settings_rails_admin_model_extensions.rb initializer for a reference
7
+ # on how to extend rails_admin section of a model previously defined (say it's defined in another gem)
8
+ if base.respond_to?(:rails_admin)
9
+ base.rails_admin do
10
+ navigation_icon 'fa fa-cogs'
11
+ end
12
+ end
13
+
14
+ def display_name
15
+ "#{I18n.t "settings.namespaces.#{ns}", default: ns.titleize}: #{I18n.t "settings.names.#{name}", default: name.titleize}"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ require 'active_support/concern'
2
+
3
+ module BulkDeleteConcern
4
+ extend ActiveSupport::Concern
5
+ included do
6
+ # Should the action be visible
7
+ # Edit By taris, it shows the button only if there are records displayed
8
+ register_instance_option :visible? do
9
+ # If not in index, then return true,
10
+ # otherwise it wont' be added to the list
11
+ # of all Actions during rails initialization
12
+ # In index, instead, I show it only if there are records in the current view
13
+ bindings[:controller].action_name == "index" ? (authorized? && !bindings[:controller].instance_variable_get("@objects").blank?) : true
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ require 'active_support/concern'
2
+
3
+ module ExportConcern
4
+ extend ActiveSupport::Concern
5
+ included do
6
+ # Should the action be visible
7
+ # Edit By taris, it shows the button only if there are records displayed
8
+ register_instance_option :visible? do
9
+ # If not in index, then return true,
10
+ # otherwise it wont' be added to the list
11
+ # of all Actions during rails initialization
12
+ # In index, instead, I show it only if there are records in the current view
13
+ bindings[:controller].action_name == "index" ? (authorized? && !bindings[:controller].instance_variable_get("@objects").blank?) : true
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,32 @@
1
+ require 'active_support/concern'
2
+
3
+ module ThecoreUiRailsAdminPermission
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+
8
+ rails_admin do
9
+ field :predicate
10
+ field :action
11
+ field :target
12
+ list do
13
+ field :created_at
14
+ exclude_fields :lock_version
15
+ end
16
+ show do
17
+ exclude_fields :id
18
+ exclude_fields :lock_version
19
+ end
20
+ create do
21
+ field :lock_version, :hidden do
22
+ visible true
23
+ end
24
+ end
25
+ edit do
26
+ field :lock_version, :hidden do
27
+ visible true
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,36 @@
1
+ require 'active_support/concern'
2
+
3
+ module ThecoreUiRailsAdminRole
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+
8
+ rails_admin do
9
+ navigation_label I18n.t("admin.settings.label")
10
+ navigation_icon 'fa fa-group'
11
+ desc I18n.t("activerecord.descriptions.role")
12
+
13
+ field :name
14
+ field :permissions, :selectize
15
+ list do
16
+ field :created_at
17
+ exclude_fields :lock_version
18
+ end
19
+ show do
20
+ exclude_fields :id
21
+ exclude_fields :lock_version
22
+ end
23
+ create do
24
+ field :lock_version, :hidden do
25
+ visible true
26
+ end
27
+ # include UserRailsAdminCreateConcern
28
+ end
29
+ edit do
30
+ field :lock_version, :hidden do
31
+ visible true
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,75 @@
1
+ require 'active_support/concern'
2
+
3
+ module ThecoreUiRailsAdminUser
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+
8
+ rails_admin do
9
+ # rails_admin do
10
+ navigation_label I18n.t("admin.settings.label")
11
+ navigation_icon 'fa fa-user-circle'
12
+ desc I18n.t("activerecord.descriptions.user")
13
+
14
+ # Field present Everywhere
15
+ field :email do
16
+ required true
17
+ end
18
+ field :username do
19
+ required true
20
+ end
21
+ field :admin do
22
+ visible do
23
+ bindings[:view].current_user.admin? && bindings[:view].current_user.id != bindings[:object].id
24
+ end
25
+ end
26
+ field :locked do
27
+ visible do
28
+ bindings[:view].current_user.admin? && bindings[:view].current_user.id != bindings[:object].id
29
+ end
30
+ end
31
+ field :roles, :selectize
32
+ # include UserRailsAdminConcern
33
+
34
+ # Fields only in lists and forms
35
+ list do
36
+ field :created_at
37
+ configure :email do
38
+ visible false
39
+ end
40
+ exclude_fields :lock_version
41
+ # include UserRailsAdminListConcern
42
+ end
43
+ show do
44
+ #exclude_fields :id
45
+ exclude_fields :lock_version
46
+ end
47
+ create do
48
+ field :password do
49
+ required true
50
+ end
51
+ field :password_confirmation do
52
+ required true
53
+ end
54
+ field :lock_version, :hidden do
55
+ visible true
56
+ end
57
+ # include UserRailsAdminCreateConcern
58
+ end
59
+ edit do
60
+ field :password do
61
+ required false
62
+ end
63
+ field :password_confirmation do
64
+ required false
65
+ end
66
+
67
+ field :lock_version, :hidden do
68
+ visible true
69
+ end
70
+ # include UserRailsAdminEditConcern
71
+
72
+ end
73
+ end
74
+ end
75
+ end
@@ -1,12 +1,30 @@
1
- require "thecore_ui_rails_admin/engine"
2
-
3
1
  require 'thecore_ui_commons'
4
2
  # Rails Admin
3
+ ENV['RAILS_ADMIN_THEME'] ||= 'rollincode'
5
4
  require 'rails_admin_rollincode'
6
5
  require 'rails_admin'
7
6
  require 'rails_admin-i18n'
7
+ require 'safe_yaml'
8
8
  require 'rails_admin_toggleable'
9
+ require 'rails_admin_settings'
10
+ require 'rails_admin_selectize'
11
+ require 'concerns/rails_admin_requirements'
12
+ # Abilities
13
+ require 'abilities/thecore_ui_rails_admin'
14
+ # Rails Admin Buildups
15
+ require 'jquery-ui-rails'
16
+ require 'bootstrap-sass'
17
+
18
+ require 'concerns/thecore_ui_rails_admin_user'
19
+ require 'concerns/thecore_ui_rails_admin_role'
20
+ require 'concerns/thecore_ui_rails_admin_permission'
21
+ require 'concerns/thecore_rails_admin_export_concern'
22
+ require 'concerns/thecore_rails_admin_bulk_delete_concern'
23
+
24
+ require "thecore_ui_rails_admin/engine"
9
25
 
10
26
  module ThecoreUiRailsAdmin
11
- # Your code goes here...
27
+ # Rails Admin Settings
28
+ SafeYAML::OPTIONS[:default_mode] = :safe
29
+ SafeYAML::OPTIONS[:deserialize_symbols] = false
12
30
  end
@@ -1,3 +1,3 @@
1
1
  module ThecoreUiRailsAdmin
2
- VERSION = '2.1.3'
2
+ VERSION = '2.1.10'
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.10
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-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_ui_commons
@@ -24,6 +24,48 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bootstrap-sass
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sassc-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coffee-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: rails_admin_rollincode
29
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +122,62 @@ dependencies:
80
122
  - - "~>"
81
123
  - !ruby/object:Gem::Version
82
124
  version: '0.7'
125
+ - !ruby/object:Gem::Dependency
126
+ name: safe_yaml
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '1.0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rails_admin_settings
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '1.5'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '1.5'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rails_admin_selectize
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '2.0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '2.0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: jquery-ui-rails
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '6.0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '6.0'
83
181
  description: Holds all base dependencies and configurations to have a thecore integrated
84
182
  with Rails Admin.
85
183
  email:
@@ -92,7 +190,54 @@ files:
92
190
  - README.md
93
191
  - Rakefile
94
192
  - app/assets/config/thecore_ui_rails_admin_manifest.js
193
+ - app/assets/javascripts/rails_admin/ra.widgets.coffee
194
+ - app/assets/javascripts/thecore_ui_rails_admin/thecore_rails_admin.js
195
+ - app/assets/stylesheets/thecore_ui_rails_admin/animate.css
196
+ - app/assets/stylesheets/thecore_ui_rails_admin/apexcharts.scss
197
+ - app/assets/stylesheets/thecore_ui_rails_admin/common.scss
198
+ - app/assets/stylesheets/thecore_ui_rails_admin/devise.scss
199
+ - app/assets/stylesheets/thecore_ui_rails_admin/flashing.scss
200
+ - app/assets/stylesheets/thecore_ui_rails_admin/mixins.scss
201
+ - app/assets/stylesheets/thecore_ui_rails_admin/thecore.scss
202
+ - app/assets/stylesheets/thecore_ui_rails_admin/thecore_rails_admin.scss
203
+ - app/assets/stylesheets/thecore_ui_rails_admin/togglable-sidebar.scss
204
+ - app/controllers/pages_controller.rb
205
+ - app/helpers/devise_bootstrap_errors_helper.rb
206
+ - app/helpers/thecore_helper.rb
207
+ - app/views/layouts/rails_admin/_navigation.html.haml
208
+ - app/views/layouts/rails_admin/_secondary_navigation.html.haml
209
+ - app/views/layouts/rails_admin/_sidebar_navigation.html.haml
210
+ - app/views/layouts/rails_admin/_user_navigation.html.haml
211
+ - app/views/layouts/rails_admin/application.html.haml
212
+ - app/views/layouts/rails_admin/pjax.html.haml
213
+ - app/views/rails_admin/main/_card.html.haml
214
+ - app/views/rails_admin/main/_modal_interaction.html.erb
215
+ - app/views/rails_admin/main/dashboard.html.haml
216
+ - app/views/rails_admin/main/index.html.haml
217
+ - app/views/shared/_flash.html.erb
218
+ - config/initializers/rails_admin.rb
219
+ - config/initializers/thecore_concern.rb
220
+ - config/initializers/thecore_ui_rails_admin_app_configs.rb
221
+ - config/locales/en.index_cards.custom.yml
222
+ - config/locales/en.main.yml
223
+ - config/locales/en.rails_admin.yml
224
+ - config/locales/en.rollincode.yml
225
+ - config/locales/it.index_cards.custom.yml
226
+ - config/locales/it.main.yml
227
+ - config/locales/it.rails_admin.yml
228
+ - config/locales/it.rollincode.yml
229
+ - config/locales/thecore_settings.en.yml
230
+ - config/locales/thecore_settings.it.yml
95
231
  - config/routes.rb
232
+ - db/migrate/20161227101954_create_rails_admin_settings.rb
233
+ - db/migrate/20161227101956_add_app_name.rb
234
+ - lib/abilities/thecore_ui_rails_admin.rb
235
+ - lib/concerns/rails_admin_requirements.rb
236
+ - lib/concerns/thecore_rails_admin_bulk_delete_concern.rb
237
+ - lib/concerns/thecore_rails_admin_export_concern.rb
238
+ - lib/concerns/thecore_ui_rails_admin_permission.rb
239
+ - lib/concerns/thecore_ui_rails_admin_role.rb
240
+ - lib/concerns/thecore_ui_rails_admin_user.rb
96
241
  - lib/tasks/thecore_ui_rails_admin_tasks.rake
97
242
  - lib/thecore_ui_rails_admin.rb
98
243
  - lib/thecore_ui_rails_admin/engine.rb