trusty-cms 4.1.1 → 4.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/Gemfile.lock +107 -107
- data/README.md +1 -1
- data/Rakefile +7 -7
- data/app/assets/javascripts/admin/assets.js +1 -1
- data/app/assets/javascripts/rad_social/rad_ajax_form.js +3 -0
- data/app/assets/javascripts/rad_social/rad_email.js +0 -1
- data/app/assets/javascripts/rad_social/rad_email_form.js +2 -7
- data/app/assets/stylesheets/admin/partials/_forms.scss +1 -1
- data/app/assets/stylesheets/rad_social/rad_screen.scss +0 -4
- data/app/controllers/admin/assets_controller.rb +21 -31
- data/app/controllers/admin/configuration_controller.rb +9 -11
- data/app/controllers/admin/extensions_controller.rb +3 -3
- data/app/controllers/admin/layouts_controller.rb +3 -4
- data/app/controllers/admin/page_attachments_controller.rb +5 -5
- data/app/controllers/admin/page_fields_controller.rb +3 -4
- data/app/controllers/admin/page_parts_controller.rb +4 -5
- data/app/controllers/admin/pages_controller.rb +55 -56
- data/app/controllers/admin/references_controller.rb +1 -1
- data/app/controllers/admin/resource_controller.rb +132 -130
- data/app/controllers/admin/sites_controller.rb +4 -4
- data/app/controllers/admin/snippets_controller.rb +3 -4
- data/app/controllers/admin/users_controller.rb +16 -16
- data/app/controllers/application_controller.rb +47 -48
- data/app/controllers/site_controller.rb +51 -48
- data/app/controllers/social_mailer_controller.rb +12 -22
- data/app/helpers/admin/configuration_helper.rb +19 -20
- data/app/helpers/admin/layouts_helper.rb +0 -1
- data/app/helpers/admin/node_helper.rb +27 -24
- data/app/helpers/admin/pages_helper.rb +2 -2
- data/app/helpers/admin/preferences_helper.rb +0 -1
- data/app/helpers/admin/references_helper.rb +9 -10
- data/app/helpers/admin/regions_helper.rb +3 -3
- data/app/helpers/application_helper.rb +32 -33
- data/app/helpers/rad_social_helper.rb +8 -11
- data/app/helpers/scoped_helper.rb +1 -3
- data/app/helpers/sites_helper.rb +4 -4
- data/app/mailers/devise_mailer.rb +3 -4
- data/app/mailers/rad_social_mailer.rb +8 -8
- data/app/models/asset.rb +62 -63
- data/app/models/asset_type.rb +38 -39
- data/app/models/deprecated_tags.rb +3 -4
- data/app/models/file_not_found_page.rb +1 -3
- data/app/models/haml_filter.rb +1 -1
- data/app/models/layout.rb +4 -5
- data/app/models/legacy_user.rb +2 -2
- data/app/models/menu_renderer.rb +16 -18
- data/app/models/page.rb +96 -93
- data/app/models/page_attachment.rb +1 -2
- data/app/models/page_context.rb +11 -12
- data/app/models/page_part.rb +3 -4
- data/app/models/rails_page.rb +10 -12
- data/app/models/site.rb +22 -21
- data/app/models/snippet.rb +6 -8
- data/app/models/snippet_finder.rb +3 -3
- data/app/models/snippet_tags.rb +4 -4
- data/app/models/standard_tags.rb +258 -252
- data/app/models/status.rb +8 -8
- data/app/models/trusty_cms/config.rb +25 -25
- data/app/models/trusty_cms/page_response_cache_director.rb +2 -3
- data/app/models/user.rb +15 -14
- data/app/models/user_action_observer.rb +3 -3
- data/app/views/admin/assets/edit.html.haml +3 -9
- data/app/views/admin/assets/new.html.haml +0 -3
- data/app/views/admin/assets/remove.html.haml +1 -1
- data/app/views/admin/layouts/remove.html.haml +3 -2
- data/app/views/admin/page_parts/_page_part.html.haml +1 -1
- data/app/views/admin/snippets/remove.html.haml +3 -2
- data/app/views/rad_social_mailer/social_mail_form.html.haml +1 -3
- data/app/views/widget/_email_form.html.haml +0 -5
- data/bin/rails +4 -4
- data/bin/trusty_cms +3 -5
- data/config.ru +1 -1
- data/config/application.rb +14 -15
- data/config/boot.rb +1 -2
- data/config/environment.rb +1 -1
- data/config/environments/production.rb +0 -1
- data/config/environments/test.rb +1 -2
- data/config/initializers/devise.rb +1 -1
- data/config/initializers/kraken.rb +2 -2
- data/config/initializers/tmp.rb +1 -1
- data/config/initializers/trusty_cms_config.rb +48 -48
- data/config/locales/en.yml +5 -4
- data/config/routes.rb +6 -7
- data/lib/active_record_extensions/active_record_extensions.rb +1 -2
- data/lib/annotatable.rb +3 -5
- data/lib/configuration_extensions/configuration_extensions.rb +1 -1
- data/lib/inheritable_class_attributes.rb +13 -9
- data/lib/login_system.rb +73 -73
- data/lib/method_observer.rb +13 -12
- data/lib/ostruct.rb +7 -10
- data/lib/simpleton.rb +0 -4
- data/lib/string_extensions/string_extensions.rb +3 -3
- data/lib/symbol_extensions/symbol_extensions.rb +1 -1
- data/lib/tasks/database.rake +28 -28
- data/lib/tasks/extensions.rake +18 -18
- data/lib/tasks/framework.rake +68 -68
- data/lib/tasks/radiant_config.rake +4 -4
- data/lib/tasks/snippets_extension_tasks.rake +11 -11
- data/lib/tasks/translate.rake +14 -14
- data/lib/tasks/upgrade_to_devise.rake +1 -1
- data/lib/translation_support.rb +22 -22
- data/lib/trusty_cms.rb +2 -2
- data/lib/trusty_cms/admin_ui.rb +19 -16
- data/lib/trusty_cms/admin_ui/region_partials.rb +4 -3
- data/lib/trusty_cms/admin_ui/region_set.rb +4 -5
- data/lib/trusty_cms/available_locales.rb +2 -4
- data/lib/trusty_cms/config/definition.rb +11 -8
- data/lib/trusty_cms/engine.rb +13 -14
- data/lib/trusty_cms/extension.rb +14 -16
- data/lib/trusty_cms/extension_loader.rb +6 -6
- data/lib/trusty_cms/extension_migrator.rb +42 -41
- data/lib/trusty_cms/extension_path.rb +20 -19
- data/lib/trusty_cms/initializer.rb +5 -8
- data/lib/trusty_cms/pagination/controller.rb +7 -10
- data/lib/trusty_cms/pagination/link_renderer.rb +2 -2
- data/lib/trusty_cms/resource_responses.rb +3 -3
- data/lib/trusty_cms/setup.rb +130 -132
- data/lib/trusty_cms/taggable.rb +19 -22
- data/lib/trusty_cms/task_support.rb +9 -6
- data/package.json +1 -1
- data/public/dispatch.fcgi +1 -1
- data/public/dispatch.rb +2 -2
- data/script/extension +1 -1
- data/script/rails +2 -2
- data/spec/dummy/package.json +1 -1
- data/spec/dummy/yarn.lock +3 -3
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/core.js +126 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/index.js +4 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/map.js +56 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/seq.js +43 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/string.js +28 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/index.js +36 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/json.js +76 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/options.js +23 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/binary.js +87 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/index.js +157 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/omap.js +142 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/pairs.js +81 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/set.js +114 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/timestamp.js +97 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/core.js +114 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/index.js +17 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/map.js +37 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/seq.js +34 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/string.js +40 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/index.js +62 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/json.js +60 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/options.js +35 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/binary.js +97 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/index.js +131 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/omap.js +105 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/pairs.js +80 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/set.js +91 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/timestamp.js +93 -0
- data/trusty_cms.gemspec +25 -25
- data/vendor/extensions/clipped-extension/lib/clipped_admin_ui.rb +1 -1
- data/yarn.lock +7 -7
- metadata +7609 -105
- data/app/assets/javascripts/rad_social/captcha.js +0 -42
- data/app/views/admin/assets/refresh.html.haml +0 -14
data/bin/trusty_cms
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
ENV[
|
3
|
+
ENV['RAILS_ENV'] ||= 'production'
|
4
4
|
|
5
5
|
$LOAD_PATH << File.join(File.dirname(__FILE__), '..')
|
6
6
|
|
7
7
|
require 'ruby_version_check'
|
8
|
-
Signal.trap(
|
8
|
+
Signal.trap('INT') { puts; exit }
|
9
9
|
|
10
10
|
require 'trusty_cms'
|
11
11
|
if ARGV.any? { |arg| %w(--version -v).any? { |flag| arg == flag } }
|
@@ -19,7 +19,6 @@ require 'rails_generator'
|
|
19
19
|
require 'rails_generator/scripts/generate'
|
20
20
|
|
21
21
|
class Rails::Generator::Base
|
22
|
-
|
23
22
|
def self.use_application_sources!
|
24
23
|
reset_sources
|
25
24
|
sources << Rails::Generator::PathSource.new(:builtin, "#{File.dirname(__FILE__)}/../lib/generators")
|
@@ -46,7 +45,6 @@ class Rails::Generator::Base
|
|
46
45
|
end
|
47
46
|
end
|
48
47
|
end
|
49
|
-
|
50
48
|
end
|
51
49
|
|
52
|
-
Rails::Generators.invoke(
|
50
|
+
Rails::Generators.invoke('trusty_cms', [ARGV])
|
data/config.ru
CHANGED
data/config/application.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path('
|
1
|
+
require File.expand_path('boot', __dir__)
|
2
2
|
|
3
3
|
require 'rails/all'
|
4
4
|
require 'acts_as_tree'
|
@@ -10,9 +10,8 @@ require 'rack/cache'
|
|
10
10
|
require 'trustygems'
|
11
11
|
require 'devise'
|
12
12
|
|
13
|
-
|
14
13
|
if defined?(Bundler)
|
15
|
-
Bundler.require(*Rails.groups(:
|
14
|
+
Bundler.require(*Rails.groups(assets: %w(development test)))
|
16
15
|
end
|
17
16
|
|
18
17
|
module TrustyCms
|
@@ -30,12 +29,12 @@ module TrustyCms
|
|
30
29
|
|
31
30
|
# Initialize extension paths
|
32
31
|
config.initialize_extension_paths
|
33
|
-
extension_loader = ExtensionLoader.instance {|l| l.initializer = self }
|
32
|
+
extension_loader = ExtensionLoader.instance { |l| l.initializer = self }
|
34
33
|
extension_loader.paths(:load).reverse_each do |path|
|
35
34
|
config.autoload_paths.unshift path
|
36
35
|
$LOAD_PATH.unshift path
|
37
36
|
end
|
38
|
-
paths[
|
37
|
+
paths['app/helpers'] = []
|
39
38
|
# config.add_plugin_paths(extension_loader.paths(:plugin))
|
40
39
|
trusty_locale_paths = Dir[File.join(TRUSTY_CMS_ROOT, 'config', 'locales', '*.{rb,yml}')]
|
41
40
|
config.i18n.load_path = trusty_locale_paths + extension_loader.paths(:locale)
|
@@ -44,16 +43,16 @@ module TrustyCms
|
|
44
43
|
config.encoding = 'utf-8'
|
45
44
|
|
46
45
|
config.middleware.use Rack::Cache,
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
46
|
+
private_headers: ['Authorization'],
|
47
|
+
entitystore: 'trusty:tmp/cache/entity',
|
48
|
+
metastore: 'trusty:tmp/cache/meta',
|
49
|
+
verbose: false,
|
50
|
+
allow_reload: false,
|
51
|
+
allow_revalidate: false
|
53
52
|
config.middleware.insert_before(Rack::ConditionalGet, Rack::Cache)
|
54
53
|
config.assets.enabled = true
|
55
54
|
|
56
|
-
config.filter_parameters += [
|
55
|
+
config.filter_parameters += %i[password password_confirmation]
|
57
56
|
|
58
57
|
# Use the database for sessions instead of the cookie-based default,
|
59
58
|
# which shouldn't be used to store highly confidential information
|
@@ -83,9 +82,9 @@ module TrustyCms
|
|
83
82
|
extension_loader.load_extensions
|
84
83
|
extension_loader.load_extension_initalizers
|
85
84
|
|
86
|
-
extension_loader.activate_extensions
|
87
|
-
#config.add_controller_paths(extension_loader.paths(:controller))
|
88
|
-
#config.add_eager_load_paths(extension_loader.paths(:eager_load))
|
85
|
+
extension_loader.activate_extensions # also calls initialize_views
|
86
|
+
# config.add_controller_paths(extension_loader.paths(:controller))
|
87
|
+
# config.add_eager_load_paths(extension_loader.paths(:eager_load))
|
89
88
|
|
90
89
|
# Add new inflection rules using the following format:
|
91
90
|
ActiveSupport::Inflector.inflections do |inflect|
|
data/config/boot.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Don't change this file!
|
2
2
|
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
3
|
|
4
|
-
|
5
4
|
# Set up gems listed in the Gemfile.
|
6
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('
|
5
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
7
6
|
|
8
7
|
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
data/config/environment.rb
CHANGED
data/config/environments/test.rb
CHANGED
@@ -18,13 +18,12 @@ TrustyCms::Application.configure do
|
|
18
18
|
# end
|
19
19
|
|
20
20
|
# Log error messages when you accidentally call methods on nil.
|
21
|
-
config.whiny_nils
|
21
|
+
config.whiny_nils = true
|
22
22
|
|
23
23
|
# Show full error reports and disable caching
|
24
24
|
config.consider_all_requests_local = true
|
25
25
|
config.action_controller.perform_caching = false
|
26
26
|
|
27
|
-
|
28
27
|
# Raise an ActiveModel::MassAssignmentSecurity::Error any time
|
29
28
|
# something is mass-assigned that shouldn't be for ease in debugging.
|
30
29
|
# config.active_record.mass_assignment_sanitizer = :strict
|
@@ -20,7 +20,7 @@ Devise.setup do |config|
|
|
20
20
|
|
21
21
|
# ==> Controller configuration
|
22
22
|
# Configure the parent class to the devise controllers.
|
23
|
-
#config.parent_controller = 'ApplicationController'
|
23
|
+
# config.parent_controller = 'ApplicationController'
|
24
24
|
|
25
25
|
# ==> Mailer Configuration
|
26
26
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
data/config/initializers/tmp.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'fileutils'
|
2
|
-
FileUtils.mkdir_p(Rails.root.join(
|
2
|
+
FileUtils.mkdir_p(Rails.root.join('tmp', 'stylesheets'))
|
@@ -2,47 +2,47 @@ require 'multi_site/engine'
|
|
2
2
|
require 'clipped/engine'
|
3
3
|
|
4
4
|
TrustyCms.config do |config|
|
5
|
-
config.define 'admin.title', :
|
5
|
+
config.define 'admin.title', default: 'TrustyCms CMS'
|
6
6
|
config.define 'dev.host'
|
7
|
-
config.define 'local.timezone', :
|
8
|
-
config.define 'defaults.locale', :
|
9
|
-
config.define 'defaults.page.parts', :
|
10
|
-
config.define 'defaults.page.status', :
|
11
|
-
config.define 'defaults.page.filter', :
|
7
|
+
config.define 'local.timezone', allow_change: true, select_from: lambda { ActiveSupport::TimeZone::MAPPING.keys.sort }
|
8
|
+
config.define 'defaults.locale', select_from: lambda { TrustyCms::AvailableLocales.locales }, allow_blank: true
|
9
|
+
config.define 'defaults.page.parts', default: 'Body,Extended'
|
10
|
+
config.define 'defaults.page.status', select_from: lambda { Status.selectable_values }, allow_blank: false, default: 'Draft'
|
11
|
+
config.define 'defaults.page.filter', select_from: lambda { TextFilter.descendants.map { |s| s.filter_name }.sort }, allow_blank: true
|
12
12
|
config.define 'defaults.page.fields'
|
13
|
-
config.define 'pagination.param_name', :
|
14
|
-
config.define 'pagination.per_page_param_name', :
|
15
|
-
config.define 'admin.pagination.per_page', :
|
16
|
-
config.define 'site.title', :
|
17
|
-
config.define 'site.host', :
|
18
|
-
config.define 'user.allow_password_reset?', :
|
19
|
-
config.define 'session_timeout', :
|
13
|
+
config.define 'pagination.param_name', default: 'page'
|
14
|
+
config.define 'pagination.per_page_param_name', default: 'per_page'
|
15
|
+
config.define 'admin.pagination.per_page', type: :integer, default: 50
|
16
|
+
config.define 'site.title', default: 'Your site title', allow_blank: false
|
17
|
+
config.define 'site.host', default: 'www.example.com', allow_blank: false
|
18
|
+
config.define 'user.allow_password_reset?', default: true
|
19
|
+
config.define 'session_timeout', default: 2.weeks
|
20
20
|
require 'multi_site/scoped_validation'
|
21
21
|
end
|
22
22
|
|
23
23
|
TrustyCms.config do |config|
|
24
24
|
config.namespace 'paperclip' do |pc|
|
25
|
-
pc.define 'url', :
|
26
|
-
pc.define 'path', :
|
27
|
-
pc.define 'skip_filetype_validation', :
|
28
|
-
pc.define 'storage', :
|
29
|
-
:
|
30
|
-
'File System'
|
31
|
-
'Amazon S3'
|
32
|
-
'Google Storage'
|
33
|
-
'Rackspace Cloud Files'
|
25
|
+
pc.define 'url', default: '/system/:attachment/:id/:style/:basename:no_original_style.:extension', allow_change: true
|
26
|
+
pc.define 'path', default: ':rails_root/public/system/:attachment/:id/:style/:basename:no_original_style.:extension', allow_change: true
|
27
|
+
pc.define 'skip_filetype_validation', default: true, type: :boolean
|
28
|
+
pc.define 'storage', default: 'filesystem',
|
29
|
+
select_from: {
|
30
|
+
'File System' => 'filesystem',
|
31
|
+
'Amazon S3' => 'fog',
|
32
|
+
'Google Storage' => 'fog',
|
33
|
+
'Rackspace Cloud Files' => 'fog',
|
34
34
|
},
|
35
|
-
:
|
36
|
-
:
|
35
|
+
allow_blank: false,
|
36
|
+
allow_display: false
|
37
37
|
|
38
38
|
pc.namespace 'fog' do |fog|
|
39
|
-
fog.define 'provider', :
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
fog.define 'provider', select_from: {
|
40
|
+
'Amazon S3' => 'AWS',
|
41
|
+
'Google Storage' => 'Google',
|
42
|
+
'Rackspace Cloud Files' => 'Rackspace',
|
43
|
+
}
|
44
44
|
fog.define 'directory'
|
45
|
-
fog.define 'public?', :
|
45
|
+
fog.define 'public?', default: true
|
46
46
|
fog.define 'host'
|
47
47
|
end
|
48
48
|
|
@@ -59,35 +59,35 @@ TrustyCms.config do |config|
|
|
59
59
|
pc.namespace 's3' do |s3|
|
60
60
|
s3.define 'key'
|
61
61
|
s3.define 'secret'
|
62
|
-
s3.define 'region', :
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
62
|
+
s3.define 'region', select_from: {
|
63
|
+
'Asia North East' => 'ap-northeast-1',
|
64
|
+
'Asia South East' => 'ap-southeast-1',
|
65
|
+
'EU West' => 'eu-west-1',
|
66
|
+
'US East' => 'us-east-1',
|
67
|
+
'US West' => 'us-west-1',
|
68
|
+
}
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
config.namespace 'assets', :
|
73
|
-
assets.define 'create_image_thumbnails?', :
|
74
|
-
assets.define 'create_video_thumbnails?', :
|
75
|
-
assets.define 'create_pdf_thumbnails?', :
|
72
|
+
config.namespace 'assets', allow_display: false do |assets|
|
73
|
+
assets.define 'create_image_thumbnails?', default: 'true'
|
74
|
+
assets.define 'create_video_thumbnails?', default: 'true'
|
75
|
+
assets.define 'create_pdf_thumbnails?', default: 'true'
|
76
76
|
|
77
77
|
assets.namespace 'thumbnails' do |thumbs| # NB :icon and :thumbnail are already defined as fixed formats for use in the admin interface and can't be changed
|
78
|
-
thumbs.define 'image', :
|
79
|
-
thumbs.define 'video', :
|
80
|
-
thumbs.define 'pdf', :
|
78
|
+
thumbs.define 'image', default: 'normal:size=640x640>|small:size=320x320>'
|
79
|
+
thumbs.define 'video', default: 'normal:size=640x640>,format=jpg|small:size=320x320>,format=jpg'
|
80
|
+
thumbs.define 'pdf', default: 'normal:size=640x640>,format=jpg|small:size=320x320>,format=jpg'
|
81
81
|
end
|
82
82
|
|
83
|
-
assets.define 'max_asset_size', :
|
84
|
-
assets.define 'display_size', :
|
85
|
-
assets.define 'insertion_size', :
|
83
|
+
assets.define 'max_asset_size', default: 5, type: :integer, units: 'MB'
|
84
|
+
assets.define 'display_size', default: 'normal', allow_blank: true
|
85
|
+
assets.define 'insertion_size', default: 'normal', allow_blank: true
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
89
|
if TrustyCms.config_definitions['defaults.snippet.filter'].nil?
|
90
|
-
TrustyCms.config.define 'defaults.snippet.filter', :
|
90
|
+
TrustyCms.config.define 'defaults.snippet.filter', select_from: lambda { TextFilter.descendants.map { |s| s.filter_name }.sort }, allow_blank: true
|
91
91
|
end
|
92
92
|
|
93
93
|
Admin::LayoutsController.send :helper, MultiSite::SiteChooserHelper
|
data/config/locales/en.yml
CHANGED
@@ -65,6 +65,7 @@ en:
|
|
65
65
|
asset_errors: 'Sorry. {{errors}}'
|
66
66
|
asset_page_attachment_note: 'Attached assets. These can be inserted with drag and drop or shown with the <code><r:assets:each /></code> tag.'
|
67
67
|
asset_note: 'Attached assets. '
|
68
|
+
asset_url: 'Asset URL'
|
68
69
|
assets: 'Assets'
|
69
70
|
assets_explanation: 'Assets and images can be uploaded and then attached or inserted into pages, snippets and layouts. Click on an asset name above to edit it or click <code>Remove</code> to delete it.'
|
70
71
|
assets_title: 'Assets'
|
@@ -83,7 +84,6 @@ en:
|
|
83
84
|
choose_file: 'Choose File'
|
84
85
|
documents: 'Documents'
|
85
86
|
caption: 'Caption'
|
86
|
-
confirm_refresh_assets: 'Are you sure you want to regenerate every asset thumbnail? This is likely to take a long time and use a lot of server resources: <strong class="warning">the performance of your site is very likely to be affected</strong> and your browser may time out before the operation is complete. This is only recommended if your asset collection is small!'
|
87
87
|
confirm_remove_asset: 'Are you sure you want to <span class="warning">permanently remove</span> the following asset?'
|
88
88
|
confirm_remove_from_page: 'Are you sure you want to remove this asset from the page?'
|
89
89
|
delete_asset: 'Delete Asset'
|
@@ -103,9 +103,6 @@ en:
|
|
103
103
|
no_assets: 'No Assets'
|
104
104
|
no_attached_assets: 'No assets attached.'
|
105
105
|
others: 'Others'
|
106
|
-
refresh_assets: 'Regenerate all thumbnails'
|
107
|
-
regenerate: 'Regenerate'
|
108
|
-
regenerate_thumbnails: 'Regenerate Thumbnails'
|
109
106
|
remove_asset: 'Remove Asset'
|
110
107
|
remove_from_page: 'Remove from page'
|
111
108
|
reorder: 'Reorder'
|
@@ -177,6 +174,7 @@ en:
|
|
177
174
|
- :month
|
178
175
|
- :day
|
179
176
|
delete_layout: 'Delete Layout'
|
177
|
+
delete_snippet: 'Delete Snippet'
|
180
178
|
delete_pages: 'Delete %{pages}'
|
181
179
|
delete_user: 'Delete User'
|
182
180
|
description: 'Description'
|
@@ -249,6 +247,7 @@ en:
|
|
249
247
|
remove: 'Remove'
|
250
248
|
remove_field: 'Remove Field'
|
251
249
|
remove_layout: 'Remove Layout'
|
250
|
+
remove_snippet: 'Remove Snippet'
|
252
251
|
remove_page: 'Remove Page'
|
253
252
|
remove_pages: 'Remove %{pages}'
|
254
253
|
remove_tab: 'Remove Tab'
|
@@ -280,6 +279,8 @@ en:
|
|
280
279
|
text:
|
281
280
|
layouts:
|
282
281
|
remove_warning: 'Are you sure you want to <span class="warning">permanently remove</span> the following layout?'
|
282
|
+
snippets:
|
283
|
+
remove_warning: 'Are you sure you want to <span class="warning">permanently remove</span> the following snippet?'
|
283
284
|
pages:
|
284
285
|
remove_warning: 'Are you sure you want to <span class="warning">permanently remove</span> the following %{pages}?'
|
285
286
|
users:
|
data/config/routes.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
TrustyCms::Application.routes.draw do
|
2
2
|
root to: 'site#show_page'
|
3
|
-
devise_for :users, module: :devise, :
|
3
|
+
devise_for :users, module: :devise, skip: :registration
|
4
4
|
as :user do
|
5
5
|
post 'authenticate', to: 'devise/sessions#create', as: :authenticate
|
6
6
|
end
|
7
7
|
get '/rad_social/mail' => 'social_mailer#social_mail_form', as: :rad_social_mail_form
|
8
8
|
post '/rad_social/mail' => 'social_mailer#create_social_mail', as: :rad_create_social_mail
|
9
|
-
TrustyCms::Application.config.enabled_extensions.each
|
10
|
-
|
9
|
+
TrustyCms::Application.config.enabled_extensions.each do |ext|
|
10
|
+
end
|
11
11
|
namespace :admin do
|
12
12
|
resources :pages do
|
13
|
-
resources :children, :
|
13
|
+
resources :children, controller: 'pages'
|
14
14
|
get 'remove', on: :member
|
15
15
|
end
|
16
16
|
resources :layouts do
|
@@ -22,12 +22,11 @@ TrustyCms::Application.routes.draw do
|
|
22
22
|
resources :snippets do
|
23
23
|
get :remove, on: :member
|
24
24
|
end
|
25
|
-
post 'save-table-position' =>
|
25
|
+
post 'save-table-position' => 'pages#save_table_position', as: 'save_tables_position'
|
26
26
|
|
27
27
|
resources :assets do
|
28
28
|
get :remove, on: :member
|
29
29
|
get :refresh, on: :collection
|
30
|
-
post :regenerate, on: :collection
|
31
30
|
put :refresh, on: :member
|
32
31
|
end
|
33
32
|
resources :page_attachments, only: [:new] do
|
@@ -39,7 +38,7 @@ TrustyCms::Application.routes.draw do
|
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
42
|
-
match 'admin/preview' => 'admin/pages#preview', :as => :preview, :via => [
|
41
|
+
match 'admin/preview' => 'admin/pages#preview', :as => :preview, :via => %i[post put]
|
43
42
|
get 'admin' => 'admin/pages#index'
|
44
43
|
|
45
44
|
namespace :admin do
|
@@ -1,12 +1,11 @@
|
|
1
1
|
require 'active_record'
|
2
2
|
|
3
3
|
class ActiveRecord::Base
|
4
|
-
|
5
4
|
def self.validates_path(*args)
|
6
5
|
configuration = args.extract_options!
|
7
6
|
validates_each(args, configuration) do |record, attr_name, value|
|
8
7
|
page = Page.find_by_path(value)
|
9
|
-
record.errors.add(attr_name, :page_not_found, :
|
8
|
+
record.errors.add(attr_name, :page_not_found, default: configuration[:message]) if page.nil? || page.is_a?(FileNotFoundPage)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
|
data/lib/annotatable.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module Annotatable
|
2
|
-
|
3
2
|
def self.included(base)
|
4
3
|
base.extend ClassMethods
|
5
4
|
end
|
@@ -14,7 +13,7 @@ module Annotatable
|
|
14
13
|
|
15
14
|
def annotate(*attrs)
|
16
15
|
options = {}
|
17
|
-
options = attrs.pop if attrs.last.
|
16
|
+
options = attrs.pop if attrs.last.is_a?(Hash)
|
18
17
|
options.symbolize_keys!
|
19
18
|
inherit = options[:inherit]
|
20
19
|
if inherit
|
@@ -42,13 +41,12 @@ module Annotatable
|
|
42
41
|
|
43
42
|
def inherited_with_annotatable(subclass)
|
44
43
|
inherited_without_annotatable(subclass)
|
45
|
-
([
|
44
|
+
(['inherited_annotations'] + (@inherited_annotations || [])).each do |t|
|
46
45
|
ivar = "@#{t}"
|
47
46
|
subclass.instance_variable_set(ivar, instance_variable_get(ivar))
|
48
47
|
end
|
49
48
|
end
|
50
49
|
end
|
51
|
-
|
52
50
|
end
|
53
51
|
|
54
52
|
# We don't necessarily have ActiveSupport loaded yet!
|
@@ -63,6 +61,6 @@ class Hash
|
|
63
61
|
|
64
62
|
# Destructively convert all keys to symbols.
|
65
63
|
def symbolize_keys!
|
66
|
-
|
64
|
+
replace(symbolize_keys)
|
67
65
|
end
|
68
66
|
end
|