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
@@ -6,32 +6,34 @@ class SiteController < ApplicationController
6
6
  skip_before_action :authenticate_user!
7
7
 
8
8
  def self.cache_timeout=(val)
9
- TrustyCms::PageResponseCacheDirector.cache_timeout=(val)
9
+ TrustyCms::PageResponseCacheDirector.cache_timeout = val
10
10
  end
11
+
11
12
  def self.cache_timeout
12
13
  TrustyCms::PageResponseCacheDirector.cache_timeout
13
14
  end
14
15
 
15
16
  def show_page
16
17
  url = params[:url]
17
- if Array === url
18
- url = url.join('/')
19
- else
20
- url = url.to_s
21
- end
18
+ url = if Array === url
19
+ url.join('/')
20
+ else
21
+ url.to_s
22
+ end
22
23
  if @page = find_page(url)
23
- batch_page_status_refresh if (url == "/" || url == "")
24
+ batch_page_status_refresh if url == '/' || url == ''
24
25
  # This is a bit of a hack to get Vanity URL pages working in another extension
25
26
  # In Rails 2, redirect_to halted execution, so process_page could be aliased and
26
27
  # a redirect could be used. This no longer works. There's a better fix for this,
27
28
  # but for now, anything that aliases process_page can return false if it's rendering
28
29
  # or redirecting on its own.
29
30
  return unless process_page(@page)
31
+
30
32
  set_cache_control
31
33
  @performed_render ||= true
32
34
  render layout: false
33
35
  else
34
- render :template => 'site/not_found', :status => 404, layout: false
36
+ render template: 'site/not_found', status: 404, layout: false
35
37
  end
36
38
  rescue Page::MissingRootPageError
37
39
  redirect_to welcome_path
@@ -42,7 +44,7 @@ class SiteController < ApplicationController
42
44
  end
43
45
  # hide_action :cacheable_request?
44
46
 
45
- def set_expiry(time, options={})
47
+ def set_expiry(time, options = {})
46
48
  expires_in time, options
47
49
  end
48
50
  # hide_action :set_expiry
@@ -53,52 +55,53 @@ class SiteController < ApplicationController
53
55
  # hide_action :set_expiry
54
56
 
55
57
  private
56
- def batch_page_status_refresh
57
- @changed_pages = []
58
- @pages = Page.where({:status_id => Status[:scheduled].id})
59
- @pages.each do |page|
60
- if page.published_at <= Time.now
61
- page.status_id = Status[:published].id
62
- page.save
63
- @changed_pages << page.id
64
- end
65
- end
66
58
 
67
- expires_in nil, :private=>true, "no-cache" => true if @changed_pages.length > 0
59
+ def batch_page_status_refresh
60
+ @changed_pages = []
61
+ @pages = Page.where({ status_id: Status[:scheduled].id })
62
+ @pages.each do |page|
63
+ if page.published_at <= Time.now
64
+ page.status_id = Status[:published].id
65
+ page.save
66
+ @changed_pages << page.id
67
+ end
68
68
  end
69
69
 
70
- def set_cache_control
71
- response_cache_director(@page).set_cache_control
72
- end
70
+ expires_in nil, :private => true, 'no-cache' => true if @changed_pages.length > 0
71
+ end
73
72
 
74
- def response_cache_director(page)
75
- klass_name = "TrustyCms::#{page.class}ResponseCacheDirector"
76
- begin
77
- klass = klass_name.constantize
78
- rescue NameError, LoadError
79
- director_klass = "TrustyCms::PageResponseCacheDirector"
80
- #Rubocop: The use of eval is a serious security risk.
81
- #eval(%Q{class #{klass_name} < #{director_klass}; end}, TOPLEVEL_BINDING)
82
- klass = director_klass.constantize
83
- end
84
- klass.new(page, self)
85
- end
73
+ def set_cache_control
74
+ response_cache_director(@page).set_cache_control
75
+ end
86
76
 
87
- def find_page(url)
88
- found = Page.find_by_path(url, live?)
89
- found if found and (found.published? or dev?)
77
+ def response_cache_director(page)
78
+ klass_name = "TrustyCms::#{page.class}ResponseCacheDirector"
79
+ begin
80
+ klass = klass_name.constantize
81
+ rescue NameError, LoadError
82
+ director_klass = 'TrustyCms::PageResponseCacheDirector'
83
+ # Rubocop: The use of eval is a serious security risk.
84
+ # eval(%Q{class #{klass_name} < #{director_klass}; end}, TOPLEVEL_BINDING)
85
+ klass = director_klass.constantize
90
86
  end
87
+ klass.new(page, self)
88
+ end
91
89
 
92
- def process_page(page)
93
- page.pagination_parameters = pagination_parameters
94
- page.process(request, response)
95
- end
90
+ def find_page(url)
91
+ found = Page.find_by_path(url, live?)
92
+ found if found && (found.published? || dev?)
93
+ end
96
94
 
97
- def dev?
98
- request.host == @trusty_config['dev.host'] || request.host =~ /^dev\./
99
- end
95
+ def process_page(page)
96
+ page.pagination_parameters = pagination_parameters
97
+ page.process(request, response)
98
+ end
100
99
 
101
- def live?
102
- not dev?
103
- end
100
+ def dev?
101
+ request.host == @trusty_config['dev.host'] || request.host =~ /^dev\./
102
+ end
103
+
104
+ def live?
105
+ not dev?
106
+ end
104
107
  end
@@ -1,36 +1,26 @@
1
1
  class SocialMailerController < ApplicationController
2
2
  include ShareLayouts::Controllers::ActionController
3
- trusty_layout "default", {:only => :create_social_mail}
3
+ trusty_layout 'default', { only: :create_social_mail }
4
4
  # no_login_required
5
5
  skip_before_action :authenticate_user!
6
6
 
7
7
  def create_social_mail
8
-
9
8
  mailer_options = {
10
- :to => params[:to],
11
- :from => params[:from],
12
- :from_name => params[:from_name],
13
- :message => params[:message],
14
- :subject => params[:subject]
9
+ to: params[:to],
10
+ from: params[:from],
11
+ from_name: params[:from_name],
12
+ message: params[:message],
13
+ subject: params[:subject],
15
14
  }
16
-
17
- if verify_recaptcha(action: 'emailSeats')
18
- RadSocialMailer.social_mail(mailer_options).deliver_now
19
- head :ok
20
- else
21
- head :bad_request, :ErrorMsg => 'We have detected suspicious activity and have disabled this feature for your user.'
22
- end
23
-
24
15
  end
25
16
 
26
17
  def social_mail_form
27
- render :template => "rad_social_mailer/social_mail_form",
28
- :layout => false,
29
- :locals => {
30
- :email_message => params[:email_message],
31
- :email_subject => params[:email_subject],
32
- :email_action_url => params[:email_action_url]
18
+ render template: 'rad_social_mailer/social_mail_form',
19
+ layout: false,
20
+ locals: {
21
+ email_message: params[:email_message],
22
+ email_subject: params[:email_subject],
23
+ email_action_url: params[:email_action_url],
33
24
  }
34
25
  end
35
-
36
26
  end
@@ -6,21 +6,21 @@ module Admin::ConfigurationHelper
6
6
  # show_config("admin.title")
7
7
  # => <label for="admin_title">Admin title<label><span id="admin_title">TrustyCms CMS</span>
8
8
  #
9
- def show_config(key, options={})
9
+ def show_config(key, options = {})
10
10
  setting = setting_for(key)
11
11
  setting.valid?
12
12
  domkey = key.gsub(/\W/, '_')
13
- html = ""
14
- html << content_tag(:label, t("trusty_config.#{key}").titlecase, :for => domkey)
13
+ html = ''
14
+ html << content_tag(:label, t("trusty_config.#{key}").titlecase, for: domkey)
15
15
  if setting.boolean?
16
16
  value = setting.checked? ? t('yes') : t('no')
17
- html << content_tag(:span, value, :id => domkey, :class => "#{value} #{options[:class]}")
17
+ html << content_tag(:span, value, id: domkey, class: "#{value} #{options[:class]}")
18
18
  else
19
19
  value = setting.selected_value || setting.value
20
- html << content_tag(:span, value, :id => domkey, :class => options[:class])
20
+ html << content_tag(:span, value, id: domkey, class: options[:class])
21
21
  end
22
- html << content_tag(:span, " #{t("units.#{setting.units}")}", :class => 'units') if setting.units
23
- html << content_tag(:span, " #{t('warning')}: #{[setting.errors[:value]].flatten.first}", :class => 'warning') if setting.errors.messages[:value].present?
22
+ html << content_tag(:span, " #{t("units.#{setting.units}")}", class: 'units') if setting.units
23
+ html << content_tag(:span, " #{t('warning')}: #{[setting.errors[:value]].flatten.first}", class: 'warning') if setting.errors.messages[:value].present?
24
24
  Rails.logger.error(html)
25
25
  html.html_safe
26
26
  end
@@ -41,34 +41,34 @@ module Admin::ConfigurationHelper
41
41
  # edit_setting("user.allow_password_reset?")
42
42
  # => <label for="user_allow_password_reset_">Admin title<label><input type="checkbox" name="config['user.allow_password_reset?']" id="user_allow_password_reset_" value="1" checked="checked" />
43
43
  #
44
- def edit_config(key, options={})
44
+ def edit_config(key, _options = {})
45
45
  setting = setting_for(key)
46
46
  domkey = key.gsub(/\W/, '_')
47
47
  name = "trusty_config[#{key}]"
48
48
  title = t("trusty_config.#{key}").titlecase
49
- title << content_tag(:span, " (#{t("units.#{setting.units}")})", :class => 'units') if setting.units
49
+ title << content_tag(:span, " (#{t("units.#{setting.units}")})", class: 'units') if setting.units
50
50
  value = params[key.to_sym].nil? ? setting.value : params[key.to_sym]
51
- html = ""
51
+ html = ''
52
52
  if setting.boolean?
53
53
  html << hidden_field_tag(name, 0)
54
- html << check_box_tag(name, 1, value, :class => 'setting', :id => domkey)
55
- html << content_tag(:label, title.html_safe, :class => 'checkbox', :for => domkey)
54
+ html << check_box_tag(name, 1, value, class: 'setting', id: domkey)
55
+ html << content_tag(:label, title.html_safe, class: 'checkbox', for: domkey)
56
56
  elsif setting.selector?
57
- html << content_tag(:label, title.html_safe, :for => domkey)
58
- html << select_tag(name, options_for_select(setting.definition.selection, value), :class => 'setting', :id => domkey)
57
+ html << content_tag(:label, title.html_safe, for: domkey)
58
+ html << select_tag(name, options_for_select(setting.definition.selection, value), class: 'setting', id: domkey)
59
59
  else
60
- html << content_tag(:label, title.html_safe, :for => domkey)
61
- html << text_field_tag(name, value, :class => 'textbox', :id => domkey)
60
+ html << content_tag(:label, title.html_safe, for: domkey)
61
+ html << text_field_tag(name, value, class: 'textbox', id: domkey)
62
62
  end
63
63
  if setting.errors[:value].present?
64
- html << content_tag(:span, [setting.errors[:value]].flatten.first, :class => 'error')
65
- html = content_tag(:span, html.html_safe, :class => "error-with-field")
64
+ html << content_tag(:span, [setting.errors[:value]].flatten.first, class: 'error')
65
+ html = content_tag(:span, html.html_safe, class: 'error-with-field')
66
66
  end
67
67
  html.html_safe
68
68
  end
69
69
 
70
70
  def setting_for(key)
71
- @trusty_config ||= {} # normally initialized in Admin::ConfigurationController
71
+ @trusty_config ||= {} # normally initialized in Admin::ConfigurationController
72
72
  @trusty_config[key] ||= TrustyCms.config.find_or_initialize_by(key: key)
73
73
  end
74
74
 
@@ -77,5 +77,4 @@ module Admin::ConfigurationHelper
77
77
  setting.definition
78
78
  end
79
79
  end
80
-
81
80
  end
@@ -1,3 +1,2 @@
1
1
  module Admin::LayoutsHelper
2
-
3
2
  end
@@ -1,18 +1,16 @@
1
1
  module Admin::NodeHelper
2
-
3
2
  def render_nodes(page, starting_index, parent_index = nil, simple = false)
4
- @rendered_html = ""
3
+ @rendered_html = ''
5
4
  render_node page, starting_index, parent_index, simple
6
5
  @rendered_html
7
6
  end
8
7
 
9
8
  def render_node(page, index, parent_index = nil, simple = false)
10
-
11
9
  @current_node = prepare_page(page)
12
10
 
13
- @rendered_html += (render :partial => 'admin/pages/node',
14
- :locals => {level: index, index: index, parent_index: parent_index,
15
- page: page, simple: simple, branch: (page.children.count > 0) })
11
+ @rendered_html += (render partial: 'admin/pages/node',
12
+ locals: { level: index, index: index, parent_index: parent_index,
13
+ page: page, simple: simple, branch: (page.children.count > 0) })
16
14
  index
17
15
  end
18
16
 
@@ -35,14 +33,19 @@ module Admin::NodeHelper
35
33
 
36
34
  def expanded_rows
37
35
  unless @expanded_rows
38
- @expanded_rows = case
39
- when rows = cookies[:expanded_rows]
40
- rows.split(',').map { |x| Integer(x) rescue nil }.compact
41
- else
42
- []
36
+ @expanded_rows = if rows = cookies[:expanded_rows]
37
+ rows.split(',').map do |x|
38
+ begin
39
+ Integer(x)
40
+ rescue StandardError
41
+ nil
42
+ end
43
+ end .compact
44
+ else
45
+ []
43
46
  end
44
47
 
45
- if homepage and !@expanded_rows.include?(homepage.id)
48
+ if homepage && !@expanded_rows.include?(homepage.id)
46
49
  @expanded_rows << homepage.id
47
50
  end
48
51
  end
@@ -54,37 +57,37 @@ module Admin::NodeHelper
54
57
  end
55
58
 
56
59
  def expander(level)
57
- unless @current_node.children.empty? or level == 0
58
- image((expanded ? "collapse" : "expand"),
59
- :class => "expander", :alt => 'toggle children',
60
- :title => '')
60
+ if @current_node.children.empty? || (level == 0)
61
+ ''
61
62
  else
62
- ""
63
+ image((expanded ? 'collapse' : 'expand'),
64
+ class: 'expander', alt: 'toggle children',
65
+ title: '')
63
66
  end
64
67
  end
65
68
 
66
69
  def icon
67
70
  icon_name = @current_node.virtual? ? 'virtual_page' : 'page'
68
- image(icon_name, :class => "icon", :alt => '', :title => '')
71
+ image(icon_name, class: 'icon', alt: '', title: '')
69
72
  end
70
73
 
71
74
  def node_title
72
- %{<span class="title">#{ h(@current_node.title) }</span>}.html_safe
75
+ %{<span class="title">#{h(@current_node.title)}</span>}.html_safe
73
76
  end
74
77
 
75
78
  def page_type
76
79
  display_name = @current_node.class.display_name
77
80
  if display_name == 'Page'
78
- ""
81
+ ''
79
82
  else
80
- %{<span class="info">(#{ h(display_name) })</span>}.html_safe
83
+ %{<span class="info">(#{h(display_name)})</span>}.html_safe
81
84
  end
82
85
  end
83
86
 
84
87
  def spinner
85
88
  image('spinner.gif',
86
- :class => 'busy', :id => "busy_#{@current_node.id}",
87
- :alt => "", :title => "",
88
- :style => 'display: none;')
89
+ class: 'busy', id: "busy_#{@current_node.id}",
90
+ alt: '', title: '',
91
+ style: 'display: none;')
89
92
  end
90
93
  end
@@ -16,10 +16,10 @@ module Admin::PagesHelper
16
16
 
17
17
  def status_to_display
18
18
  @page.status_id = 100 if @page.status_id == 90
19
- @display_status = Status.selectable.map{ |s| [I18n.translate(s.name.downcase), s.id] }
19
+ @display_status = Status.selectable.map { |s| [I18n.translate(s.name.downcase), s.id] }
20
20
  end
21
21
 
22
22
  def clean_page_description(page)
23
- page.description.to_s.strip.gsub(/\t/,'').gsub(/\s+/,' ')
23
+ page.description.to_s.strip.gsub(/\t/, '').gsub(/\s+/, ' ')
24
24
  end
25
25
  end
@@ -1,3 +1,2 @@
1
1
  module Admin::PreferencesHelper
2
-
3
2
  end
@@ -1,27 +1,26 @@
1
- require "RedCloth"
1
+ require 'RedCloth'
2
2
 
3
3
  module Admin::ReferencesHelper
4
4
  def tag_reference
5
5
  String.new.tap do |output|
6
6
  class_of_page.tag_descriptions.sort.each do |tag_name, description|
7
- value = t("desc.#{tag_name.gsub(':','-')}").match('desc') ? description : t("desc.#{tag_name.gsub(':','-')}")
8
- output << render(:partial => "admin/references/tag_reference.haml",
9
- :locals => {:tag_name => tag_name,
10
- :description => RedCloth.new(TrustyCms::Taggable::Util.strip_leading_whitespace(value)).to_html
11
- })
7
+ value = t("desc.#{tag_name.gsub(':', '-')}").match('desc') ? description : t("desc.#{tag_name.gsub(':', '-')}")
8
+ output << render(partial: 'admin/references/tag_reference.haml',
9
+ locals: { tag_name: tag_name,
10
+ description: RedCloth.new(TrustyCms::Taggable::Util.strip_leading_whitespace(value)).to_html })
12
11
  end
13
12
  end
14
13
  end
15
14
 
16
15
  def filter_reference
17
- unless filter.blank?
16
+ if filter.blank?
17
+ 'There is no filter on the current page part.'
18
+ else
18
19
  if filter.description.blank?
19
- "There is no documentation on this filter."
20
+ 'There is no documentation on this filter.'
20
21
  else
21
22
  filter.description
22
23
  end
23
- else
24
- "There is no filter on the current page part."
25
24
  end
26
25
  end
27
26
 
@@ -1,14 +1,14 @@
1
1
  module Admin::RegionsHelper
2
- def render_region(region, options={}, &block)
2
+ def render_region(region, options = {}, &block)
3
3
  lazy_initialize_region_set
4
4
  default_partials = TrustyCms::AdminUI::RegionPartials.new(self)
5
5
  if block_given?
6
6
  block.call(default_partials)
7
- (options[:locals] ||= {}).merge!(:defaults => default_partials)
7
+ (options[:locals] ||= {}).merge!(defaults: default_partials)
8
8
  end
9
9
  output = @region_set[region].compact.map do |partial|
10
10
  begin
11
- render options.merge(:partial => partial)
11
+ render options.merge(partial: partial)
12
12
  rescue ::ActionView::MissingTemplate # couldn't find template
13
13
  default_partials[partial]
14
14
  rescue ::ActionView::TemplateError => e # error in template