thecore_settings 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c4754b64f4934c08f538c3871947d5d87e40bff6
4
+ data.tar.gz: fb0711767334eabf2d6ec715c38cf7697264bca4
5
+ SHA512:
6
+ metadata.gz: 4af1df29eb64be4dc302ff01a905f807bf93090027b94e94ea07cfd46a30e83604ff67869e6b311d2e8fdb9eda5329359c261c6e4e45c403ea1787cfb001daad
7
+ data.tar.gz: 400de0fbe4c650e18c43647f6b9b22d7b75058e87d62891ed262470eabb841e1f91693b993d0e5705ff032d04b20f705127a6f86a488e54a48036f1f68591af7
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Gabriele Tassoni
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'ThecoreSettings'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ require 'bundler/gem_tasks'
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+
37
+ task default: :test
File without changes
@@ -0,0 +1 @@
1
+ //=require rich/base
@@ -0,0 +1,20 @@
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
+ }
@@ -0,0 +1,9 @@
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
@@ -0,0 +1,27 @@
1
+ it:
2
+ admin:
3
+ settings:
4
+ label: 'Impostazioni'
5
+ no_ckeditor_detected: CKEditor non trovato &mdash; mostro il campo come semplice testo
6
+ phone_invalid: Telefono non valido
7
+ phones_invalid: "Telefono non valido: %{phones}"
8
+ email_invalid: Email non valida
9
+ yaml_invalid: YAML non valido
10
+ color_invalid: Colore non valido
11
+ mongoid: &mongoid
12
+ models:
13
+ rails_admin_settings/setting: Configurazioni
14
+ attributes:
15
+ rails_admin_settings/setting:
16
+ c_at: Creato
17
+ u_at: Modificato
18
+ enabled: Abilitato
19
+ ns: Gruppo
20
+ name: Nome
21
+ key: Chiave
22
+ raw: Valore
23
+ type: Tipo
24
+ kind: Tipo
25
+ label: Etichetta
26
+ activerecord:
27
+ <<: *mongoid
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ # mount Rich::Engine => '/rich', :as => 'rich'
3
+ 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,20 @@
1
+ require 'rails_admin_settings'
2
+
3
+ module RailsAdminSettings
4
+ module RailsAdminExtensionConfig
5
+ def self.included(base)
6
+ # IMPORTANT: To extend rails admin section in model, directly, instead of using concerns, I can
7
+ # extend the included method. Be sure to use a different module name, otherwis it will be overwritten
8
+ # See thecore_settings_rails_admin_model_extensions.rb initializer for a reference
9
+ # on how to extend rails_admin section of a model previously defined (say it's defined in another gem)
10
+ if base.respond_to?(:rails_admin)
11
+ base.rails_admin do
12
+ navigation_icon 'fa fa-cogs'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ # include the extension (loving mixins)
20
+ RailsAdminSettings::Setting.send(:include, RailsAdminSettings::RailsAdminExtensionConfig)
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :thecore_settings do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,12 @@
1
+ module ThecoreSettings
2
+ class Engine < ::Rails::Engine
3
+ initializer "thecore_settings.add_to_migrations" do |app|
4
+ unless app.root.to_s == root.to_s
5
+ # APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
6
+ config.paths["db/migrate"].expanded.each do |expanded_path|
7
+ app.config.paths["db/migrate"] << expanded_path
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module ThecoreSettings
2
+ VERSION = '1.1.8'
3
+ end
@@ -0,0 +1,127 @@
1
+ require "thecore_settings/engine"
2
+ #require "rich"
3
+ require "russian_phone"
4
+ require "sanitize"
5
+ require "safe_yaml"
6
+ require "validates_email_format_of"
7
+ require "geocoder"
8
+ require "paperclip"
9
+ require "addressable"
10
+ require "rails_admin_settings"
11
+
12
+ module ThecoreSettings
13
+ # Your code goes here...
14
+ SafeYAML::OPTIONS[:default_mode] = :safe
15
+ SafeYAML::OPTIONS[:deserialize_symbols] = false
16
+ #
17
+ # if Object.const_defined?("Rich")
18
+ # Rich.setup do |config|
19
+ #
20
+ # # == CKEditor configuration
21
+ # #
22
+ # # Rich ships with what I hope are sensible defaults.
23
+ # # You may want to override these.
24
+ # #
25
+ # # For example, the elements available in the formats
26
+ # # dropdown are defined like this:
27
+ # # config.editor[:format_tags] = "h3;p;pre"
28
+ # #
29
+ # # By default, Rich visualizes what type of element
30
+ # # you are editing. To disable this:
31
+ # # config.editor[:startupOutlineBlocks] = false
32
+ #
33
+ #
34
+ # # == Image styles
35
+ # #
36
+ # # Rich uses paperclip for image processing. You can
37
+ # # define the styles you would like to use here. You
38
+ # # can use the standard syntax allowed by paperclip.
39
+ # # See: https://github.com/thoughtbot/paperclip/wiki/Thumbnail-Generation
40
+ # #
41
+ # # When you change these after uploading some files,
42
+ # # remember to re-generate your styles by running:
43
+ # # rake rich:refresh_assets
44
+ # config.image_styles = {
45
+ # :thumb => "100x100#"
46
+ # }
47
+ #
48
+ # # == Convert options
49
+ # #
50
+ # # You can pass additional commands to ImageMagick to set image quality,
51
+ # # apply a blur, and other fancy tricks.
52
+ # #
53
+ # # Example (this will make your image look terrible):
54
+ # # config.convert_options = {
55
+ # # :large => '-quality 1'
56
+ # # }
57
+ #
58
+ # # == Allowed styles (in file manager)
59
+ # #
60
+ # # Of the styles specified above, which should be user
61
+ # # selectable in the file manager?
62
+ # #
63
+ # # Example:
64
+ # # config.allowed_styles = [ :large, :thumb ]
65
+ # #
66
+ # # Default:
67
+ # # config.allowed_styles = :all
68
+ #
69
+ # # == Default Style
70
+ # #
71
+ # # The style to insert by default. In addition to the
72
+ # # styles defined above you can also use :original to get
73
+ # # the unprocessed file. Make sure this style exists.
74
+ # config.default_style = :thumb
75
+ #
76
+ # # == Upload non-image files
77
+ # #
78
+ # # Setting this option to true will add a second Rich filebrowser icon to
79
+ # # the editor toolbar. In this filebrowser you can upload non-image files.
80
+ # # Inserting these files into your editor will result in a direct (A) link.
81
+ # #
82
+ # # Default:
83
+ # # config.allow_document_uploads = false
84
+ #
85
+ # # == Set allowed filetypes for non-image files
86
+ # #
87
+ # # If you want, you can restrict the types of documents that users can upload.
88
+ # # Default behavior is to allow any kind of file to be uploaded. You can set
89
+ # # the accepted types by providing an array of mimetypes to check against.
90
+ # # Note that for this to have any effect, you first need to enable document
91
+ # # uploads using the setting above.
92
+ # #
93
+ # # Default, allow any file to be uploaded:
94
+ # # config.allowed_document_types = :all
95
+ # #
96
+ # # Example, only allow PDF uploads:
97
+ # # config.allowed_document_types = ['application/pdf']
98
+ #
99
+ # # == Asset insertion
100
+ # #
101
+ # # Set this to true to keep the filebrowser open after inserting an asset.
102
+ # # Also configurable per-use from within the filebrowser.
103
+ # #
104
+ # # Default:
105
+ # # config.insert_many = false
106
+ #
107
+ # # == User Authentication
108
+ # #
109
+ # # When defined, Rich will automatically call this method
110
+ # # in a before filter to ensure that the user is logged in.
111
+ # #
112
+ # # If you do not change this value from the default, anyone
113
+ # # will be able to see your images, and upload files.
114
+ # #
115
+ # # Example for Devise with an AdminUser model:
116
+ # # config.authentication_method = :authenticate_admin_user!
117
+ # #
118
+ # # Default (NOT recommended in production environments):
119
+ # # config.authentication_method = :none
120
+ # config.authentication_method = :authenticate_user!
121
+ #
122
+ # end
123
+ #
124
+ # Rich.insert
125
+ # end
126
+
127
+ end
@@ -0,0 +1,21 @@
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
+ # Pay attention to this errorTypeError (can't convert Class to Array (Class#to_ary gives String)):
11
+ if user && user.admin?
12
+ can [:index, :update], [RailsAdminSettings::Setting]
13
+ cannot [:show, :destroy, :create], [RailsAdminSettings::Setting]
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+
20
+ # include the extension
21
+ TheCoreAbilities.send(:include, TheCoreSettingsAbilitiesConcern)
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: thecore_settings
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.8
5
+ platform: ruby
6
+ authors:
7
+ - Gabriele Tassoni
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-01-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thecore
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: russian_phone
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sanitize
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.5'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '4.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: safe_yaml
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: validates_email_format_of
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.6'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.6'
83
+ - !ruby/object:Gem::Dependency
84
+ name: geocoder
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.4'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.4'
97
+ - !ruby/object:Gem::Dependency
98
+ name: paperclip
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '5.1'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '5.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: addressable
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.5'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.5'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rails_admin_settings
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '1.3'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.3'
139
+ description: Automagically manage settings.
140
+ email:
141
+ - gabrieletassoni@taris.it
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - MIT-LICENSE
147
+ - Rakefile
148
+ - app/assets/config/thecore_settings_manifest.js
149
+ - app/assets/javascripts/rich.js
150
+ - app/assets/stylesheets/rich/editor.css
151
+ - config/initializers/thecore_settings_post_init.rb
152
+ - config/locales/thecore_settings.it.yml
153
+ - config/routes.rb
154
+ - db/migrate/20161227101954_create_rails_admin_settings.rb
155
+ - db/migrate/20161227101956_add_app_name.rb
156
+ - lib/rails_admin_requirements.rb
157
+ - lib/tasks/thecore_settings_tasks.rake
158
+ - lib/thecore_settings.rb
159
+ - lib/thecore_settings/engine.rb
160
+ - lib/thecore_settings/version.rb
161
+ - lib/thecore_settings_abilities.rb
162
+ homepage: https://taris.it
163
+ licenses:
164
+ - MIT
165
+ metadata: {}
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ requirements: []
181
+ rubyforge_project:
182
+ rubygems_version: 2.6.14
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: Adds settings section.
186
+ test_files: []