Skip to content

Commit

Permalink
Fix params of new_projet_issue link in ProjectMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
nanego committed Jan 10, 2024
1 parent dfcf45b commit cde9d6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/views/projects/_overview_templates.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<% @project.issue_templates.displayed_on_overview.includes(:tracker).order('trackers.position desc, issue_templates.template_title desc').each do |template| %>
<% if Issue.allowed_target_trackers(@project).include?(template.tracker) && template.template_projects.include?(@project) %>
<div onclick="document.location.href='<%= new_project_issue_path(project_id: @project.identifier, template_id: template.id) %>'" class="template_card">
<div onclick="document.location.href='<%= new_project_issue_path(project: @project, template_id: template.id) %>'" class="template_card">
<div class="template-logo">
<% begin %>
<%= template.template_image.present? ? octicon(template.template_image, :height => 48, :class => "right left", :"aria-label" => "hi") : octicon('repo-template', :height => 48, :class => "right left", :"aria-label" => "hi") %>
Expand Down
18 changes: 9 additions & 9 deletions lib/redmine_templates/menu_manager_patch.rb
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
module RedmineTemplates
module MenuManagerPatch
def render_menu(menu, project = nil)
def render_menu(menu, current_project = nil)

if project.present? &&
project.issue_templates.present? &&
(Issue.allowed_target_trackers(project) & project.issue_templates.map(&:tracker)).any?
if (current_project.present? &&
current_project.issue_templates.present? &&
(Issue.allowed_target_trackers(current_project) & current_project.issue_templates.map(&:tracker)).any?)
Redmine::MenuManager.map :project_menu do |project_menu|
project.issue_templates.includes(:tracker).reorder('trackers.position asc, issue_templates.template_title asc').each do |template|
current_project.issue_templates.includes(:tracker).reorder('trackers.position asc, issue_templates.template_title asc').each do |template|
unless project_menu.find("new_issue_template_#{template.id}".to_sym)
project_menu.push "new_issue_template_#{template.id}".to_sym,
new_project_issue_path(project_id: project.identifier, template_id: template.id),
new_project_issue_path(project: current_project, template_id: template.id),
:param => :project_id,
:caption => Proc.new {
template.reload unless template.has_been_deleted?
template.title_with_tracker
},
:html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) },
:if => Proc.new { |project|
:if => Proc.new { |current_project|
if template.has_been_deleted?
false
else
template.reload
template.template_enabled &&
Issue.allowed_target_trackers(project).include?(template.tracker) &&
template.template_projects.include?(project)
Issue.allowed_target_trackers(current_project).include?(template.tracker) &&
template.template_projects.include?(current_project)
end
},
:permission => :add_issues,
Expand Down

0 comments on commit cde9d6e

Please sign in to comment.