trusty-cms 4.0.2 → 4.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -3
  3. data/Gemfile.lock +89 -89
  4. data/Rakefile +7 -7
  5. data/app/assets/images/admin/spinner.gif +0 -0
  6. data/app/assets/javascripts/admin.js +3 -0
  7. data/app/assets/javascripts/admin/more-or-less.js +2 -2
  8. data/app/assets/javascripts/admin/tabcontrol.js.erb +1 -2
  9. data/app/assets/javascripts/rad_social/rad_ajax_form.js +3 -0
  10. data/app/assets/javascripts/rad_social/rad_email.js +0 -1
  11. data/app/assets/javascripts/rad_social/rad_email_form.js +2 -7
  12. data/app/assets/stylesheets/admin/_base.scss +22 -6
  13. data/app/assets/stylesheets/admin/_multi_site_main.scss +28 -29
  14. data/app/assets/stylesheets/admin/_reset.scss +5 -4
  15. data/app/assets/stylesheets/admin/_site_chooser.scss +44 -69
  16. data/app/assets/stylesheets/admin/assets.scss +138 -141
  17. data/app/assets/stylesheets/admin/main.scss +10 -12
  18. data/app/assets/stylesheets/admin/modules/_boxes.scss +0 -3
  19. data/app/assets/stylesheets/admin/modules/_buttons.scss +30 -0
  20. data/app/assets/stylesheets/admin/modules/_links.scss +1 -1
  21. data/app/assets/stylesheets/admin/partials/_actions.scss +29 -46
  22. data/app/assets/stylesheets/admin/partials/_avatars.scss +3 -2
  23. data/app/assets/stylesheets/admin/partials/_content.scss +15 -38
  24. data/app/assets/stylesheets/admin/partials/_dateinput.scss +23 -14
  25. data/app/assets/stylesheets/admin/partials/_drawer.scss +78 -0
  26. data/app/assets/stylesheets/admin/partials/_dropdown.scss +9 -12
  27. data/app/assets/stylesheets/admin/partials/_footer.scss +4 -3
  28. data/app/assets/stylesheets/admin/partials/_forms.scss +64 -493
  29. data/app/assets/stylesheets/admin/partials/_header.scss +9 -118
  30. data/app/assets/stylesheets/admin/partials/_layout.scss +26 -2
  31. data/app/assets/stylesheets/admin/partials/_login_form.scss +28 -0
  32. data/app/assets/stylesheets/admin/partials/_messages.scss +10 -5
  33. data/app/assets/stylesheets/admin/partials/_popup.scss +61 -50
  34. data/app/assets/stylesheets/admin/partials/_preferences.scss +37 -0
  35. data/app/assets/stylesheets/admin/partials/_sidebar.scss +55 -0
  36. data/app/assets/stylesheets/admin/partials/_tabcontrol.scss +24 -36
  37. data/app/assets/stylesheets/admin/partials/{_index.scss → _table.scss} +53 -84
  38. data/app/assets/stylesheets/admin/partials/_toolbar.scss +11 -6
  39. data/app/assets/stylesheets/admin/partials/_treetable.scss +1 -71
  40. data/app/assets/stylesheets/admin/partials/_typography.scss +30 -55
  41. data/app/assets/stylesheets/admin/partials/_validations.scss +6 -5
  42. data/app/assets/stylesheets/rad_social/rad_screen.scss +64 -67
  43. data/app/controllers/admin/assets_controller.rb +21 -31
  44. data/app/controllers/admin/configuration_controller.rb +9 -11
  45. data/app/controllers/admin/extensions_controller.rb +3 -3
  46. data/app/controllers/admin/layouts_controller.rb +3 -4
  47. data/app/controllers/admin/page_attachments_controller.rb +5 -5
  48. data/app/controllers/admin/page_fields_controller.rb +3 -4
  49. data/app/controllers/admin/page_parts_controller.rb +4 -5
  50. data/app/controllers/admin/pages_controller.rb +55 -56
  51. data/app/controllers/admin/references_controller.rb +1 -1
  52. data/app/controllers/admin/resource_controller.rb +132 -130
  53. data/app/controllers/admin/sites_controller.rb +4 -4
  54. data/app/controllers/admin/snippets_controller.rb +3 -4
  55. data/app/controllers/admin/users_controller.rb +16 -16
  56. data/app/controllers/application_controller.rb +47 -48
  57. data/app/controllers/site_controller.rb +51 -48
  58. data/app/controllers/social_mailer_controller.rb +12 -22
  59. data/app/helpers/admin/configuration_helper.rb +19 -20
  60. data/app/helpers/admin/layouts_helper.rb +0 -1
  61. data/app/helpers/admin/node_helper.rb +27 -24
  62. data/app/helpers/admin/pages_helper.rb +2 -2
  63. data/app/helpers/admin/preferences_helper.rb +0 -1
  64. data/app/helpers/admin/references_helper.rb +9 -10
  65. data/app/helpers/admin/regions_helper.rb +3 -3
  66. data/app/helpers/application_helper.rb +34 -35
  67. data/app/helpers/rad_social_helper.rb +8 -11
  68. data/app/helpers/scoped_helper.rb +1 -3
  69. data/app/helpers/sites_helper.rb +4 -4
  70. data/app/mailers/devise_mailer.rb +3 -4
  71. data/app/mailers/rad_social_mailer.rb +8 -8
  72. data/app/models/asset.rb +62 -63
  73. data/app/models/asset_type.rb +38 -39
  74. data/app/models/deprecated_tags.rb +3 -4
  75. data/app/models/file_not_found_page.rb +1 -3
  76. data/app/models/haml_filter.rb +1 -1
  77. data/app/models/layout.rb +4 -5
  78. data/app/models/legacy_user.rb +2 -2
  79. data/app/models/menu_renderer.rb +16 -18
  80. data/app/models/page.rb +96 -93
  81. data/app/models/page_attachment.rb +1 -2
  82. data/app/models/page_context.rb +11 -12
  83. data/app/models/page_part.rb +3 -4
  84. data/app/models/rails_page.rb +10 -12
  85. data/app/models/site.rb +22 -21
  86. data/app/models/snippet.rb +6 -8
  87. data/app/models/snippet_finder.rb +3 -3
  88. data/app/models/snippet_tags.rb +4 -4
  89. data/app/models/standard_tags.rb +258 -252
  90. data/app/models/status.rb +8 -8
  91. data/app/models/trusty_cms/config.rb +25 -25
  92. data/app/models/trusty_cms/page_response_cache_director.rb +2 -3
  93. data/app/models/user.rb +15 -14
  94. data/app/models/user_action_observer.rb +3 -3
  95. data/app/users/_choose_site.html.haml +3 -7
  96. data/app/views/admin/assets/_form.html.haml +2 -1
  97. data/app/views/admin/assets/_search.html.haml +2 -1
  98. data/app/views/admin/assets/edit.html.haml +2 -10
  99. data/app/views/admin/assets/index.html.haml +4 -2
  100. data/app/views/admin/assets/new.html.haml +4 -8
  101. data/app/views/admin/assets/remove.html.haml +2 -1
  102. data/app/views/admin/configuration/edit.html.haml +7 -7
  103. data/app/views/admin/configuration/show.html.haml +6 -8
  104. data/app/views/admin/layouts/_choose_site.html.haml +2 -3
  105. data/app/views/admin/layouts/_form.html.haml +13 -12
  106. data/app/views/admin/layouts/_site_chooser.html.haml +2 -2
  107. data/app/views/admin/layouts/index.html.haml +11 -4
  108. data/app/views/admin/layouts/remove.html.haml +6 -5
  109. data/app/views/admin/page_attachments/_attachment.html.haml +2 -2
  110. data/app/views/admin/page_fields/_page_field.html.haml +3 -3
  111. data/app/views/admin/page_parts/_page_part.html.haml +5 -6
  112. data/app/views/admin/pages/_asset_popups.html.haml +15 -16
  113. data/app/views/admin/pages/_assets.html.haml +8 -7
  114. data/app/views/admin/pages/_fields.html.haml +16 -13
  115. data/app/views/admin/pages/_node.html.haml +3 -3
  116. data/app/views/admin/pages/_popups.html.haml +11 -11
  117. data/app/views/admin/pages/edit.html.haml +2 -2
  118. data/app/views/admin/pages/index.html.haml +5 -2
  119. data/app/views/admin/pages/new.html.haml +3 -3
  120. data/app/views/admin/pages/remove.html.haml +4 -3
  121. data/app/views/admin/preferences/edit.html.haml +5 -5
  122. data/app/views/admin/references/filters.haml +1 -1
  123. data/app/views/admin/references/tags.haml +3 -3
  124. data/app/views/admin/removed/_assets_bucket.html.haml +3 -3
  125. data/app/views/admin/removed/_assets_container.html.haml +18 -18
  126. data/app/views/admin/removed/_bucket.html.haml +1 -1
  127. data/app/views/admin/removed/_bucket_asset.html.haml +3 -3
  128. data/app/views/admin/removed/_show_bucket_link.html.haml +1 -1
  129. data/app/views/admin/removed/_upload_to_page.html.haml +5 -5
  130. data/app/views/admin/sites/_form.haml +18 -18
  131. data/app/views/admin/sites/edit.haml +1 -1
  132. data/app/views/admin/sites/index.haml +8 -4
  133. data/app/views/admin/sites/new.haml +1 -1
  134. data/app/views/admin/snippets/_choose_site.html.haml +4 -5
  135. data/app/views/admin/snippets/_form.html.haml +8 -9
  136. data/app/views/admin/snippets/edit.html.haml +1 -1
  137. data/app/views/admin/snippets/index.html.haml +11 -4
  138. data/app/views/admin/snippets/new.html.haml +1 -1
  139. data/app/views/admin/snippets/remove.html.haml +7 -6
  140. data/app/views/admin/users/_avatar.html.haml +2 -2
  141. data/app/views/admin/users/_choose_site.html.haml +3 -7
  142. data/app/views/admin/users/_form.html.haml +18 -21
  143. data/app/views/admin/users/_password_fields.html.haml +6 -6
  144. data/app/views/admin/users/index.html.haml +13 -6
  145. data/app/views/admin/users/remove.html.haml +4 -4
  146. data/app/views/admin/welcome/login.html.haml +8 -8
  147. data/app/views/devise/passwords/edit.html.haml +6 -6
  148. data/app/views/devise/passwords/new.html.haml +3 -3
  149. data/app/views/devise/sessions/new.html.haml +8 -8
  150. data/app/views/devise/shared/_links.html.haml +2 -2
  151. data/app/views/layouts/application.html.haml +24 -19
  152. data/app/views/rad_social_mailer/social_mail_form.html.haml +15 -17
  153. data/app/views/widget/_email_form.html.haml +13 -18
  154. data/app/views/widget/_horizontal_widget.html.haml +5 -5
  155. data/bin/rails +4 -4
  156. data/bin/trusty_cms +3 -5
  157. data/config.ru +1 -1
  158. data/config/application.rb +14 -15
  159. data/config/boot.rb +1 -2
  160. data/config/environment.rb +1 -1
  161. data/config/environments/production.rb +0 -1
  162. data/config/environments/test.rb +1 -2
  163. data/config/initializers/devise.rb +1 -1
  164. data/config/initializers/kraken.rb +2 -2
  165. data/config/initializers/tmp.rb +1 -1
  166. data/config/initializers/trusty_cms_config.rb +48 -48
  167. data/config/locales/en.yml +8 -8
  168. data/config/routes.rb +6 -7
  169. data/lib/active_record_extensions/active_record_extensions.rb +1 -2
  170. data/lib/annotatable.rb +3 -5
  171. data/lib/configuration_extensions/configuration_extensions.rb +1 -1
  172. data/lib/inheritable_class_attributes.rb +13 -9
  173. data/lib/login_system.rb +73 -73
  174. data/lib/method_observer.rb +13 -12
  175. data/lib/ostruct.rb +7 -10
  176. data/lib/simpleton.rb +0 -4
  177. data/lib/string_extensions/string_extensions.rb +3 -3
  178. data/lib/symbol_extensions/symbol_extensions.rb +1 -1
  179. data/lib/tasks/database.rake +28 -28
  180. data/lib/tasks/extensions.rake +18 -18
  181. data/lib/tasks/framework.rake +68 -68
  182. data/lib/tasks/radiant_config.rake +4 -4
  183. data/lib/tasks/snippets_extension_tasks.rake +11 -11
  184. data/lib/tasks/translate.rake +14 -14
  185. data/lib/tasks/upgrade_to_devise.rake +1 -1
  186. data/lib/translation_support.rb +22 -22
  187. data/lib/trusty_cms.rb +2 -2
  188. data/lib/trusty_cms/admin_ui.rb +19 -16
  189. data/lib/trusty_cms/admin_ui/region_partials.rb +4 -3
  190. data/lib/trusty_cms/admin_ui/region_set.rb +4 -5
  191. data/lib/trusty_cms/available_locales.rb +2 -4
  192. data/lib/trusty_cms/config/definition.rb +11 -8
  193. data/lib/trusty_cms/engine.rb +13 -14
  194. data/lib/trusty_cms/extension.rb +14 -16
  195. data/lib/trusty_cms/extension_loader.rb +6 -6
  196. data/lib/trusty_cms/extension_migrator.rb +42 -41
  197. data/lib/trusty_cms/extension_path.rb +20 -19
  198. data/lib/trusty_cms/initializer.rb +5 -8
  199. data/lib/trusty_cms/pagination/controller.rb +7 -10
  200. data/lib/trusty_cms/pagination/link_renderer.rb +2 -2
  201. data/lib/trusty_cms/resource_responses.rb +3 -3
  202. data/lib/trusty_cms/setup.rb +130 -132
  203. data/lib/trusty_cms/taggable.rb +19 -22
  204. data/lib/trusty_cms/task_support.rb +9 -6
  205. data/package.json +10 -2
  206. data/public/dispatch.fcgi +1 -1
  207. data/public/dispatch.rb +2 -2
  208. data/script/extension +1 -1
  209. data/script/rails +2 -2
  210. data/spec/dummy/package.json +1 -1
  211. data/spec/dummy/yarn.lock +3 -3
  212. data/trusty_cms.gemspec +25 -25
  213. data/vendor/extensions/clipped-extension/lib/clipped_admin_ui.rb +1 -1
  214. data/yarn.lock +1992 -4
  215. metadata +54 -43
  216. data/app/assets/javascripts/rad_social/captcha.js +0 -42
  217. data/app/assets/stylesheets/admin/partials/_deprecated.scss +0 -65
  218. data/app/assets/stylesheets/admin/partials/_jquery-ui-structure.scss +0 -258
  219. data/app/assets/stylesheets/admin/partials/_jquery-ui-theme.scss +0 -410
  220. data/app/assets/stylesheets/admin/partials/_jquery-ui.scss +0 -650
  221. data/app/views/admin/assets/refresh.html.haml +0 -14
data/bin/rails CHANGED
@@ -2,12 +2,12 @@
2
2
  # This command will automatically be run when you run "rails" with Rails gems
3
3
  # installed from the root of your application.
4
4
 
5
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
6
- ENGINE_PATH = File.expand_path('../../lib/trusty/cms/engine', __FILE__)
7
- APP_PATH = File.expand_path('../../test/dummy/config/application', __FILE__)
5
+ ENGINE_ROOT = File.expand_path('..', __dir__)
6
+ ENGINE_PATH = File.expand_path('../lib/trusty/cms/engine', __dir__)
7
+ APP_PATH = File.expand_path('../test/dummy/config/application', __dir__)
8
8
 
9
9
  # Set up gems listed in the Gemfile.
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
11
11
  require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
12
12
 
13
13
  require 'rails/all'
@@ -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
@@ -83,8 +83,7 @@ en:
83
83
  choose_file: 'Choose File'
84
84
  documents: 'Documents'
85
85
  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
- confirm_remove_asset: 'Are you sure you want to permanently remove the following asset?'
86
+ confirm_remove_asset: 'Are you sure you want to <span class="warning">permanently remove</span> the following asset?'
88
87
  confirm_remove_from_page: 'Are you sure you want to remove this asset from the page?'
89
88
  delete_asset: 'Delete Asset'
90
89
  detach: 'Detach'
@@ -103,9 +102,6 @@ en:
103
102
  no_assets: 'No Assets'
104
103
  no_attached_assets: 'No assets attached.'
105
104
  others: 'Others'
106
- refresh_assets: 'Regenerate all thumbnails'
107
- regenerate: 'Regenerate'
108
- regenerate_thumbnails: 'Regenerate Thumbnails'
109
105
  remove_asset: 'Remove Asset'
110
106
  remove_from_page: 'Remove from page'
111
107
  reorder: 'Reorder'
@@ -177,6 +173,7 @@ en:
177
173
  - :month
178
174
  - :day
179
175
  delete_layout: 'Delete Layout'
176
+ delete_snippet: 'Delete Snippet'
180
177
  delete_pages: 'Delete %{pages}'
181
178
  delete_user: 'Delete User'
182
179
  description: 'Description'
@@ -249,6 +246,7 @@ en:
249
246
  remove: 'Remove'
250
247
  remove_field: 'Remove Field'
251
248
  remove_layout: 'Remove Layout'
249
+ remove_snippet: 'Remove Snippet'
252
250
  remove_page: 'Remove Page'
253
251
  remove_pages: 'Remove %{pages}'
254
252
  remove_tab: 'Remove Tab'
@@ -279,11 +277,13 @@ en:
279
277
  testing: Testing
280
278
  text:
281
279
  layouts:
282
- remove_warning: 'Are you sure you want to <strong class="warning">permanently remove</strong> the following layout?'
280
+ remove_warning: 'Are you sure you want to <span class="warning">permanently remove</span> the following layout?'
281
+ snippets:
282
+ remove_warning: 'Are you sure you want to <span class="warning">permanently remove</span> the following snippet?'
283
283
  pages:
284
- remove_warning: 'Are you sure you want to <strong class="warning">permanently remove</strong> the following %{pages}?'
284
+ remove_warning: 'Are you sure you want to <span class="warning">permanently remove</span> the following %{pages}?'
285
285
  users:
286
- remove_warning: 'Are you sure you want to <strong class="warning">permanently remove</strong> the following user?'
286
+ remove_warning: 'Are you sure you want to <span class="warning">permanently remove</span> the following user?'
287
287
  this_file_language: "English"
288
288
  time:
289
289
  am: 'am'
@@ -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