thecore_settings 1.1.13 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +20 -0
- data/.devcontainer/devcontainer.json +33 -0
- data/.github/workflows/gempush.yml +34 -0
- data/.gitignore +542 -0
- data/.rakeTasks +7 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +31 -0
- data/CHANGELOG.md +81 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +275 -0
- data/LICENSE.txt +22 -0
- data/README.md +169 -0
- data/README.rdoc +68 -0
- data/Rakefile +6 -34
- data/app/assets/images/thecore_settings/.keep +0 -0
- data/app/assets/javascripts/thecore_settings/.keep +0 -0
- 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/app/models/.keep +0 -0
- data/app/models/rails_admin_settings/setting.rb +77 -0
- data/app/views/.keep +0 -0
- data/app/views/rails_admin/main/_setting_value.html.haml +41 -0
- data/assets/javascripts/rails_admin/custom/thecore_settings.rb +2 -0
- data/bin/rails +13 -0
- data/{lib → config/initializers}/rails_admin_requirements.rb +0 -2
- data/config/initializers/thecore_settings_abilities.rb +22 -0
- data/config/initializers/thecore_settings_post_init.rb +0 -5
- data/config/locales/en.yml +29 -0
- data/config/locales/pt-BR.yml +28 -0
- data/config/locales/ru.yml +29 -0
- data/config/locales/thecore_settings.it.yml +2 -2
- data/db/migrate/20161227101954_create_rails_admin_settings.rb +3 -3
- data/gemfiles/mongoid-6.0.gemfile +5 -0
- data/gemfiles/mongoid-6.3.gemfile +5 -0
- data/lib/generators/rails_admin_settings/migration_generator.rb +15 -0
- data/lib/generators/rails_admin_settings/templates/db/migrate/20161227101954_create_thecore_settings.rb +29 -0
- data/lib/generators/rails_admin_settings/templates/migration.rb +29 -0
- data/lib/thecore_settings/determine_mime_type.rb +193 -0
- data/lib/thecore_settings/dumper.rb +12 -0
- data/lib/thecore_settings/engine.rb +18 -4
- data/lib/thecore_settings/fallback.rb +21 -0
- data/lib/thecore_settings/hex_color_validator.rb +11 -0
- data/lib/thecore_settings/kinds.rb +34 -0
- data/lib/thecore_settings/mongoid.rb +19 -0
- data/lib/thecore_settings/namespaced.rb +210 -0
- data/lib/thecore_settings/processing.rb +217 -0
- data/lib/thecore_settings/rails_admin_config.rb +71 -0
- data/lib/thecore_settings/require_helpers.rb +86 -0
- data/lib/thecore_settings/settings.rb +95 -0
- data/lib/thecore_settings/storage/carrier_wave_uploader.rb +9 -0
- data/lib/thecore_settings/storage/shrine_uploader.rb +14 -0
- data/lib/thecore_settings/tasks.rb +35 -0
- data/lib/thecore_settings/uploads.rb +57 -0
- data/lib/thecore_settings/validation.rb +126 -0
- data/lib/thecore_settings/version.rb +1 -1
- data/lib/thecore_settings.rb +115 -123
- data/log/development.log +0 -0
- data/spec/advanced_usage_spec.rb +11 -0
- data/spec/carrierwave_spec.rb +41 -0
- data/spec/database_trickery_spec.rb +48 -0
- data/spec/defaults_spec.rb +87 -0
- data/spec/enabling_spec.rb +29 -0
- data/spec/factories/setting.rb +8 -0
- data/spec/label_spec.rb +16 -0
- data/spec/migration_spec.rb +20 -0
- data/spec/model_spec.rb +105 -0
- data/spec/namespaced_spec.rb +67 -0
- data/spec/paperclip_spec.rb +38 -0
- data/spec/settings_spec.rb +75 -0
- data/spec/shrine_spec.rb +34 -0
- data/spec/spec_helper.rb +85 -0
- data/spec/support/1024x768.gif +0 -0
- data/spec/support/database_cleaner.rb +10 -0
- data/spec/support/defaults.yml +23 -0
- data/spec/support/defaults_w_file.yml +19 -0
- data/spec/support/mongoid.rb +6 -0
- data/spec/support/mongoid.yml +6 -0
- data/spec/types_spec.rb +101 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +4 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/javascripts/cable.js +13 -0
- data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +34 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/config/application.rb +15 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +9 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +54 -0
- data/test/dummy/config/environments/production.rb +86 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/new_framework_defaults.rb +24 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/puma.rb +47 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config.ru +5 -0
- 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 +16 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- 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 +8 -0
- data/test/test_helper.rb +19 -0
- data/test/thecore_settings_test.rb +7 -0
- data/thecore_settings.gemspec +44 -0
- metadata +459 -57
- data/lib/thecore_settings_abilities.rb +0 -22
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'active_support/concern'
|
2
|
-
|
3
|
-
require 'rails_admin_settings'
|
4
|
-
|
5
|
-
module TheCoreSettingsAbilitiesConcern
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
included do
|
8
|
-
def thecore_settings_abilities user
|
9
|
-
cannot :manage, [RailsAdminSettings::Setting]
|
10
|
-
cannot :dashboard, [RailsAdminSettings::Setting]
|
11
|
-
# Pay attention to this errorTypeError (can't convert Class to Array (Class#to_ary gives String)):
|
12
|
-
if user && user.admin?
|
13
|
-
can [:index, :update], [RailsAdminSettings::Setting]
|
14
|
-
cannot [:show, :destroy, :create], [RailsAdminSettings::Setting]
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# include the extension
|
22
|
-
TheCoreAbilities.send(:include, TheCoreSettingsAbilitiesConcern)
|