summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorCharlie Root <root@web.ccc.local>2025-01-28 22:47:15 +0100
committerCharlie Root <root@web.ccc.local>2025-01-28 22:47:15 +0100
commitc4296b59a7f9d667d295f9c37b71f7849b818fb3 (patch)
treeccbace3a183c075991a0dfeb1dd9e6f25e901cf3 /app/helpers
parentdfbaadf0210b02a8bb54380c2c50302413dcf6d6 (diff)
Big overhaul patch and style changes
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/admin_helper.rb6
-rw-r--r--app/helpers/content_helper.rb12
-rw-r--r--app/helpers/nodes_helper.rb4
3 files changed, 14 insertions, 8 deletions
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb
index da8945e..232862b 100644
--- a/app/helpers/admin_helper.rb
+++ b/app/helpers/admin_helper.rb
@@ -3,9 +3,9 @@ module AdminHelper
3 def language_selector 3 def language_selector
4 case I18n.locale 4 case I18n.locale
5 when :de 5 when :de
6 link_to 'English', url_for(:overwrite_params => {:locale => :en}) 6 link_to 'English (Aktiv: Deutsch)', url_for(:overwrite_params => {:locale => :en})
7 when :en 7 when :en
8 link_to 'Deutsch', url_for(:overwrite_params => {:locale => :de}) 8 link_to 'Deutsch (Active: English)', url_for(:overwrite_params => {:locale => :de})
9 end 9 end
10 end 10 end
11end \ No newline at end of file 11end
diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb
index d6c96f1..7286976 100644
--- a/app/helpers/content_helper.rb
+++ b/app/helpers/content_helper.rb
@@ -9,13 +9,13 @@ module ContentHelper
9 end 9 end
10 10
11 def calendar 11 def calendar
12 occurrences = Occurrence.find_in_range(Time.now, (Time.now+14.days)) 12 occurrences = Occurrence.find_in_range(Time.now, (Time.now+6.weeks))
13 13
14 if occurrences.empty? 14 if occurrences.empty?
15 occurrences = Occurrence.find_next 15 occurrences = Occurrence.find_next
16 end 16 end
17 17
18 occurrences = occurrences.reject { |o| o.node.head.nil? } 18 occurrences = occurrences.reject { |o| o.node.nil? || o.node.head.nil? }
19 19
20 render( 20 render(
21 :partial => 'content/front_page_calendar', 21 :partial => 'content/front_page_calendar',
@@ -75,6 +75,8 @@ 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' ]
79
78 begin 80 begin
79 if content =~ /<aggregate([^<>]*)>/ 81 if content =~ /<aggregate([^<>]*)>/
80 tag = $~.to_s 82 tag = $~.to_s
@@ -87,13 +89,13 @@ module ContentHelper
87 89
88 options[:partial] = select_partial( options[:partial] ) 90 options[:partial] = select_partial( options[:partial] )
89 91
90 sanitize( content.sub(tag, render_collection(options)) ) 92 sanitize( content.sub(tag, render_collection(options)), :attributes => cccms_attributes )
91 else 93 else
92 sanitize( content ) 94 sanitize( content, :attributes => cccms_attributes )
93 end 95 end
94 96
95 rescue 97 rescue
96 sanitize( content ) 98 sanitize( content, :atttributes => cccms_attributes )
97 end 99 end
98 end 100 end
99 101
diff --git a/app/helpers/nodes_helper.rb b/app/helpers/nodes_helper.rb
index d889719..204ad8a 100644
--- a/app/helpers/nodes_helper.rb
+++ b/app/helpers/nodes_helper.rb
@@ -4,6 +4,10 @@ module NodesHelper
4 if node.head 4 if node.head
5 node.head.title 5 node.head.title
6 else 6 else
7 if not node.draft or not node.draft.title
8 logger.error "Missing title in node #{node.id}"
9 return "NO TITLE"
10 end
7 node.draft.title 11 node.draft.title
8 end 12 end
9 end 13 end