From c4296b59a7f9d667d295f9c37b71f7849b818fb3 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Tue, 28 Jan 2025 22:47:15 +0100 Subject: Big overhaul patch and style changes --- app/helpers/admin_helper.rb | 6 +++--- app/helpers/content_helper.rb | 12 +++++++----- app/helpers/nodes_helper.rb | 4 ++++ 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index da8945ed..232862b8 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -3,9 +3,9 @@ module AdminHelper def language_selector case I18n.locale when :de - link_to 'English', url_for(:overwrite_params => {:locale => :en}) + link_to 'English (Aktiv: Deutsch)', url_for(:overwrite_params => {:locale => :en}) when :en - link_to 'Deutsch', url_for(:overwrite_params => {:locale => :de}) + link_to 'Deutsch (Active: English)', url_for(:overwrite_params => {:locale => :de}) end end -end \ No newline at end of file +end diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index d6c96f17..7286976f 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb @@ -9,13 +9,13 @@ module ContentHelper end def calendar - occurrences = Occurrence.find_in_range(Time.now, (Time.now+14.days)) + occurrences = Occurrence.find_in_range(Time.now, (Time.now+6.weeks)) if occurrences.empty? occurrences = Occurrence.find_next end - occurrences = occurrences.reject { |o| o.node.head.nil? } + occurrences = occurrences.reject { |o| o.node.nil? || o.node.head.nil? } render( :partial => 'content/front_page_calendar', @@ -75,6 +75,8 @@ module ContentHelper def aggregate? content options = {} + cccms_attributes = ActionView::Base.sanitized_allowed_attributes + [ 'lang' ] + begin if content =~ /]*)>/ tag = $~.to_s @@ -87,13 +89,13 @@ module ContentHelper options[:partial] = select_partial( options[:partial] ) - sanitize( content.sub(tag, render_collection(options)) ) + sanitize( content.sub(tag, render_collection(options)), :attributes => cccms_attributes ) else - sanitize( content ) + sanitize( content, :attributes => cccms_attributes ) end rescue - sanitize( content ) + sanitize( content, :atttributes => cccms_attributes ) end end diff --git a/app/helpers/nodes_helper.rb b/app/helpers/nodes_helper.rb index d8897195..204ad8af 100644 --- a/app/helpers/nodes_helper.rb +++ b/app/helpers/nodes_helper.rb @@ -4,6 +4,10 @@ module NodesHelper if node.head node.head.title else + if not node.draft or not node.draft.title + logger.error "Missing title in node #{node.id}" + return "NO TITLE" + end node.draft.title end end -- cgit v1.3