thecore_settings 2.0.2 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/models/{rails_admin_settings → thecore_settings}/setting.rb +0 -0
- data/config/locales/{thecore_settings.it.yml → it.yml} +2 -2
- data/{lib/generators/rails_admin_settings/templates/db/migrate/20161227101954_create_thecore_settings.rb → db/migrate/20161227101955_create_thecore_settings.rb} +1 -5
- data/db/migrate/20210825113515_migrate_from_rails_admin_settings_to_thecore_settings.rb +22 -0
- data/lib/generators/{rails_admin_settings → thecore_settings}/migration_generator.rb +0 -0
- data/lib/generators/{rails_admin_settings → thecore_settings}/templates/migration.rb +0 -0
- data/lib/thecore_settings/engine.rb +11 -10
- metadata +7 -147
- data/app/assets/config/thecore_settings_manifest.js +0 -0
- data/app/assets/images/thecore_settings/.keep +0 -0
- data/app/assets/javascripts/thecore_settings/.keep +0 -0
- data/app/assets/stylesheets/rich/editor.css +0 -20
- data/app/assets/stylesheets/thecore_settings/.keep +0 -0
- data/app/controllers/.keep +0 -0
- data/app/helpers/.keep +0 -0
- data/app/mailers/.keep +0 -0
- data/assets/javascripts/rails_admin/custom/thecore_settings.rb +0 -2
- data/config/initializers/rails_admin_requirements.rb +0 -22
- data/config/initializers/thecore_settings_abilities.rb +0 -22
- data/config/initializers/thecore_settings_post_init.rb +0 -9
- data/config/routes.rb +0 -3
- data/db/migrate/20161227101954_create_rails_admin_settings.rb +0 -25
- data/db/migrate/20161227101956_add_app_name.rb +0 -5
- data/lib/tasks/thecore_settings_tasks.rake +0 -4
- data/log/development.log +0 -0
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/config/manifest.js +0 -4
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/assets/javascripts/cable.js +0 -13
- data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/channels/application_cable/channel.rb +0 -4
- data/test/dummy/app/channels/application_cable/connection.rb +0 -4
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/jobs/application_job.rb +0 -2
- data/test/dummy/app/mailers/application_mailer.rb +0 -4
- data/test/dummy/app/models/application_record.rb +0 -3
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
- data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/bin/setup +0 -34
- data/test/dummy/bin/update +0 -29
- data/test/dummy/config/application.rb +0 -15
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/cable.yml +0 -9
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -54
- data/test/dummy/config/environments/production.rb +0 -86
- data/test/dummy/config/environments/test.rb +0 -42
- data/test/dummy/config/initializers/application_controller_renderer.rb +0 -6
- data/test/dummy/config/initializers/assets.rb +0 -11
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -5
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/new_framework_defaults.rb +0 -24
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/puma.rb +0 -47
- data/test/dummy/config/routes.rb +0 -3
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/config/spring.rb +0 -6
- data/test/dummy/config.ru +0 -5
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/log/development.log +0 -16
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/tmp/.keep +0 -0
- data/test/integration/navigation_test.rb +0 -8
- data/test/test_helper.rb +0 -19
- data/test/thecore_settings_test.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b65e652f01e41f30c470e5a736cc790bb6e250b087761aedb73275637d72a81c
|
4
|
+
data.tar.gz: a57e03cab15a19487331af09c402e07fde8a7adcb8119234ab71d4ceea0cdea6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f2c04dc99afda466f11270c7e7b66756e058ad93a6fcc940ab4d5ae181d2f4bec89cb6fbee12abfc236e9a4fed603504e78950b725ea6128e3f65f39268c852
|
7
|
+
data.tar.gz: c2fa3113fa63219cae718ddb22dd7c7c0c724ced7fce14746293e70149fcd8982e913bcf2d0bb979ef8ff94bdbaacfb80c1901afedc778faada5396a8ad65789
|
data/Gemfile.lock
CHANGED
File without changes
|
@@ -15,9 +15,9 @@ it:
|
|
15
15
|
color_invalid: Colore non valido
|
16
16
|
mongoid: &mongoid
|
17
17
|
models:
|
18
|
-
|
18
|
+
thecore_settings/setting: Configurazioni
|
19
19
|
attributes:
|
20
|
-
|
20
|
+
thecore_settings/setting:
|
21
21
|
c_at: Creato
|
22
22
|
u_at: Modificato
|
23
23
|
enabled: Abilitato
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class CreateThecoreSettings < ActiveRecord::Migration[5.
|
1
|
+
class CreateThecoreSettings < ActiveRecord::Migration[5.2]
|
2
2
|
def change
|
3
3
|
create_table :thecore_settings do |t|
|
4
4
|
t.boolean :enabled, default: true
|
@@ -15,9 +15,6 @@ class CreateThecoreSettings < ActiveRecord::Migration[5.0]
|
|
15
15
|
t.attachment :file
|
16
16
|
elsif defined?(CarrierWave)
|
17
17
|
t.string :file
|
18
|
-
elsif defined?(Shrine)
|
19
|
-
t.text :file_data
|
20
|
-
|
21
18
|
end
|
22
19
|
t.timestamps
|
23
20
|
end
|
@@ -26,4 +23,3 @@ class CreateThecoreSettings < ActiveRecord::Migration[5.0]
|
|
26
23
|
add_index :thecore_settings, [:ns, :key], unique: true
|
27
24
|
end
|
28
25
|
end
|
29
|
-
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class MigrateFromRailsAdminSettingsToThecoreSettings < ActiveRecord::Migration[5.2]
|
2
|
+
|
3
|
+
module RailsAdminSettings
|
4
|
+
class Setting < ActiveRecord::Base
|
5
|
+
self.table_name = "rails_admin_settings"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def change
|
10
|
+
if RailsAdminSettings::Setting.table_exists?
|
11
|
+
puts "Table Exists, trying to migrate older values to new ThecoreSettings::Setting Table"
|
12
|
+
RailsAdminSettings::Setting.all.each do |old_setting|
|
13
|
+
new_setting = ThecoreSettings::Setting.find_or_initialize_by old_setting.attributes.except("id", "created_at", "updated_at")
|
14
|
+
unless new_setting.save
|
15
|
+
puts new_setting.errors.full_messages.join("\n")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
else
|
19
|
+
puts "Table Does not Exists, nothing to do! Yay"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
File without changes
|
File without changes
|
@@ -1,9 +1,19 @@
|
|
1
1
|
module ThecoreSettings
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
+
|
4
|
+
initializer 'ThecoreSettings.add_to_migrations' do |app|
|
5
|
+
unless app.root.to_s.match root.to_s
|
6
|
+
# APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
|
7
|
+
config.paths['db/migrate'].expanded.each do |expanded_path|
|
8
|
+
app.config.paths['db/migrate'] << expanded_path
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
3
13
|
rake_tasks do
|
4
14
|
require File.expand_path('../tasks', __FILE__)
|
5
15
|
end
|
6
|
-
|
16
|
+
|
7
17
|
initializer 'ThecoreSettings.install_after_action' do |app|
|
8
18
|
require File.dirname(__FILE__) + '/../../app/models/thecore_settings/setting.rb'
|
9
19
|
|
@@ -13,14 +23,5 @@ module ThecoreSettings
|
|
13
23
|
end
|
14
24
|
end
|
15
25
|
end
|
16
|
-
|
17
|
-
initializer 'ThecoreSettings.add_to_migrations' do |app|
|
18
|
-
unless app.root.to_s.match root.to_s
|
19
|
-
# APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
|
20
|
-
config.paths['db/migrate'].expanded.each do |expanded_path|
|
21
|
-
app.config.paths['db/migrate'] << expanded_path
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
26
|
end
|
26
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
@@ -344,36 +344,21 @@ files:
|
|
344
344
|
- README.md
|
345
345
|
- README.rdoc
|
346
346
|
- Rakefile
|
347
|
-
- app/assets/config/thecore_settings_manifest.js
|
348
|
-
- app/assets/images/thecore_settings/.keep
|
349
|
-
- app/assets/javascripts/thecore_settings/.keep
|
350
|
-
- app/assets/stylesheets/rich/editor.css
|
351
|
-
- app/assets/stylesheets/thecore_settings/.keep
|
352
|
-
- app/controllers/.keep
|
353
|
-
- app/helpers/.keep
|
354
|
-
- app/mailers/.keep
|
355
347
|
- app/models/.keep
|
356
|
-
- app/models/
|
348
|
+
- app/models/thecore_settings/setting.rb
|
357
349
|
- app/views/.keep
|
358
350
|
- app/views/rails_admin/main/_setting_value.html.haml
|
359
|
-
- assets/javascripts/rails_admin/custom/thecore_settings.rb
|
360
351
|
- bin/rails
|
361
|
-
- config/initializers/rails_admin_requirements.rb
|
362
|
-
- config/initializers/thecore_settings_abilities.rb
|
363
|
-
- config/initializers/thecore_settings_post_init.rb
|
364
352
|
- config/locales/en.yml
|
353
|
+
- config/locales/it.yml
|
365
354
|
- config/locales/pt-BR.yml
|
366
355
|
- config/locales/ru.yml
|
367
|
-
-
|
368
|
-
-
|
369
|
-
- db/migrate/20161227101954_create_rails_admin_settings.rb
|
370
|
-
- db/migrate/20161227101956_add_app_name.rb
|
356
|
+
- db/migrate/20161227101955_create_thecore_settings.rb
|
357
|
+
- db/migrate/20210825113515_migrate_from_rails_admin_settings_to_thecore_settings.rb
|
371
358
|
- gemfiles/mongoid-6.0.gemfile
|
372
359
|
- gemfiles/mongoid-6.3.gemfile
|
373
|
-
- lib/generators/
|
374
|
-
- lib/generators/
|
375
|
-
- lib/generators/rails_admin_settings/templates/migration.rb
|
376
|
-
- lib/tasks/thecore_settings_tasks.rake
|
360
|
+
- lib/generators/thecore_settings/migration_generator.rb
|
361
|
+
- lib/generators/thecore_settings/templates/migration.rb
|
377
362
|
- lib/thecore_settings.rb
|
378
363
|
- lib/thecore_settings/determine_mime_type.rb
|
379
364
|
- lib/thecore_settings/dumper.rb
|
@@ -393,7 +378,6 @@ files:
|
|
393
378
|
- lib/thecore_settings/uploads.rb
|
394
379
|
- lib/thecore_settings/validation.rb
|
395
380
|
- lib/thecore_settings/version.rb
|
396
|
-
- log/development.log
|
397
381
|
- spec/advanced_usage_spec.rb
|
398
382
|
- spec/carrierwave_spec.rb
|
399
383
|
- spec/database_trickery_spec.rb
|
@@ -415,68 +399,6 @@ files:
|
|
415
399
|
- spec/support/mongoid.rb
|
416
400
|
- spec/support/mongoid.yml
|
417
401
|
- spec/types_spec.rb
|
418
|
-
- test/dummy/Rakefile
|
419
|
-
- test/dummy/app/assets/config/manifest.js
|
420
|
-
- test/dummy/app/assets/images/.keep
|
421
|
-
- test/dummy/app/assets/javascripts/application.js
|
422
|
-
- test/dummy/app/assets/javascripts/cable.js
|
423
|
-
- test/dummy/app/assets/javascripts/channels/.keep
|
424
|
-
- test/dummy/app/assets/stylesheets/application.css
|
425
|
-
- test/dummy/app/channels/application_cable/channel.rb
|
426
|
-
- test/dummy/app/channels/application_cable/connection.rb
|
427
|
-
- test/dummy/app/controllers/application_controller.rb
|
428
|
-
- test/dummy/app/controllers/concerns/.keep
|
429
|
-
- test/dummy/app/helpers/application_helper.rb
|
430
|
-
- test/dummy/app/jobs/application_job.rb
|
431
|
-
- test/dummy/app/mailers/application_mailer.rb
|
432
|
-
- test/dummy/app/models/application_record.rb
|
433
|
-
- test/dummy/app/models/concerns/.keep
|
434
|
-
- test/dummy/app/views/layouts/application.html.erb
|
435
|
-
- test/dummy/app/views/layouts/mailer.html.erb
|
436
|
-
- test/dummy/app/views/layouts/mailer.text.erb
|
437
|
-
- test/dummy/bin/bundle
|
438
|
-
- test/dummy/bin/rails
|
439
|
-
- test/dummy/bin/rake
|
440
|
-
- test/dummy/bin/setup
|
441
|
-
- test/dummy/bin/update
|
442
|
-
- test/dummy/config.ru
|
443
|
-
- test/dummy/config/application.rb
|
444
|
-
- test/dummy/config/boot.rb
|
445
|
-
- test/dummy/config/cable.yml
|
446
|
-
- test/dummy/config/database.yml
|
447
|
-
- test/dummy/config/environment.rb
|
448
|
-
- test/dummy/config/environments/development.rb
|
449
|
-
- test/dummy/config/environments/production.rb
|
450
|
-
- test/dummy/config/environments/test.rb
|
451
|
-
- test/dummy/config/initializers/application_controller_renderer.rb
|
452
|
-
- test/dummy/config/initializers/assets.rb
|
453
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
454
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
455
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
456
|
-
- test/dummy/config/initializers/inflections.rb
|
457
|
-
- test/dummy/config/initializers/mime_types.rb
|
458
|
-
- test/dummy/config/initializers/new_framework_defaults.rb
|
459
|
-
- test/dummy/config/initializers/session_store.rb
|
460
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
461
|
-
- test/dummy/config/locales/en.yml
|
462
|
-
- test/dummy/config/puma.rb
|
463
|
-
- test/dummy/config/routes.rb
|
464
|
-
- test/dummy/config/secrets.yml
|
465
|
-
- test/dummy/config/spring.rb
|
466
|
-
- test/dummy/db/development.sqlite3
|
467
|
-
- test/dummy/lib/assets/.keep
|
468
|
-
- test/dummy/log/.keep
|
469
|
-
- test/dummy/log/development.log
|
470
|
-
- test/dummy/public/404.html
|
471
|
-
- test/dummy/public/422.html
|
472
|
-
- test/dummy/public/500.html
|
473
|
-
- test/dummy/public/apple-touch-icon-precomposed.png
|
474
|
-
- test/dummy/public/apple-touch-icon.png
|
475
|
-
- test/dummy/public/favicon.ico
|
476
|
-
- test/dummy/tmp/.keep
|
477
|
-
- test/integration/navigation_test.rb
|
478
|
-
- test/test_helper.rb
|
479
|
-
- test/thecore_settings_test.rb
|
480
402
|
- thecore_settings.gemspec
|
481
403
|
homepage: https://github.com/gabrieletassoni/thecore_settings
|
482
404
|
licenses:
|
@@ -523,65 +445,3 @@ test_files:
|
|
523
445
|
- spec/support/mongoid.rb
|
524
446
|
- spec/support/mongoid.yml
|
525
447
|
- spec/types_spec.rb
|
526
|
-
- test/dummy/Rakefile
|
527
|
-
- test/dummy/app/assets/config/manifest.js
|
528
|
-
- test/dummy/app/assets/images/.keep
|
529
|
-
- test/dummy/app/assets/javascripts/application.js
|
530
|
-
- test/dummy/app/assets/javascripts/cable.js
|
531
|
-
- test/dummy/app/assets/javascripts/channels/.keep
|
532
|
-
- test/dummy/app/assets/stylesheets/application.css
|
533
|
-
- test/dummy/app/channels/application_cable/channel.rb
|
534
|
-
- test/dummy/app/channels/application_cable/connection.rb
|
535
|
-
- test/dummy/app/controllers/application_controller.rb
|
536
|
-
- test/dummy/app/controllers/concerns/.keep
|
537
|
-
- test/dummy/app/helpers/application_helper.rb
|
538
|
-
- test/dummy/app/jobs/application_job.rb
|
539
|
-
- test/dummy/app/mailers/application_mailer.rb
|
540
|
-
- test/dummy/app/models/application_record.rb
|
541
|
-
- test/dummy/app/models/concerns/.keep
|
542
|
-
- test/dummy/app/views/layouts/application.html.erb
|
543
|
-
- test/dummy/app/views/layouts/mailer.html.erb
|
544
|
-
- test/dummy/app/views/layouts/mailer.text.erb
|
545
|
-
- test/dummy/bin/bundle
|
546
|
-
- test/dummy/bin/rails
|
547
|
-
- test/dummy/bin/rake
|
548
|
-
- test/dummy/bin/setup
|
549
|
-
- test/dummy/bin/update
|
550
|
-
- test/dummy/config.ru
|
551
|
-
- test/dummy/config/application.rb
|
552
|
-
- test/dummy/config/boot.rb
|
553
|
-
- test/dummy/config/cable.yml
|
554
|
-
- test/dummy/config/database.yml
|
555
|
-
- test/dummy/config/environment.rb
|
556
|
-
- test/dummy/config/environments/development.rb
|
557
|
-
- test/dummy/config/environments/production.rb
|
558
|
-
- test/dummy/config/environments/test.rb
|
559
|
-
- test/dummy/config/initializers/application_controller_renderer.rb
|
560
|
-
- test/dummy/config/initializers/assets.rb
|
561
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
562
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
563
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
564
|
-
- test/dummy/config/initializers/inflections.rb
|
565
|
-
- test/dummy/config/initializers/mime_types.rb
|
566
|
-
- test/dummy/config/initializers/new_framework_defaults.rb
|
567
|
-
- test/dummy/config/initializers/session_store.rb
|
568
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
569
|
-
- test/dummy/config/locales/en.yml
|
570
|
-
- test/dummy/config/puma.rb
|
571
|
-
- test/dummy/config/routes.rb
|
572
|
-
- test/dummy/config/secrets.yml
|
573
|
-
- test/dummy/config/spring.rb
|
574
|
-
- test/dummy/db/development.sqlite3
|
575
|
-
- test/dummy/lib/assets/.keep
|
576
|
-
- test/dummy/log/.keep
|
577
|
-
- test/dummy/log/development.log
|
578
|
-
- test/dummy/public/404.html
|
579
|
-
- test/dummy/public/422.html
|
580
|
-
- test/dummy/public/500.html
|
581
|
-
- test/dummy/public/apple-touch-icon-precomposed.png
|
582
|
-
- test/dummy/public/apple-touch-icon.png
|
583
|
-
- test/dummy/public/favicon.ico
|
584
|
-
- test/dummy/tmp/.keep
|
585
|
-
- test/integration/navigation_test.rb
|
586
|
-
- test/test_helper.rb
|
587
|
-
- test/thecore_settings_test.rb
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,20 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
This file defines the default set of CSS styles available in the Rich editor
|
3
|
-
*/
|
4
|
-
|
5
|
-
p.caption {
|
6
|
-
font-style: italic;
|
7
|
-
color: grey;
|
8
|
-
}
|
9
|
-
|
10
|
-
span.highlight {
|
11
|
-
background: yellow;
|
12
|
-
}
|
13
|
-
|
14
|
-
img.left {
|
15
|
-
float: left;
|
16
|
-
}
|
17
|
-
|
18
|
-
img.right {
|
19
|
-
float: right;
|
20
|
-
}
|
File without changes
|
data/app/controllers/.keep
DELETED
File without changes
|
data/app/helpers/.keep
DELETED
File without changes
|
data/app/mailers/.keep
DELETED
File without changes
|
@@ -1,22 +0,0 @@
|
|
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
|
20
|
-
|
21
|
-
# include the extension (loving mixins)
|
22
|
-
RailsAdminSettings::Setting.send(:include, RailsAdminSettings::RailsAdminExtensionConfig)
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'active_support/concern'
|
2
|
-
|
3
|
-
module TheCoreSettingsAbilitiesConcern
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
included do
|
6
|
-
def thecore_settings_abilities user
|
7
|
-
# Rails.logger.debug "Cannot Create"
|
8
|
-
cannot :create, RailsAdminSettings::Setting
|
9
|
-
# Rails.logger.debug "Cannot Delete"
|
10
|
-
cannot :destroy, RailsAdminSettings::Setting
|
11
|
-
cannot :show, RailsAdminSettings::Setting
|
12
|
-
|
13
|
-
# cannot :manage, [RailsAdminSettings::Setting]
|
14
|
-
# cannot :dashboard, [RailsAdminSettings::Setting]
|
15
|
-
# # Pay attention to this errorTypeError (can't convert Class to Array (Class#to_ary gives String)):
|
16
|
-
# can [:index, :update], [RailsAdminSettings::Setting] if user && user.admin?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# include the extension
|
22
|
-
TheCoreAbilities.send(:include, TheCoreSettingsAbilitiesConcern)
|
data/config/routes.rb
DELETED
@@ -1,25 +0,0 @@
|
|
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
|