trusty-cms 4.1.2 → 4.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +25 -25
  4. data/Rakefile +7 -7
  5. data/app/assets/stylesheets/admin/partials/_content.scss +1 -2
  6. data/app/controllers/admin/assets_controller.rb +22 -21
  7. data/app/controllers/admin/configuration_controller.rb +9 -11
  8. data/app/controllers/admin/extensions_controller.rb +3 -3
  9. data/app/controllers/admin/layouts_controller.rb +3 -4
  10. data/app/controllers/admin/page_attachments_controller.rb +5 -5
  11. data/app/controllers/admin/page_fields_controller.rb +3 -4
  12. data/app/controllers/admin/page_parts_controller.rb +4 -5
  13. data/app/controllers/admin/pages_controller.rb +55 -56
  14. data/app/controllers/admin/references_controller.rb +1 -1
  15. data/app/controllers/admin/resource_controller.rb +132 -130
  16. data/app/controllers/admin/sites_controller.rb +4 -4
  17. data/app/controllers/admin/snippets_controller.rb +3 -4
  18. data/app/controllers/admin/users_controller.rb +16 -16
  19. data/app/controllers/application_controller.rb +47 -48
  20. data/app/controllers/site_controller.rb +51 -48
  21. data/app/controllers/social_mailer_controller.rb +13 -16
  22. data/app/helpers/admin/configuration_helper.rb +19 -20
  23. data/app/helpers/admin/layouts_helper.rb +0 -1
  24. data/app/helpers/admin/node_helper.rb +27 -24
  25. data/app/helpers/admin/pages_helper.rb +2 -2
  26. data/app/helpers/admin/preferences_helper.rb +0 -1
  27. data/app/helpers/admin/references_helper.rb +9 -10
  28. data/app/helpers/admin/regions_helper.rb +3 -3
  29. data/app/helpers/application_helper.rb +32 -33
  30. data/app/helpers/rad_social_helper.rb +8 -11
  31. data/app/helpers/scoped_helper.rb +1 -3
  32. data/app/helpers/sites_helper.rb +4 -4
  33. data/app/mailers/devise_mailer.rb +3 -4
  34. data/app/mailers/rad_social_mailer.rb +8 -8
  35. data/app/models/asset.rb +62 -63
  36. data/app/models/asset_type.rb +38 -39
  37. data/app/models/deprecated_tags.rb +3 -4
  38. data/app/models/file_not_found_page.rb +1 -3
  39. data/app/models/haml_filter.rb +1 -1
  40. data/app/models/layout.rb +4 -5
  41. data/app/models/legacy_user.rb +2 -2
  42. data/app/models/menu_renderer.rb +16 -18
  43. data/app/models/page.rb +96 -93
  44. data/app/models/page_attachment.rb +1 -2
  45. data/app/models/page_context.rb +11 -12
  46. data/app/models/page_part.rb +3 -4
  47. data/app/models/rails_page.rb +10 -12
  48. data/app/models/site.rb +22 -21
  49. data/app/models/snippet.rb +6 -8
  50. data/app/models/snippet_finder.rb +3 -3
  51. data/app/models/snippet_tags.rb +4 -4
  52. data/app/models/standard_tags.rb +258 -252
  53. data/app/models/status.rb +8 -8
  54. data/app/models/trusty_cms/config.rb +25 -25
  55. data/app/models/trusty_cms/page_response_cache_director.rb +2 -3
  56. data/app/models/user.rb +15 -14
  57. data/app/models/user_action_observer.rb +3 -3
  58. data/bin/rails +4 -4
  59. data/bin/trusty_cms +3 -5
  60. data/config.ru +1 -1
  61. data/config/application.rb +14 -15
  62. data/config/boot.rb +1 -2
  63. data/config/environment.rb +1 -1
  64. data/config/environments/production.rb +0 -1
  65. data/config/environments/test.rb +1 -2
  66. data/config/initializers/devise.rb +1 -1
  67. data/config/initializers/kraken.rb +2 -2
  68. data/config/initializers/tmp.rb +1 -1
  69. data/config/initializers/trusty_cms_config.rb +48 -48
  70. data/config/routes.rb +6 -6
  71. data/lib/active_record_extensions/active_record_extensions.rb +1 -2
  72. data/lib/annotatable.rb +3 -5
  73. data/lib/configuration_extensions/configuration_extensions.rb +1 -1
  74. data/lib/inheritable_class_attributes.rb +13 -9
  75. data/lib/login_system.rb +73 -73
  76. data/lib/method_observer.rb +13 -12
  77. data/lib/ostruct.rb +7 -10
  78. data/lib/simpleton.rb +0 -4
  79. data/lib/string_extensions/string_extensions.rb +3 -3
  80. data/lib/symbol_extensions/symbol_extensions.rb +1 -1
  81. data/lib/tasks/database.rake +28 -28
  82. data/lib/tasks/extensions.rake +18 -18
  83. data/lib/tasks/framework.rake +68 -68
  84. data/lib/tasks/radiant_config.rake +4 -4
  85. data/lib/tasks/snippets_extension_tasks.rake +11 -11
  86. data/lib/tasks/translate.rake +14 -14
  87. data/lib/tasks/upgrade_to_devise.rake +1 -1
  88. data/lib/translation_support.rb +22 -22
  89. data/lib/trusty_cms.rb +2 -2
  90. data/lib/trusty_cms/admin_ui.rb +19 -16
  91. data/lib/trusty_cms/admin_ui/region_partials.rb +4 -3
  92. data/lib/trusty_cms/admin_ui/region_set.rb +4 -5
  93. data/lib/trusty_cms/available_locales.rb +2 -4
  94. data/lib/trusty_cms/config/definition.rb +11 -8
  95. data/lib/trusty_cms/engine.rb +14 -14
  96. data/lib/trusty_cms/extension.rb +14 -16
  97. data/lib/trusty_cms/extension_loader.rb +6 -6
  98. data/lib/trusty_cms/extension_migrator.rb +42 -41
  99. data/lib/trusty_cms/extension_path.rb +20 -19
  100. data/lib/trusty_cms/initializer.rb +5 -8
  101. data/lib/trusty_cms/pagination/controller.rb +7 -10
  102. data/lib/trusty_cms/pagination/link_renderer.rb +2 -2
  103. data/lib/trusty_cms/resource_responses.rb +3 -3
  104. data/lib/trusty_cms/setup.rb +130 -132
  105. data/lib/trusty_cms/taggable.rb +19 -22
  106. data/lib/trusty_cms/task_support.rb +9 -6
  107. data/public/dispatch.fcgi +1 -1
  108. data/public/dispatch.rb +2 -2
  109. data/script/extension +1 -1
  110. data/script/rails +2 -2
  111. data/trusty_cms.gemspec +23 -23
  112. metadata +32 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b4c0091419c21923c64c2b6a9848821262eb761f7ec3e6fa05c7dbc16986d5d
4
- data.tar.gz: 6f7f51a3f833d71df2f0f8d3bc88a47b97303be303266d9245138182bf9a190f
3
+ metadata.gz: 5ec4507891ffcef07709998473113f66f350d6c17ac1a1a40ca8593d6b565855
4
+ data.tar.gz: 994dec6d305e0ce812c7311ef3ff4c15f5a439f61d09a21bcafdf235d6a4f08d
5
5
  SHA512:
6
- metadata.gz: b2c3d0d25e6daa74d683e2fd4260a157604278dcf622eebf34208ebf01317d444693f8fbe676534f2aaaf9d53ab670995fdb5133742c8c86fadca5cde3964764
7
- data.tar.gz: 6a545b06e0b977518bdf314467012360c827c511381c073e73e66848ba83f8b7e96d94a59f086ff1999141d735047d07273e021983c65e16e54b94ea3db7799c
6
+ metadata.gz: 642b211413fead95b9f8a33eeead86c404f9f6debc150c3440416f380534be866ea9c817a312a5e65610a3df06ba8f7d0397a74429be26e2afeae0dd9de5e6b1
7
+ data.tar.gz: 12cc8927f097db47b3b97c38fd66f708fb5ac81ae4e12e5f43a0a07ae011184d82eef46adaa0d7e3b6f49a1f2dc2b585bb9dc19f0551bf83023219743a429d4c
data/Gemfile CHANGED
@@ -15,9 +15,9 @@ group :development, :test do
15
15
  gem 'acts_as_list'
16
16
  gem 'database_cleaner'
17
17
  gem 'factory_bot_rails', '5.2.0'
18
- gem 'launchy', '~> 2.5.0'
18
+ gem 'launchy', '~> 2.5.0'
19
19
  gem 'mysql2'
20
- gem 'poltergeist', '~> 1.18.1'
20
+ gem 'poltergeist', '~> 1.18.1'
21
21
  gem 'pry-byebug'
22
22
  gem 'rails-observers'
23
23
  gem 'rspec-rails'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trusty-cms (4.1.2)
4
+ trusty-cms (4.1.3)
5
5
  RedCloth (= 4.3.2)
6
6
  acts_as_list (>= 0.9.5, < 1.1.0)
7
7
  acts_as_tree (>= 2.6.1, < 2.9.0)
@@ -97,8 +97,8 @@ GEM
97
97
  public_suffix (>= 2.0.2, < 5.0)
98
98
  bcrypt (3.1.13)
99
99
  builder (3.2.4)
100
- byebug (11.1.1)
101
- capybara (3.31.0)
100
+ byebug (11.1.3)
101
+ capybara (3.32.2)
102
102
  addressable
103
103
  mini_mime (>= 0.1.3)
104
104
  nokogiri (~> 1.8)
@@ -113,15 +113,15 @@ GEM
113
113
  cliver (0.3.2)
114
114
  cocaine (0.6.0)
115
115
  terrapin (= 0.6.0)
116
- coderay (1.1.2)
116
+ coderay (1.1.3)
117
117
  concurrent-ruby (1.1.6)
118
118
  crass (1.0.6)
119
119
  css_parser (1.7.1)
120
120
  addressable
121
- database_cleaner (1.8.4)
121
+ database_cleaner (1.8.5)
122
122
  delocalize (1.2.0)
123
123
  rails (>= 2)
124
- devise (4.7.1)
124
+ devise (4.7.2)
125
125
  bcrypt (~> 3.0)
126
126
  orm_adapter (~> 0.1)
127
127
  railties (>= 4.1.0)
@@ -137,7 +137,7 @@ GEM
137
137
  factory_bot_rails (5.2.0)
138
138
  factory_bot (~> 5.2.0)
139
139
  railties (>= 4.2.0)
140
- ffi (1.12.2)
140
+ ffi (1.13.1)
141
141
  globalid (0.4.2)
142
142
  activesupport (>= 4.2.0)
143
143
  haml (5.1.2)
@@ -155,10 +155,10 @@ GEM
155
155
  haml (>= 4.0, < 6)
156
156
  nokogiri (>= 1.6.0)
157
157
  ruby_parser (~> 3.5)
158
- httparty (0.18.0)
158
+ httparty (0.18.1)
159
159
  mime-types (~> 3.0)
160
160
  multi_xml (>= 0.5.2)
161
- i18n (1.8.2)
161
+ i18n (1.8.3)
162
162
  concurrent-ruby (~> 1.0)
163
163
  json (2.3.0)
164
164
  kraken-io (0.1.3)
@@ -168,7 +168,7 @@ GEM
168
168
  multipart-post
169
169
  launchy (2.5.0)
170
170
  addressable (~> 2.7)
171
- libv8 (7.3.492.27.1)
171
+ libv8 (7.3.492.27.1-x86_64-linux)
172
172
  loofah (2.5.0)
173
173
  crass (~> 1.0.2)
174
174
  nokogiri (>= 1.5.9)
@@ -203,15 +203,15 @@ GEM
203
203
  capybara (>= 2.1, < 4)
204
204
  cliver (~> 0.3.1)
205
205
  websocket-driver (>= 0.2.0)
206
- pry (0.13.0)
206
+ pry (0.13.1)
207
207
  coderay (~> 1.1)
208
208
  method_source (~> 1.0)
209
209
  pry-byebug (3.9.0)
210
210
  byebug (~> 11.0)
211
211
  pry (~> 0.13.0)
212
- public_suffix (4.0.3)
212
+ public_suffix (4.0.5)
213
213
  rack (2.0.9)
214
- rack-cache (1.11.1)
214
+ rack-cache (1.12.0)
215
215
  rack (>= 0.4)
216
216
  rack-test (1.1.0)
217
217
  rack (>= 1.0, < 3)
@@ -246,8 +246,8 @@ GEM
246
246
  thor (>= 0.20.3, < 2.0)
247
247
  rake (12.3.3)
248
248
  rdoc (6.2.1)
249
- regexp_parser (1.7.0)
250
- responders (3.0.0)
249
+ regexp_parser (1.7.1)
250
+ responders (3.0.1)
251
251
  actionpack (>= 5.0)
252
252
  railties (>= 5.0)
253
253
  roadie (4.0.0)
@@ -256,15 +256,15 @@ GEM
256
256
  roadie-rails (2.1.1)
257
257
  railties (>= 5.1, < 6.1)
258
258
  roadie (>= 3.1, < 5.0)
259
- rspec-core (3.9.1)
260
- rspec-support (~> 3.9.1)
261
- rspec-expectations (3.9.1)
259
+ rspec-core (3.9.2)
260
+ rspec-support (~> 3.9.3)
261
+ rspec-expectations (3.9.2)
262
262
  diff-lcs (>= 1.2.0, < 2.0)
263
263
  rspec-support (~> 3.9.0)
264
264
  rspec-mocks (3.9.1)
265
265
  diff-lcs (>= 1.2.0, < 2.0)
266
266
  rspec-support (~> 3.9.0)
267
- rspec-rails (4.0.0)
267
+ rspec-rails (4.0.1)
268
268
  actionpack (>= 4.2)
269
269
  activesupport (>= 4.2)
270
270
  railties (>= 4.2)
@@ -272,10 +272,10 @@ GEM
272
272
  rspec-expectations (~> 3.9)
273
273
  rspec-mocks (~> 3.9)
274
274
  rspec-support (~> 3.9)
275
- rspec-support (3.9.2)
275
+ rspec-support (3.9.3)
276
276
  ruby_parser (3.14.2)
277
277
  sexp_processor (~> 4.9)
278
- sassc (2.3.0)
278
+ sassc (2.4.0)
279
279
  ffi (~> 1.9)
280
280
  sassc-rails (2.1.2)
281
281
  railties (>= 4.0.0)
@@ -283,12 +283,12 @@ GEM
283
283
  sprockets (> 3.0)
284
284
  sprockets-rails
285
285
  tilt
286
- sexp_processor (4.14.1)
286
+ sexp_processor (4.15.0)
287
287
  simplecov (0.18.5)
288
288
  docile (~> 1.1)
289
289
  simplecov-html (~> 0.11)
290
290
  simplecov-html (0.12.2)
291
- sprockets (4.0.0)
291
+ sprockets (4.0.2)
292
292
  concurrent-ruby (~> 1.0)
293
293
  rack (> 1, < 3)
294
294
  sprockets-rails (3.2.1)
@@ -311,9 +311,9 @@ GEM
311
311
  uuidtools (2.1.5)
312
312
  warden (1.2.8)
313
313
  rack (>= 2.0.6)
314
- websocket-driver (0.7.1)
314
+ websocket-driver (0.7.2)
315
315
  websocket-extensions (>= 0.1.0)
316
- websocket-extensions (0.1.4)
316
+ websocket-extensions (0.1.5)
317
317
  will_paginate (3.3.0)
318
318
  xpath (3.2.0)
319
319
  nokogiri (~> 1.8)
data/Rakefile CHANGED
@@ -10,19 +10,19 @@ require 'pry'
10
10
  require 'byebug'
11
11
  require 'trustygems'
12
12
 
13
- #!/usr/bin/env rake
13
+ # !/usr/bin/env rake
14
14
  begin
15
15
  require 'bundler/setup'
16
16
  rescue LoadError
17
17
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
18
18
  end
19
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
19
+ APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
20
20
  load 'rails/tasks/engine.rake'
21
21
  Bundler::GemHelper.install_tasks
22
- Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
22
+ Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each { |f| load f }
23
23
  require 'rspec/core'
24
24
  require 'rspec/core/rake_task'
25
- desc "Run all specs in spec directory (excluding plugin specs)"
26
- RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
27
- task :default => :spec
28
- #TrustyCms::Application.load_tasks
25
+ desc 'Run all specs in spec directory (excluding plugin specs)'
26
+ RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
27
+ task default: :spec
28
+ # TrustyCms::Application.load_tasks
@@ -1,13 +1,12 @@
1
1
  main {
2
2
  float: left;
3
3
  grid-area: content;
4
- padding: 1em 0 1em 1em;
5
4
  width: 100%;
6
5
  }
7
6
 
8
7
  .reversed main {
9
8
  .content {
10
- padding: 1em 0;
9
+ padding: 1em;
11
10
  }
12
11
  }
13
12
 
@@ -1,15 +1,15 @@
1
1
  class Admin::AssetsController < Admin::ResourceController
2
- paginate_models(:per_page => 50)
3
- COMPRESS_FILE_TYPE = ["image/jpeg", "image/png", "image/gif", "image/svg+xml"]
2
+ paginate_models(per_page: 50)
3
+ COMPRESS_FILE_TYPE = ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml'].freeze
4
4
 
5
5
  def index
6
- assets = Asset.order("created_at DESC")
6
+ assets = Asset.order('created_at DESC')
7
7
  @page = Page.find(params[:page_id]) if params[:page_id]
8
8
 
9
9
  @term = params[:search] || ''
10
10
  assets = assets.matching(@term) if @term && !@term.blank?
11
11
 
12
- @types = params[:filter] ? params[:filter].split(",") : []
12
+ @types = params[:filter] ? params[:filter].split(',') : []
13
13
  if @types.include?('all')
14
14
  params[:filter] = nil
15
15
  elsif @types.any?
@@ -18,36 +18,36 @@ class Admin::AssetsController < Admin::ResourceController
18
18
 
19
19
  @assets = paginated? ? assets.paginate(pagination_parameters) : assets.all
20
20
  respond_to do |format|
21
-
22
- format.js {
21
+ format.js do
23
22
  @page = Page.find_by_id(params[:page_id])
24
- render :partial => 'asset_table', :locals => {:with_pagination => true}
25
- }
26
- format.html {
23
+ render partial: 'asset_table', locals: { with_pagination: true }
24
+ end
25
+ format.html do
27
26
  render
28
- }
27
+ end
29
28
  end
30
29
  end
31
30
 
32
31
  def create
33
- @assets, @page_attachments = [], []
32
+ @assets = []
33
+ @page_attachments = []
34
34
  compress = current_site.try(:compress) ? current_site.compress : true
35
35
  asset_params[:asset][:asset].to_a.each do |uploaded_asset|
36
- if uploaded_asset.content_type == "application/octet-stream"
37
- flash[:notice] = "Please only upload assets that have a valid extension in the name."
36
+ if uploaded_asset.content_type == 'application/octet-stream'
37
+ flash[:notice] = 'Please only upload assets that have a valid extension in the name.'
38
38
  else
39
39
  uploaded_asset = compress(uploaded_asset) if $kraken.api_key.present? && COMPRESS_FILE_TYPE.include?(uploaded_asset.content_type) && compress
40
- @asset = Asset.create(:asset => uploaded_asset, :caption => asset_params[:asset][:caption])
40
+ @asset = Asset.create(asset: uploaded_asset, caption: asset_params[:asset][:caption])
41
41
  set_owner_or_editor
42
42
  if params[:for_attachment]
43
43
  @page = Page.find_by_id(params[:page_id]) || Page.new
44
- @page_attachments << @page_attachment = @asset.page_attachments.build(:page => @page)
44
+ @page_attachments << @page_attachment = @asset.page_attachments.build(page: @page)
45
45
  end
46
46
  @assets << @asset
47
47
  end
48
48
  end
49
49
  if asset_params[:for_attachment]
50
- render :partial => 'admin/page_attachments/attachment', :collection => @page_attachments
50
+ render partial: 'admin/page_attachments/attachment', collection: @page_attachments
51
51
  else
52
52
  response_for :create
53
53
  end
@@ -64,20 +64,21 @@ class Admin::AssetsController < Admin::ResourceController
64
64
  end
65
65
  end
66
66
 
67
- private
67
+ private
68
+
68
69
  def compress(uploaded_asset)
69
70
  data = $kraken.upload(uploaded_asset.tempfile.path, 'lossy' => true)
70
- File.write(uploaded_asset.tempfile, open(data.kraked_url).read, { :mode => 'wb' })
71
+ File.write(uploaded_asset.tempfile, open(data.kraked_url).read, { mode: 'wb' })
71
72
  uploaded_asset
72
73
  end
73
74
 
74
75
  def set_owner_or_editor
75
- @asset.created_by_id = current_user.id
76
- @asset.updated_by_id = current_user.id
76
+ @asset.created_by_id = current_user.id
77
+ @asset.updated_by_id = current_user.id
77
78
  @asset.save! if @asset.id.present?
78
79
  end
79
80
 
80
81
  def asset_params
81
- params.permit(:id, :for_attachment, :asset => [:caption, :for_attachment, :asset => []])
82
+ params.permit(:id, :for_attachment, asset: [:caption, :for_attachment, asset: []])
82
83
  end
83
84
  end
@@ -1,5 +1,4 @@
1
1
  class Admin::ConfigurationController < ApplicationController
2
-
3
2
  # Admin::ConfigurationController handles the batch-updating of TrustyCms::Config entries.
4
3
  # It accepts any set of config name-value pairs but is accessible only to administrators.
5
4
  # Note that configuration is routed as a singular resource so we only deal with show/edit/update
@@ -8,9 +7,9 @@ class Admin::ConfigurationController < ApplicationController
8
7
  before_action :initialize_config
9
8
 
10
9
  only_allow_access_to :edit, :update,
11
- :when => [:admin],
12
- :denied_url => { :controller => 'admin/configuration', :action => 'show' },
13
- :denied_message => 'You must have admin privileges to edit site configuration.'
10
+ when: [:admin],
11
+ denied_url: { controller: 'admin/configuration', action: 'show' },
12
+ denied_message: 'You must have admin privileges to edit site configuration.'
14
13
 
15
14
  def show
16
15
  @user = current_user
@@ -27,24 +26,23 @@ class Admin::ConfigurationController < ApplicationController
27
26
  TrustyCms.config.transaction do
28
27
  params[:trusty_config].each_pair do |key, value|
29
28
  @trusty_config[key] = TrustyCms::Config.find_or_initialize_by(key: key)
30
- @trusty_config[key].value = value # validation sets errors on @trusty_config['key'] that the helper methods will pick up
29
+ @trusty_config[key].value = value # validation sets errors on @trusty_config['key'] that the helper methods will pick up
31
30
  end
32
- redirect_to :action => :show
31
+ redirect_to action: :show
33
32
  end
34
33
  rescue ActiveRecord::RecordInvalid => e
35
- flash[:error] = "Configuration error: please check the form"
36
- render :action => :edit
34
+ flash[:error] = 'Configuration error: please check the form'
35
+ render action: :edit
37
36
  rescue TrustyCms::Config::ConfigError => e
38
37
  flash[:error] = "Configuration error: #{e}"
39
- render :action => :edit
38
+ render action: :edit
40
39
  end
41
40
  end
42
41
  end
43
42
 
44
- protected
43
+ protected
45
44
 
46
45
  def initialize_config
47
46
  @trusty_config = {}
48
47
  end
49
-
50
48
  end
@@ -1,8 +1,8 @@
1
1
  class Admin::ExtensionsController < ApplicationController
2
2
  only_allow_access_to :index,
3
- :when => :admin,
4
- :denied_url => { :controller => 'pages', :action => 'index' },
5
- :denied_message => 'You must have administrative privileges to perform this action.'
3
+ when: :admin,
4
+ denied_url: { controller: 'pages', action: 'index' },
5
+ denied_message: 'You must have administrative privileges to perform this action.'
6
6
 
7
7
  def index
8
8
  @template_name = 'index' # for Admin::RegionsHelper
@@ -1,8 +1,7 @@
1
1
  class Admin::LayoutsController < Admin::ResourceController
2
2
  paginate_models
3
3
  only_allow_access_to :index, :show, :new, :create, :edit, :update, :remove, :destroy,
4
- :when => [:designer, :admin],
5
- :denied_url => { :controller => 'admin/pages', :action => 'index' },
6
- :denied_message => 'You must have designer privileges to perform this action.'
7
-
4
+ when: %i[designer admin],
5
+ denied_url: { controller: 'admin/pages', action: 'index' },
6
+ denied_message: 'You must have designer privileges to perform this action.'
8
7
  end
@@ -2,7 +2,7 @@ class Admin::PageAttachmentsController < Admin::ResourceController
2
2
  helper 'admin/assets'
3
3
 
4
4
  def new
5
- render :partial => 'attachment', :object => model
5
+ render partial: 'attachment', object: model
6
6
  end
7
7
 
8
8
  def load_model
@@ -10,14 +10,14 @@ class Admin::PageAttachmentsController < Admin::ResourceController
10
10
  @asset = Asset.find(params[:asset_id])
11
11
  @page = page_attachment_params[:page_id].blank? ? Page.new : Page.find_by_id(page_attachment_params[:page_id])
12
12
  rescue ActiveRecord::RecordNotFound
13
- render :nothing => true, :layout => false
13
+ render nothing: true, layout: false
14
14
  end
15
- self.model = PageAttachment.new(:asset => @asset, :page => @page)
15
+ self.model = PageAttachment.new(asset: @asset, page: @page)
16
16
  end
17
17
 
18
- private
18
+ private
19
+
19
20
  def page_attachment_params
20
21
  params.permit(:asset_id, :page_id)
21
22
  end
22
-
23
23
  end
@@ -1,10 +1,10 @@
1
1
  class Admin::PageFieldsController < Admin::ResourceController
2
2
  def create
3
- self.model.attributes = page_fields_params
3
+ model.attributes = page_fields_params
4
4
  @controller_name = 'page'
5
5
  @template_name = 'edit'
6
- render :partial => "page_field", :object => model,
7
- :locals => { :page_field_counter => params[:page_field_counter].to_i}
6
+ render partial: 'page_field', object: model,
7
+ locals: { page_field_counter: params[:page_field_counter].to_i }
8
8
  end
9
9
 
10
10
  private
@@ -12,5 +12,4 @@ class Admin::PageFieldsController < Admin::ResourceController
12
12
  def page_fields_params
13
13
  params.require(:page_field).permit(:name, :content, :page_id)
14
14
  end
15
-
16
15
  end
@@ -1,16 +1,15 @@
1
1
  class Admin::PagePartsController < Admin::ResourceController
2
2
  def create
3
- self.model.attributes = page_parts_params
3
+ model.attributes = page_parts_params
4
4
  @controller_name = 'page'
5
5
  @template_name = 'edit'
6
- render :partial => "page_part", :object => model,
7
- :locals => {:page_part_counter => params[:index].to_i}
6
+ render partial: 'page_part', object: model,
7
+ locals: { page_part_counter: params[:index].to_i }
8
8
  end
9
9
 
10
- private
10
+ private
11
11
 
12
12
  def page_parts_params
13
13
  params.require(:page_part).permit(:name, :filter_id, :content)
14
14
  end
15
-
16
15
  end