summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-27 20:28:00 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-27 20:28:00 +0200
commit4c22631a5a85b3082f0525cc2454d2bd2251922a (patch)
tree5eb55fdf0df1b37437157b5ca089f218bacc2bec /app
parent420506e58fdfc84f1a5bede0a01dedf0af3bb4f3 (diff)
Fix routes after removing the routing-filter
Diffstat (limited to 'app')
-rw-r--r--app/helpers/link_helper.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb
index ea6c26f..878e8e4 100644
--- a/app/helpers/link_helper.rb
+++ b/app/helpers/link_helper.rb
@@ -4,7 +4,7 @@ module LinkHelper
4 url_for( 4 url_for(
5 :controller => :content, 5 :controller => :content,
6 :action => :render_page, 6 :action => :render_page,
7 :locale => params[:locale] || I18n.locale, 7 :locale => (params[:locale] || I18n.locale).to_sym == I18n.default_locale ? nil : (params[:locale] || I18n.locale),
8 :page_path => path_array 8 :page_path => path_array
9 ) 9 )
10 end 10 end
@@ -23,7 +23,7 @@ module LinkHelper
23 23
24 active_class = active ? {:class => 'active'} : {:class => 'inactive'} 24 active_class = active ? {:class => 'active'} : {:class => 'inactive'}
25 html_options = html_options.merge(active_class) 25 html_options = html_options.merge(active_class)
26 locale = params[:locale] || I18n.locale 26 locale = (params[:locale] || I18n.locale).to_sym == I18n.default_locale ? nil : (params[:locale] || I18n.locale)
27 27
28 link_to( 28 link_to(
29 title, 29 title,
@@ -46,4 +46,17 @@ module LinkHelper
46 method: :put, 46 method: :put,
47 form: { data: { confirm: message } } 47 form: { data: { confirm: message } }
48 end 48 end
49
50 def content_path(page_path = nil, options = {})
51 if page_path.is_a?(Hash)
52 options = page_path
53 page_path = options.delete(:page_path)
54 end
55 locale = options[:locale] || params[:locale] || I18n.locale
56 options[:locale] = (locale.to_sym == I18n.default_locale) ? nil : locale
57 Rails.application.routes.url_helpers.content_path(
58 Array(page_path).join("/").sub(/^\//, ""),
59 options
60 )
61 end
49end 62end