]> source.dussan.org Git - redmine.git/commitdiff
Use named routes.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 14 Nov 2014 21:51:32 +0000 (21:51 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 14 Nov 2014 21:51:32 +0000 (21:51 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@13598 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb

index 65cf3ad3efc541867b75c87f89ef56cd7f5f43fb..8bc672e62f80fe4d8bf37c17e29f7c608bcf5ec7 100644 (file)
@@ -793,21 +793,18 @@ module ApplicationHelper
               if oid.to_s == identifier &&
                 issue = Issue.visible.find_by_id(oid)
                 anchor = comment_id ? "note-#{comment_id}" : nil
-                link = link_to(h("##{oid}#{comment_suffix}"),
-                               {:only_path => only_path, :controller => 'issues',
-                                :action => 'show', :id => oid, :anchor => anchor},
+                link = link_to("##{oid}#{comment_suffix}",
+                               issue_path(issue, :only_path => only_path, :anchor => anchor),
                                :class => issue.css_classes,
                                :title => "#{issue.subject.truncate(100)} (#{issue.status.name})")
               end
             when 'document'
               if document = Document.visible.find_by_id(oid)
-                link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document},
-                                                  :class => 'document'
+                link = link_to(document.title, document_path(document, :only_path => only_path), :class => 'document')
               end
             when 'version'
               if version = Version.visible.find_by_id(oid)
-                link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version},
-                                                :class => 'version'
+                link = link_to(version.name, version_path(version, :only_path => only_path), :class => 'version')
               end
             when 'message'
               if message = Message.visible.find_by_id(oid)
@@ -815,13 +812,11 @@ module ApplicationHelper
               end
             when 'forum'
               if board = Board.visible.find_by_id(oid)
-                link = link_to h(board.name), {:only_path => only_path, :controller => 'boards', :action => 'show', :id => board, :project_id => board.project},
-                                               :class => 'board'
+                link = link_to(board.name, project_board_path(board.project, board, :only_path => only_path), :class => 'board')
               end
             when 'news'
               if news = News.visible.find_by_id(oid)
-                link = link_to h(news.title), {:only_path => only_path, :controller => 'news', :action => 'show', :id => news},
-                                              :class => 'news'
+                link = link_to(news.title, news_path(news, :only_path => only_path), :class => 'news')
               end
             when 'project'
               if p = Project.visible.find_by_id(oid)
@@ -835,23 +830,19 @@ module ApplicationHelper
             case prefix
             when 'document'
               if project && document = project.documents.visible.find_by_title(name)
-                link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document},
-                                                  :class => 'document'
+                link = link_to(document.title, document_path(document, :only_path => only_path), :class => 'document')
               end
             when 'version'
               if project && version = project.versions.visible.find_by_name(name)
-                link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version},
-                                                :class => 'version'
+                link = link_to(version.name, version_path(version, :only_path => only_path), :class => 'version')
               end
             when 'forum'
               if project && board = project.boards.visible.find_by_name(name)
-                link = link_to h(board.name), {:only_path => only_path, :controller => 'boards', :action => 'show', :id => board, :project_id => board.project},
-                                               :class => 'board'
+                link = link_to(board.name, project_board_path(board.project, board, :only_path => only_path), :class => 'board')
               end
             when 'news'
               if project && news = project.news.visible.find_by_title(name)
-                link = link_to h(news.title), {:only_path => only_path, :controller => 'news', :action => 'show', :id => news},
-                                              :class => 'news'
+                link = link_to(news.title, news_path(news, :only_path => only_path), :class => 'news')
               end
             when 'commit', 'source', 'export'
               if project