thecore_settings 1.1.15 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/Dockerfile +20 -0
  3. data/.devcontainer/devcontainer.json +33 -0
  4. data/.github/workflows/gempush.yml +34 -0
  5. data/.gitignore +542 -0
  6. data/.rakeTasks +7 -0
  7. data/.rspec +1 -0
  8. data/.ruby-version +1 -0
  9. data/.travis.yml +31 -0
  10. data/CHANGELOG.md +81 -0
  11. data/Gemfile +4 -0
  12. data/Gemfile.lock +275 -0
  13. data/LICENSE.txt +22 -0
  14. data/README.md +169 -0
  15. data/README.rdoc +68 -0
  16. data/Rakefile +6 -34
  17. data/app/{assets/config/thecore_settings_manifest.js → models/.keep} +0 -0
  18. data/app/models/thecore_settings/setting.rb +77 -0
  19. data/app/views/.keep +0 -0
  20. data/app/views/rails_admin/main/_setting_value.html.haml +41 -0
  21. data/bin/rails +13 -0
  22. data/config/locales/en.yml +29 -0
  23. data/config/locales/{thecore_settings.it.yml → it.yml} +2 -2
  24. data/config/locales/pt-BR.yml +28 -0
  25. data/config/locales/ru.yml +29 -0
  26. data/db/migrate/20161227101954_create_rails_admin_settings.rb +4 -4
  27. data/gemfiles/mongoid-6.0.gemfile +5 -0
  28. data/gemfiles/mongoid-6.3.gemfile +5 -0
  29. data/lib/generators/thecore_settings/migration_generator.rb +15 -0
  30. data/lib/generators/thecore_settings/templates/db/migrate/20161227101954_create_thecore_settings.rb +29 -0
  31. data/lib/generators/thecore_settings/templates/migration.rb +29 -0
  32. data/lib/thecore_settings/determine_mime_type.rb +193 -0
  33. data/lib/thecore_settings/dumper.rb +12 -0
  34. data/lib/thecore_settings/engine.rb +17 -3
  35. data/lib/thecore_settings/fallback.rb +21 -0
  36. data/lib/thecore_settings/hex_color_validator.rb +11 -0
  37. data/lib/thecore_settings/kinds.rb +34 -0
  38. data/lib/thecore_settings/mongoid.rb +19 -0
  39. data/lib/thecore_settings/namespaced.rb +210 -0
  40. data/lib/thecore_settings/processing.rb +217 -0
  41. data/lib/thecore_settings/rails_admin_config.rb +71 -0
  42. data/lib/thecore_settings/require_helpers.rb +86 -0
  43. data/lib/thecore_settings/settings.rb +95 -0
  44. data/lib/thecore_settings/storage/carrier_wave_uploader.rb +9 -0
  45. data/lib/thecore_settings/storage/shrine_uploader.rb +14 -0
  46. data/lib/thecore_settings/tasks.rb +35 -0
  47. data/lib/thecore_settings/uploads.rb +57 -0
  48. data/lib/thecore_settings/validation.rb +126 -0
  49. data/lib/thecore_settings/version.rb +1 -1
  50. data/lib/thecore_settings.rb +115 -123
  51. data/spec/advanced_usage_spec.rb +11 -0
  52. data/spec/carrierwave_spec.rb +41 -0
  53. data/spec/database_trickery_spec.rb +48 -0
  54. data/spec/defaults_spec.rb +87 -0
  55. data/spec/enabling_spec.rb +29 -0
  56. data/spec/factories/setting.rb +8 -0
  57. data/spec/label_spec.rb +16 -0
  58. data/spec/migration_spec.rb +20 -0
  59. data/spec/model_spec.rb +105 -0
  60. data/spec/namespaced_spec.rb +67 -0
  61. data/spec/paperclip_spec.rb +38 -0
  62. data/spec/settings_spec.rb +75 -0
  63. data/spec/shrine_spec.rb +34 -0
  64. data/spec/spec_helper.rb +85 -0
  65. data/spec/support/1024x768.gif +0 -0
  66. data/spec/support/database_cleaner.rb +10 -0
  67. data/spec/support/defaults.yml +23 -0
  68. data/spec/support/defaults_w_file.yml +19 -0
  69. data/spec/support/mongoid.rb +6 -0
  70. data/spec/support/mongoid.yml +6 -0
  71. data/spec/types_spec.rb +101 -0
  72. data/thecore_settings.gemspec +44 -0
  73. metadata +326 -63
  74. data/app/assets/stylesheets/rich/editor.css +0 -20
  75. data/config/initializers/rails_admin_requirements.rb +0 -22
  76. data/config/initializers/thecore_settings_abilities.rb +0 -22
  77. data/config/initializers/thecore_settings_post_init.rb +0 -9
  78. data/config/routes.rb +0 -3
  79. data/db/migrate/20161227101956_add_app_name.rb +0 -5
  80. data/lib/tasks/thecore_settings_tasks.rake +0 -4
@@ -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
- }
@@ -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)
@@ -1,9 +0,0 @@
1
- Rails.application.configure do
2
- config.after_initialize do
3
- # Auto inizializza questa gemma
4
- # require 'rails_admin_settings'
5
- # require 'thecore_settings'
6
- # require 'rails_admin_requirements'
7
- # require 'thecore_settings_abilities'
8
- end
9
- end
data/config/routes.rb DELETED
@@ -1,3 +0,0 @@
1
- Rails.application.routes.draw do
2
- # mount Rich::Engine => '/rich', :as => 'rich'
3
- end
@@ -1,5 +0,0 @@
1
- class AddAppName < ActiveRecord::Migration[5.0]
2
- def change
3
- Settings.app_name = "The Core by Gabriele Tassoni"
4
- end
5
- end
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :thecore_settings do
3
- # # Task goes here
4
- # end