From 5f8cc4fa269dadc895d99eec9ef3a82b17c5890a Mon Sep 17 00:00:00 2001 From: erdgeist Date: Thu, 25 Jun 2026 04:35:21 +0200 Subject: Rails 4.2 view fixes - Replace :confirm => with :data => { :confirm => } in all link_to calls - Fix link_to_path helper: use content_path named route instead of hash-style routing - Fix admin/_menu.html.erb: use named routes for logout and admin index - Fix admin layout: load jquery/jquery_ujs before jquery-ui, remove duplicate jQuery 1.3.2 - Add csrf_meta_tags to admin layout --- app/helpers/link_helper.rb | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb index 29c58f0..85d8fbe 100644 --- a/app/helpers/link_helper.rb +++ b/app/helpers/link_helper.rb @@ -14,28 +14,26 @@ module LinkHelper end def link_to_path title, path, html_options = {} + return "" if path.nil? + if params[:page_path] page_path = params[:page_path].is_a?(Array) ? params[:page_path].join("/") : params[:page_path] active = (page_path == path.sub(/^\//, "")) end - + active_class = active ? {:class => 'active'} : {:class => 'inactive'} - + html_options = html_options.merge(active_class) - - params[:locale] ||= I18n.locale - - link_to( - title, { - :controller => :content, - :action => :render_page, - :locale => params[:locale], - :page_path => (path.sub(/^\//, "") rescue "") - }, + + locale = params[:locale] || I18n.locale + + link_to( + title, + content_path(path.sub(/^\//, ""), :locale => locale), html_options ) end - + def selected? controller_name if params[:controller] == controller_name return :class => "selected" @@ -48,7 +46,7 @@ module LinkHelper "Last modified #{@page.updated_at.to_s(:db)}" link_to( - 'Unlock', unlock_node_path(@node), :method => :put, :confirm => message + 'Unlock', unlock_node_path(@node), :method => :put, :data => { :confirm => message } ) end -- cgit v1.3