summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-24 04:13:16 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-24 04:13:16 +0200
commite0a7e0fec760ba12c8067a37e10c96f1f05876e2 (patch)
treed0cf745592a46aee4d4913911fd34c7c24515220 /app/helpers
parent6424e10be5a89f175a74c71c55660412a169b8b8 (diff)
Stage 1 complete: Rails 2.3.5 to Rails 3.2.22.5 upgrade
- Converted plugins to gems (Gemfile) - Updated config structure (application.rb, boot.rb, environment.rb) - Converted routes to Rails 3 DSL - Converted named_scope to scope throughout models - Converted find(:all, :conditions) to where() chains - Fixed has_many :order to use ordering scope - Updated session store and secret token configuration - Fixed exception_notification middleware configuration - Patched Ruby 2.4 / Rails 3.2 incompatibilities: - Integer/Float duration arithmetic (ActiveSupport) - Arel visit_Integer for PostgreSQL adapter - create_database String/Integer coercion - ActionController consider_all_requests_local - Migrated taggings schema for acts-as-taggable-on - Replaced dynamic_form gem with custom form_error_messages helper - Fixed Rails 3 block helper syntax (form_for, form_tag, fields_for) - Fixed admin layout yield - Updated test suite for Rails 3 APIs
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb11
-rw-r--r--app/helpers/content_helper.rb10
2 files changed, 15 insertions, 6 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 22a7940..0be66e9 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,3 +1,14 @@
1# Methods added to this helper will be available to all templates in the application. 1# Methods added to this helper will be available to all templates in the application.
2module ApplicationHelper 2module ApplicationHelper
3 def form_error_messages(form_object)
4 object = form_object.is_a?(ActionView::Helpers::FormBuilder) ? form_object.object : form_object
5 return "" unless object && object.errors.any?
6 content_tag(:div, :class => "error_messages") do
7 content_tag(:ul) do
8 object.errors.full_messages.map do |msg|
9 content_tag(:li, msg)
10 end.join.html_safe
11 end
12 end
13 end
3end 14end
diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb
index 17364f8..dbe468e 100644
--- a/app/helpers/content_helper.rb
+++ b/app/helpers/content_helper.rb
@@ -1,7 +1,7 @@
1module ContentHelper 1module ContentHelper
2 2
3 def main_menu 3 def main_menu
4 menu_items = MenuItem.all(:order => "position ASC") 4 menu_items = MenuItem.order("position ASC").all
5 render( 5 render(
6 :partial => 'content/main_navigation', 6 :partial => 'content/main_navigation',
7 :locals => {:menu_items => menu_items} 7 :locals => {:menu_items => menu_items}
@@ -51,7 +51,7 @@ module ContentHelper
51 end 51 end
52 52
53 def page_title 53 def page_title
54 if @page.title && @page.title != "" 54 if @page && @page.title && @page.title != ""
55 "CCC | #{@page.title}" 55 "CCC | #{@page.title}"
56 else 56 else
57 "CCC | Chaos Computer Club" 57 "CCC | Chaos Computer Club"
@@ -75,7 +75,7 @@ module ContentHelper
75 def aggregate? content 75 def aggregate? content
76 options = {} 76 options = {}
77 77
78 cccms_attributes = ActionView::Base.sanitized_allowed_attributes + [ 'lang' ] 78 cccms_attributes = ActionView::Base.sanitized_allowed_attributes + ['lang']
79 79
80 begin 80 begin
81 if content =~ /<aggregate([^<>]*)>/ 81 if content =~ /<aggregate([^<>]*)>/
@@ -126,9 +126,7 @@ module ContentHelper
126 # Check if a custom partial exists in the proper location 126 # Check if a custom partial exists in the proper location
127 def partial_exists? partial 127 def partial_exists? partial
128 File.exist?( 128 File.exist?(
129 File.join( 129 Rails.root.join('app', 'views', 'custom', 'partials', "_#{partial}.html.erb")
130 RAILS_ROOT, 'app', 'views', 'custom', 'partials', "_#{partial}.html.erb"
131 )
132 ) 130 )
133 end 131 end
134 132