From 8e32cfc6dfedfb31830750a8f54b965628d563b7 Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Mon, 22 Apr 2013 15:37:28 +0200 Subject: [PATCH] be careful with nested controllers in helpers --- app/helpers/issues_helper.rb | 4 ++-- app/helpers/projects_helper.rb | 2 +- app/helpers/queries_helper.rb | 4 ++-- app/helpers/repositories_helper.rb | 8 ++++---- app/helpers/users_helper.rb | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index da4a88a767..95b72b20f5 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -117,7 +117,7 @@ module IssuesHelper def query_links(title, queries) # links to #index on issues/show - url_params = controller_name == 'issues' ? {:controller => 'issues', :action => 'index', :project_id => @project} : params + url_params = controller_name == 'issues' ? {:controller => '/issues', :action => 'index', :project_id => @project} : params content_tag('h3', title) + queries.collect {|query| @@ -261,7 +261,7 @@ module IssuesHelper def issue_quick_info(issue) ret = link_to(h("#{issue.tracker.name} ##{issue.id} #{issue.status}: #{issue.subject} "), - { :controller => 'issues', :action => 'show', :id => issue.id }, + { :controller => '/issues', :action => 'show', :id => issue.id }, :class => issue.css_classes, :title => "#{ truncate(issue.subject, :length => 100) } (#{ issue.status.name })") ret += "#{ issue.start_date.nil? ? "[?]" : issue.start_date.to_s }" diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 7209000b57..b565e471f4 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -16,7 +16,7 @@ module ProjectsHelper def link_to_version(version, html_options = {}, options={}) return '' unless version && version.is_a?(Version) options - link_to_if version.visible?, options[:before_text].to_s + format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, html_options + link_to_if version.visible?, options[:before_text].to_s + format_version_name(version), { :controller => '/versions', :action => 'show', :id => version }, html_options end def project_settings_tabs diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index a25521b9c6..af192bc6bd 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -30,7 +30,7 @@ module QueriesHelper case value.class.name when 'String' if column.name == :subject - link_to(h(value), :controller => 'issues', :action => 'show', :id => issue) + link_to(h(value), :controller => '/issues', :action => 'show', :id => issue) else h(value) end @@ -49,7 +49,7 @@ module QueriesHelper when 'Project' link_to_project value when 'Version' - link_to(h(value), :controller => 'versions', :action => 'show', :id => value) + link_to(h(value), :controller => '/versions', :action => 'show', :id => value) when 'TrueClass' l(:general_text_Yes) when 'FalseClass' diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 093a626385..6ac4a07509 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -82,7 +82,7 @@ module RepositoriesHelper if s = tree[file][:s] style << ' folder' path_param = to_path_param(@repository.relative_path(file)) - text = link_to(h(text), :controller => 'repositories', + text = link_to(h(text), :controller => '/repositories', :action => 'show', :id => @project, :path => path_param, @@ -92,13 +92,13 @@ module RepositoriesHelper elsif c = tree[file][:c] style << " change-#{c.action}" path_param = to_path_param(@repository.relative_path(c.path)) - text = link_to(h(text), :controller => 'repositories', + text = link_to(h(text), :controller => '/repositories', :action => 'entry', :id => @project, :path => path_param, :rev => @changeset.identifier) unless c.action == 'D' text << raw(" - #{h(c.revision)}") unless c.revision.blank? - text << raw(' (' + link_to(l(:label_diff), :controller => 'repositories', + text << raw(' (' + link_to(l(:label_diff), :controller => '/repositories', :action => 'diff', :id => @project, :path => path_param, @@ -181,7 +181,7 @@ module RepositoriesHelper :disabled => (repository && !repository.new_record?), :onchange => remote_function( :url => { - :controller => 'repositories', + :controller => '/repositories', :action => 'edit', :id => @project }, diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 1b117156b1..460ccfedb2 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -35,7 +35,7 @@ module UsersHelper end def change_status_link(user) - url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil} + url = {:controller => '/users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil} if user.locked? link_to l(:button_unlock), url.merge(:user => {:status => User::STATUS_ACTIVE}), :method => :put, :class => 'icon icon-unlock'