From a1ddc25da0d2aa79a4d9216ef7792f26233bd38e Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 26 Jun 2026 05:19:28 +0200 Subject: Stage 5 fixes: RouteWithParams removal, Globalize fallbacks, search stub, to_s(:db) → to_fs(:db), LockedByAnotherUser autoload, test environment config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove safe_path helper and content_path shim from link_helper.rb - Update all safe_path call sites in views to use named route helpers directly - Fix Globalize fallbacks via config.i18n.fallbacks in application.rb, remove i18n initializer - Stub Node.search returning none (search disabled pending PostgreSQL upgrade) - Replace to_s(:db) with to_fs(:db) in node.rb, nodes_helper.rb, link_helper.rb, admin view - Move LockedByAnotherUser to app/models/locked_by_another_user.rb for Zeitwerk autoloading - Fix config/environments/test.rb: config.assets removed, cache_classes → enable_reloading, test_order removed, minitest pinned to ~> 5.25 - Fix config/environments/development.rb: cache_classes → enable_reloading - Park search vector migration in doc/ pending PostgreSQL and plpgsql availability --- app/helpers/link_helper.rb | 35 ++++++----------------------------- app/helpers/nodes_helper.rb | 2 +- 2 files changed, 7 insertions(+), 30 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb index 39ec495..cb13c8d 100644 --- a/app/helpers/link_helper.rb +++ b/app/helpers/link_helper.rb @@ -1,5 +1,5 @@ module LinkHelper - + def content_path_helper path_array url_for( :controller => :content, @@ -8,11 +8,11 @@ module LinkHelper :page_path => path_array ) end - + def content_url_helper path_array request.protocol + request.host_with_port + content_path_helper(path_array) end - + def link_to_path title, path, html_options = {} return "" if path.nil? @@ -22,9 +22,7 @@ module LinkHelper end active_class = active ? {:class => 'active'} : {:class => 'inactive'} - html_options = html_options.merge(active_class) - locale = params[:locale] || I18n.locale link_to( @@ -39,34 +37,13 @@ module LinkHelper return :class => "selected" end end - + def unlock_link message = "Are you sure you want to unlock?\n" + "Locked by #{@node.lock_owner.login}\n" + - "Last modified #{@page.updated_at.to_s(:db)}" - - link_to 'Unlock', safe_path(:unlock_node_path, @node), :method => :put, :data => { :confirm => message } - end - - # Rails 6.1 workaround: content_path named helper returns RouteWithParams - # when called from within a catch-all glob route request context. - # Rails 6.1 workaround: named route helpers return RouteWithParams when called - # from within a catch-all glob route request context. - # Remove this method when upgrading to Rails 7.0+, where this is fixed. - def safe_path(name, *args) - Rails.application.routes.url_helpers.send(name, *args) - end + "Last modified #{@page.updated_at.to_fs(:db)}" - def content_path(page_path = nil, options = {}) - if page_path.is_a?(Hash) - options = page_path - page_path = options.delete(:page_path) - end - options[:locale] ||= params[:locale] || I18n.locale - Rails.application.routes.url_helpers.content_path( - Array(page_path).join("/").sub(/^\//, ""), - options - ) + link_to 'Unlock', unlock_node_path(@node), :method => :put, :data => { :confirm => message } end end diff --git a/app/helpers/nodes_helper.rb b/app/helpers/nodes_helper.rb index 204ad8a..c739ccd 100644 --- a/app/helpers/nodes_helper.rb +++ b/app/helpers/nodes_helper.rb @@ -31,7 +31,7 @@ module NodesHelper def event_information if @node.event - "#{@node.event.start_time.to_s(:db)} - #{@node.event.end_time.to_s(:db)} > " \ + "#{@node.event.start_time.to_fs(:db)} - #{@node.event.end_time.to_fs(:db)} > " \ "#{link_to 'show', event_path(@node.event)} " \ "#{link_to 'edit', edit_event_path(@node.event)}" else -- cgit v1.3