You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

routes_helper.rb 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # frozen_string_literal: true
  2. # Redmine - project management software
  3. # Copyright (C) 2006-2022 Jean-Philippe Lang
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. module RoutesHelper
  19. # Returns the path to project issues or to the cross-project
  20. # issue list if project is nil
  21. def _project_issues_path(project, *args)
  22. if project
  23. project_issues_path(project, *args)
  24. else
  25. issues_path(*args)
  26. end
  27. end
  28. def _project_issues_url(project, *args)
  29. if project
  30. project_issues_url(project, *args)
  31. else
  32. issues_url(*args)
  33. end
  34. end
  35. def _project_news_path(project, *args)
  36. if project
  37. project_news_index_path(project, *args)
  38. else
  39. news_index_path(*args)
  40. end
  41. end
  42. def _new_project_issue_path(project, *args)
  43. if project
  44. new_project_issue_path(project, *args)
  45. else
  46. new_issue_path(*args)
  47. end
  48. end
  49. def _project_calendar_path(project, *args)
  50. project ? project_calendar_path(project, *args) : issues_calendar_path(*args)
  51. end
  52. def _project_gantt_path(project, *args)
  53. project ? project_gantt_path(project, *args) : issues_gantt_path(*args)
  54. end
  55. def _time_entries_path(project, issue, *args)
  56. if project
  57. project_time_entries_path(project, *args)
  58. else
  59. time_entries_path(*args)
  60. end
  61. end
  62. def _report_time_entries_path(project, issue, *args)
  63. if project
  64. report_project_time_entries_path(project, *args)
  65. else
  66. report_time_entries_path(*args)
  67. end
  68. end
  69. def _new_time_entry_path(project, issue, *args)
  70. if issue
  71. new_issue_time_entry_path(issue, *args)
  72. elsif project
  73. new_project_time_entry_path(project, *args)
  74. else
  75. new_time_entry_path(*args)
  76. end
  77. end
  78. # Returns the path to bulk update issues or to issue path
  79. # if only one issue is selected for bulk update
  80. def _bulk_update_issues_path(issue, *args)
  81. if issue
  82. issue_path(issue, *args)
  83. else
  84. bulk_update_issues_path(*args)
  85. end
  86. end
  87. def board_path(board, *args)
  88. project_board_path(board.project, board, *args)
  89. end
  90. end