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.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -3
  3. data/Gemfile.lock +107 -107
  4. data/README.md +1 -1
  5. data/Rakefile +7 -7
  6. data/app/assets/javascripts/admin/assets.js +1 -1
  7. data/app/assets/javascripts/rad_social/rad_ajax_form.js +3 -0
  8. data/app/assets/javascripts/rad_social/rad_email.js +0 -1
  9. data/app/assets/javascripts/rad_social/rad_email_form.js +2 -7
  10. data/app/assets/stylesheets/admin/partials/_forms.scss +1 -1
  11. data/app/assets/stylesheets/rad_social/rad_screen.scss +0 -4
  12. data/app/controllers/admin/assets_controller.rb +21 -31
  13. data/app/controllers/admin/configuration_controller.rb +9 -11
  14. data/app/controllers/admin/extensions_controller.rb +3 -3
  15. data/app/controllers/admin/layouts_controller.rb +3 -4
  16. data/app/controllers/admin/page_attachments_controller.rb +5 -5
  17. data/app/controllers/admin/page_fields_controller.rb +3 -4
  18. data/app/controllers/admin/page_parts_controller.rb +4 -5
  19. data/app/controllers/admin/pages_controller.rb +55 -56
  20. data/app/controllers/admin/references_controller.rb +1 -1
  21. data/app/controllers/admin/resource_controller.rb +132 -130
  22. data/app/controllers/admin/sites_controller.rb +4 -4
  23. data/app/controllers/admin/snippets_controller.rb +3 -4
  24. data/app/controllers/admin/users_controller.rb +16 -16
  25. data/app/controllers/application_controller.rb +47 -48
  26. data/app/controllers/site_controller.rb +51 -48
  27. data/app/controllers/social_mailer_controller.rb +12 -22
  28. data/app/helpers/admin/configuration_helper.rb +19 -20
  29. data/app/helpers/admin/layouts_helper.rb +0 -1
  30. data/app/helpers/admin/node_helper.rb +27 -24
  31. data/app/helpers/admin/pages_helper.rb +2 -2
  32. data/app/helpers/admin/preferences_helper.rb +0 -1
  33. data/app/helpers/admin/references_helper.rb +9 -10
  34. data/app/helpers/admin/regions_helper.rb +3 -3
  35. data/app/helpers/application_helper.rb +32 -33
  36. data/app/helpers/rad_social_helper.rb +8 -11
  37. data/app/helpers/scoped_helper.rb +1 -3
  38. data/app/helpers/sites_helper.rb +4 -4
  39. data/app/mailers/devise_mailer.rb +3 -4
  40. data/app/mailers/rad_social_mailer.rb +8 -8
  41. data/app/models/asset.rb +62 -63
  42. data/app/models/asset_type.rb +38 -39
  43. data/app/models/deprecated_tags.rb +3 -4
  44. data/app/models/file_not_found_page.rb +1 -3
  45. data/app/models/haml_filter.rb +1 -1
  46. data/app/models/layout.rb +4 -5
  47. data/app/models/legacy_user.rb +2 -2
  48. data/app/models/menu_renderer.rb +16 -18
  49. data/app/models/page.rb +96 -93
  50. data/app/models/page_attachment.rb +1 -2
  51. data/app/models/page_context.rb +11 -12
  52. data/app/models/page_part.rb +3 -4
  53. data/app/models/rails_page.rb +10 -12
  54. data/app/models/site.rb +22 -21
  55. data/app/models/snippet.rb +6 -8
  56. data/app/models/snippet_finder.rb +3 -3
  57. data/app/models/snippet_tags.rb +4 -4
  58. data/app/models/standard_tags.rb +258 -252
  59. data/app/models/status.rb +8 -8
  60. data/app/models/trusty_cms/config.rb +25 -25
  61. data/app/models/trusty_cms/page_response_cache_director.rb +2 -3
  62. data/app/models/user.rb +15 -14
  63. data/app/models/user_action_observer.rb +3 -3
  64. data/app/views/admin/assets/edit.html.haml +3 -9
  65. data/app/views/admin/assets/new.html.haml +0 -3
  66. data/app/views/admin/assets/remove.html.haml +1 -1
  67. data/app/views/admin/layouts/remove.html.haml +3 -2
  68. data/app/views/admin/page_parts/_page_part.html.haml +1 -1
  69. data/app/views/admin/snippets/remove.html.haml +3 -2
  70. data/app/views/rad_social_mailer/social_mail_form.html.haml +1 -3
  71. data/app/views/widget/_email_form.html.haml +0 -5
  72. data/bin/rails +4 -4
  73. data/bin/trusty_cms +3 -5
  74. data/config.ru +1 -1
  75. data/config/application.rb +14 -15
  76. data/config/boot.rb +1 -2
  77. data/config/environment.rb +1 -1
  78. data/config/environments/production.rb +0 -1
  79. data/config/environments/test.rb +1 -2
  80. data/config/initializers/devise.rb +1 -1
  81. data/config/initializers/kraken.rb +2 -2
  82. data/config/initializers/tmp.rb +1 -1
  83. data/config/initializers/trusty_cms_config.rb +48 -48
  84. data/config/locales/en.yml +5 -4
  85. data/config/routes.rb +6 -7
  86. data/lib/active_record_extensions/active_record_extensions.rb +1 -2
  87. data/lib/annotatable.rb +3 -5
  88. data/lib/configuration_extensions/configuration_extensions.rb +1 -1
  89. data/lib/inheritable_class_attributes.rb +13 -9
  90. data/lib/login_system.rb +73 -73
  91. data/lib/method_observer.rb +13 -12
  92. data/lib/ostruct.rb +7 -10
  93. data/lib/simpleton.rb +0 -4
  94. data/lib/string_extensions/string_extensions.rb +3 -3
  95. data/lib/symbol_extensions/symbol_extensions.rb +1 -1
  96. data/lib/tasks/database.rake +28 -28
  97. data/lib/tasks/extensions.rake +18 -18
  98. data/lib/tasks/framework.rake +68 -68
  99. data/lib/tasks/radiant_config.rake +4 -4
  100. data/lib/tasks/snippets_extension_tasks.rake +11 -11
  101. data/lib/tasks/translate.rake +14 -14
  102. data/lib/tasks/upgrade_to_devise.rake +1 -1
  103. data/lib/translation_support.rb +22 -22
  104. data/lib/trusty_cms.rb +2 -2
  105. data/lib/trusty_cms/admin_ui.rb +19 -16
  106. data/lib/trusty_cms/admin_ui/region_partials.rb +4 -3
  107. data/lib/trusty_cms/admin_ui/region_set.rb +4 -5
  108. data/lib/trusty_cms/available_locales.rb +2 -4
  109. data/lib/trusty_cms/config/definition.rb +11 -8
  110. data/lib/trusty_cms/engine.rb +13 -14
  111. data/lib/trusty_cms/extension.rb +14 -16
  112. data/lib/trusty_cms/extension_loader.rb +6 -6
  113. data/lib/trusty_cms/extension_migrator.rb +42 -41
  114. data/lib/trusty_cms/extension_path.rb +20 -19
  115. data/lib/trusty_cms/initializer.rb +5 -8
  116. data/lib/trusty_cms/pagination/controller.rb +7 -10
  117. data/lib/trusty_cms/pagination/link_renderer.rb +2 -2
  118. data/lib/trusty_cms/resource_responses.rb +3 -3
  119. data/lib/trusty_cms/setup.rb +130 -132
  120. data/lib/trusty_cms/taggable.rb +19 -22
  121. data/lib/trusty_cms/task_support.rb +9 -6
  122. data/package.json +1 -1
  123. data/public/dispatch.fcgi +1 -1
  124. data/public/dispatch.rb +2 -2
  125. data/script/extension +1 -1
  126. data/script/rails +2 -2
  127. data/spec/dummy/package.json +1 -1
  128. data/spec/dummy/yarn.lock +3 -3
  129. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/core.js +126 -0
  130. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/index.js +4 -0
  131. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/map.js +56 -0
  132. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/seq.js +43 -0
  133. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/string.js +28 -0
  134. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/index.js +36 -0
  135. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/json.js +76 -0
  136. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/options.js +23 -0
  137. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/binary.js +87 -0
  138. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/index.js +157 -0
  139. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/omap.js +142 -0
  140. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/pairs.js +81 -0
  141. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/set.js +114 -0
  142. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/timestamp.js +97 -0
  143. data/spec/spec/dummy/node_modules/yaml/dist/tags/core.js +114 -0
  144. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/index.js +17 -0
  145. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/map.js +37 -0
  146. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/seq.js +34 -0
  147. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/string.js +40 -0
  148. data/spec/spec/dummy/node_modules/yaml/dist/tags/index.js +62 -0
  149. data/spec/spec/dummy/node_modules/yaml/dist/tags/json.js +60 -0
  150. data/spec/spec/dummy/node_modules/yaml/dist/tags/options.js +35 -0
  151. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/binary.js +97 -0
  152. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/index.js +131 -0
  153. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/omap.js +105 -0
  154. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/pairs.js +80 -0
  155. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/set.js +91 -0
  156. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/timestamp.js +93 -0
  157. data/trusty_cms.gemspec +25 -25
  158. data/vendor/extensions/clipped-extension/lib/clipped_admin_ui.rb +1 -1
  159. data/yarn.lock +7 -7
  160. metadata +7609 -105
  161. data/app/assets/javascripts/rad_social/captcha.js +0 -42
  162. data/app/views/admin/assets/refresh.html.haml +0 -14
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- ENV["RAILS_ENV"] ||= 'production'
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("INT") { puts; exit }
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("trusty_cms", [ARGV])
50
+ Rails::Generators.invoke('trusty_cms', [ARGV])
data/config.ru CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
4
  run TrustyCms::Application
@@ -1,4 +1,4 @@
1
- require File.expand_path('../boot', __FILE__)
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(:assets => %w(development test)))
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["app/helpers"] = []
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
- :private_headers => ['Authorization'],
48
- :entitystore => "trusty:tmp/cache/entity",
49
- :metastore => "trusty:tmp/cache/meta",
50
- :verbose => false,
51
- :allow_reload => false,
52
- :allow_revalidate => false
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 += [:password, :password_confirmation]
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 # also calls initialize_views
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|
@@ -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('../../Gemfile', __FILE__)
5
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
7
6
 
8
7
  require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,5 +1,5 @@
1
1
  # Load the rails application
2
- require File.expand_path('../application', __FILE__)
2
+ require File.expand_path('application', __dir__)
3
3
 
4
4
  # Initialize the rails application
5
5
  TrustyCms::Application.initialize!
@@ -40,5 +40,4 @@ TrustyCms::Application.configure do
40
40
  # config.after_initialize do
41
41
  # SiteController.cache_timeout = 12.hours
42
42
  # end
43
-
44
43
  end
@@ -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 = true
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,
@@ -2,6 +2,6 @@ require 'rubygems'
2
2
  require 'kraken-io'
3
3
 
4
4
  $kraken = Kraken::API.new(
5
- :api_key => ENV['KRAKEN_KEY'],
6
- :api_secret => ENV['KRAKEN_SECRET']
5
+ api_key: ENV['KRAKEN_KEY'],
6
+ api_secret: ENV['KRAKEN_SECRET'],
7
7
  )
@@ -1,2 +1,2 @@
1
1
  require 'fileutils'
2
- FileUtils.mkdir_p(Rails.root.join("tmp", "stylesheets"))
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', :default => "TrustyCms CMS"
5
+ config.define 'admin.title', default: 'TrustyCms CMS'
6
6
  config.define 'dev.host'
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
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', :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
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', :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'
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
- :allow_blank => false,
36
- :allow_display => false
35
+ allow_blank: false,
36
+ allow_display: false
37
37
 
38
38
  pc.namespace 'fog' do |fog|
39
- fog.define 'provider', :select_from => {
40
- 'Amazon S3' => 'AWS',
41
- 'Google Storage' => 'Google',
42
- 'Rackspace Cloud Files' => 'Rackspace'
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?', :default => true
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', :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
- }
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', :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'
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', :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'
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', :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
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', :select_from => lambda { TextFilter.descendants.map { |s| s.filter_name }.sort }, :allow_blank => true
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
@@ -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>&lt;r:assets:each /&gt;</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:
@@ -1,16 +1,16 @@
1
1
  TrustyCms::Application.routes.draw do
2
2
  root to: 'site#show_page'
3
- devise_for :users, module: :devise, :skip => :registration
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 { |ext|
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, :controller => 'pages'
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' => "pages#save_table_position", as: "save_tables_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 => [:post, :put]
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, :default => configuration[:message]) if page.nil? || page.is_a?(FileNotFoundPage)
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
 
@@ -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.kind_of?(Hash)
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
- (["inherited_annotations"] + (@inherited_annotations || [])).each do |t|
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
- self.replace(self.symbolize_keys)
64
+ replace(symbolize_keys)
67
65
  end
68
66
  end
@@ -317,4 +317,4 @@ class GemBoot < Boot
317
317
  def load_error_message
318
318
  "Have you run `bundle install`?'."
319
319
  end
320
- end
320
+ end