mirror of
https://github.com/dolphin-emu/redmine_issue_templates.git
synced 2024-11-23 09:30:07 +00:00
Add feature to show warning message for orphaned templates. (IssueID: #1278)
This commit is contained in:
parent
a7cb79600b
commit
2897c547af
@ -12,12 +12,14 @@ class IssueTemplatesController < ApplicationController
|
||||
before_filter :find_tracker, :only => [ :set_pulldown ]
|
||||
|
||||
def index
|
||||
tracker_ids = IssueTemplate.where('project_id = ?', @project.id).pluck(:tracker_id)
|
||||
|
||||
@template_map = Hash::new
|
||||
@project.trackers.each do |tracker|
|
||||
tracker_ids.each do |tracker_id|
|
||||
templates = IssueTemplate.where('project_id = ? AND tracker_id = ?',
|
||||
@project.id, tracker.id).order('position')
|
||||
@project.id, tracker_id).order('position')
|
||||
if templates.any?
|
||||
@template_map[tracker] = templates
|
||||
@template_map[Tracker.find(tracker_id)] = templates
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,2 +1,20 @@
|
||||
module IssueTemplatesHelper
|
||||
module IssueTemplatesHelper
|
||||
def is_project_tracker(tracker_id, project)
|
||||
if project.trackers.exists?(tracker_id)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def non_project_tracker_msg(flag)
|
||||
return "" if flag
|
||||
return "<font class=\"non_project_tracker\">#{l(:unused_tracker_at_this_project)}</font>".html_safe
|
||||
end
|
||||
|
||||
def template_target_trackers(project, issue_template)
|
||||
trackers = nil
|
||||
trackers = project.trackers | [issue_template.tracker]
|
||||
trackers = trackers.collect {|t| [t.name, t.id]}
|
||||
return trackers
|
||||
end
|
||||
end
|
||||
|
@ -9,7 +9,12 @@ helpImg = baseurl + "/images/help.png"
|
||||
|
||||
<fieldset class="issue">
|
||||
<legend class="issue"><%= l(:label_applied_for_issue) %></legend>
|
||||
<p><%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true,:label => l(:label_tracker) %></p>
|
||||
<p><%= f.select :tracker_id, template_target_trackers(@project, @issue_template),
|
||||
:required => true,:label => l(:label_tracker), :selected => @issue_template.tracker.id %>
|
||||
<% if !is_project_tracker(@issue_template.tracker.id, @project) %><br/>
|
||||
<%= non_project_tracker_msg(is_project_tracker(@issue_template.tracker.id, @project)) %>
|
||||
<% end %>
|
||||
</p>
|
||||
<p><%= f.text_field :issue_title, :required => false, :size => 80, :label => l(:issue_title) %>
|
||||
<a class="icon icon-help" href="#" title="<%= l(:help_for_this_field) %>"
|
||||
onclick="checkExpand('issue_title_help_content');"><%= l(:help_for_this_field) %></a><br/>
|
||||
|
@ -24,6 +24,7 @@
|
||||
<% @template_map.each_key do |tracker| %>
|
||||
<div class="template_box">
|
||||
<h3 class="template_tracker"><%= tracker.name %></h3>
|
||||
<%= non_project_tracker_msg(is_project_tracker(tracker.id, @project)) %>
|
||||
|
||||
<table class="list issues">
|
||||
<thead>
|
||||
|
@ -45,6 +45,7 @@
|
||||
<legend class="issue"><%= l(:label_applied_for_issue) %></legend>
|
||||
<p><label><%= l(:label_tracker) %></label>
|
||||
<%= h @issue_template.tracker.name %>
|
||||
<%= non_project_tracker_msg(is_project_tracker(@issue_template.tracker.id, @project)) %>
|
||||
</p>
|
||||
<p>
|
||||
<label><%= l(:issue_title) %></label>
|
||||
|
@ -86,6 +86,16 @@ option.inherited {
|
||||
font-style: oblique;
|
||||
}
|
||||
|
||||
.non_project_tracker
|
||||
{
|
||||
background: url(../images/lamp.png) no-repeat 3px center;
|
||||
color: #dd8888;
|
||||
font-style: italic;
|
||||
font-weight: lighter;
|
||||
padding-top: 3px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.template_tracker
|
||||
{
|
||||
background: url(../images/ticket.png) no-repeat 3px center;
|
||||
@ -101,4 +111,5 @@ padding: 6px;
|
||||
border: 1px solid rgb(228, 228, 228);
|
||||
}
|
||||
|
||||
.icon-erase { background-image: url(../images/eraser.png); }
|
||||
.icon-erase { background-image: url(../images/eraser.png); }
|
||||
|
||||
|
@ -33,3 +33,4 @@ en:
|
||||
no_issue_templates_for_this_project: "No issue templates are defined for this project."
|
||||
link_to_index_edit_template: "Issue templates list / edit templates"
|
||||
erase_issue_subject_and_description: "Clear subject and description text."
|
||||
unused_tracker_at_this_project: "NOTE: This tracker is not defined to use for this project. Please re-define template setting if necessary."
|
||||
|
@ -33,3 +33,4 @@ ja:
|
||||
no_issue_templates_for_this_project: "このプロジェクト用のテンプレートは未だ登録されていません。"
|
||||
link_to_index_edit_template: "テンプレート一覧 / 編集"
|
||||
erase_issue_subject_and_description: "タイトルと詳細をクリア"
|
||||
unused_tracker_at_this_project: "このプロジェクトでは利用されていないトラッカーです。必要に応じて、トラッカーとテンプレートの関連付けを修正して下さい。"
|
||||
|
Loading…
Reference in New Issue
Block a user