Applied inherit templates. (IssueID: 1267)

This commit is contained in:
Akiko Takano 2013-08-03 06:58:50 +09:00
parent 027888cc7a
commit 995302d903
7 changed files with 65 additions and 16 deletions

View File

@ -99,16 +99,16 @@ class IssueTemplatesController < ApplicationController
@project.id, @tracker.id, true, true).first
if issue_templates.size > 0
issue_templates.each { |x| group.push([x.title, x.id]) }
end
if inherit_template
inherit_templates = IssueTemplate.where('project_id in (?) AND tracker_id = ? AND enabled = ?
AND enabled_sharing = ?',
project_ids, @tracker.id, true, true).order('position')
inherit_templates.each { |x| group.push([x.title, x.id]) }
end
if inherit_template
inherit_templates = IssueTemplate.where('project_id in (?) AND tracker_id = ? AND enabled = ?
AND enabled_sharing = ?',
project_ids, @tracker.id, true, true).order('position')
inherit_templates.each { |x| group.push([x.title, x.id, {:class => "inherited"}]) } if inherit_templates.any?
end
@grouped_options.push([@tracker.name, group])
end
@grouped_options.push([@tracker.name, group]) if group.any?
render :action => "_template_pulldown", :layout => false
end

View File

@ -15,6 +15,10 @@
onclick="checkExpand('template_help_content');">
<%= l(:label_help_message) %></a>
<% end %>
<a class="icon icon-erase" href="#" title="<%= l(:erase_issue_subject_and_description) %>"
onclick="eraseSubjectAndDescription();">
<%= l(:erase_issue_subject_and_description) %></a>
<span id="template_status-area"></span>
</p>
<div class="template_help box" id="template_help_content" style="display: none;"><%= textilizable @setting.help_message %>

View File

@ -5,7 +5,7 @@
</div>
<% end %>
<div class="contextual">
<%= link_to_if_authorized(l(:label_new),
<%= link_to_if_authorized(l(:label_new_templates),
{:controller => 'issue_templates', :action => 'new', :project_id => @project},
:class => 'icon icon-add') %>
</div>
@ -14,8 +14,16 @@
<div class="flash notice"><%= @notice -%></div>
<% end -%>
<% if @template_map.empty? %>
<div class="template_box">
<%= l(:no_issue_templates_for_this_project) %>
</div>
<% end %>
<% @template_map.each_key do |tracker| %>
<h3><%= tracker.name %></h3>
<div class="template_box">
<h3 class="template_tracker"><%= tracker.name %></h3>
<table class="list issues">
<thead>
@ -69,10 +77,13 @@
<% end %>
</tbody>
</table>
</div>
<% end %>
<% unless @inherit_templates.blank? %>
<h3 class="template"><%=h "#{l(:label_inherited_templates)}" %></h3>
<h2 class="template"><%=h "#{l(:label_inherited_templates)}" %></h2>
<div class="template_box">
<table class="list issues">
<thead>
@ -103,4 +114,5 @@
<% end %>
</tbody>
</table>
</div>
<% end %>

View File

@ -8,6 +8,11 @@ function checkExpand(ch) {
"none" == obj.style.display ?"" : "none"
}
function eraseSubjectAndDescription() {
$("#issue_description").val('');
$("#issue_subject").val('');
}
// Change Location of pulldown.
$(document).ready(function() {
$('#template_area').insertBefore($('#issue_subject').parent());

View File

@ -79,4 +79,26 @@ span.help_content {
background: #FFEBC1 url(../images/lamp.png) no-repeat 3px center;
color: #A6750C;
border: solid #FDBF3B 1px;
}
}
option.inherited {
background-color: #FCFD8D;
font-style: oblique;
}
.template_tracker
{
background: url(../images/ticket.png) no-repeat 3px center;
padding-top: 3px;
padding-left: 18px;
}
.template_box {
padding: 6px;
margin-bottom: 10px;
color: rgb(80, 80, 80);
line-height: 1.5em;
border: 1px solid rgb(228, 228, 228);
}
.icon-erase { background-image: url(../images/eraser.png); }

View File

@ -1,6 +1,6 @@
# English strings go here for Rails i18n
en:
issue_templates: Templates
issue_templates: Issue templates
issue_template: Issue template
issue_template_note: note
label_enabled: Enable
@ -29,4 +29,7 @@ en:
label_enabled_sharing: "Enabled sharing with project tree."
label_inherit_templates: "Inherit templates"
label_inherit_templates_help_message: "Inherit templates from parent project. (Only parent's templates are listed which marked as enabled sharing with project tree.)"
label_inherited_templates: "Inherited Templates"
label_inherited_templates: "Inherited templates"
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."

View File

@ -1,6 +1,6 @@
# Japanese translation
ja:
issue_templates: テンプレート
issue_templates: チケットテンプレート
issue_template: チケットテンプレート
issue_template_note: メモ
label_enabled: "有効"
@ -29,4 +29,7 @@ ja:
label_enabled_sharing: "プロジェクトツリーでの共有を許可"
label_inherit_templates: "親プロジェクトのテンプレートを継承"
label_inherit_templates_help_message: "親プロジェクトのテンプレートを継承します。ただし、親プロジェクトのテンプレートで、プロジェクトツリーでの利用を許可しているものに限られます。"
label_inherited_templates: "継承されたテンプレート"
label_inherited_templates: "継承されたテンプレート"
no_issue_templates_for_this_project: "このプロジェクト用のテンプレートは未だ登録されていません。"
link_to_index_edit_template: "テンプレート一覧 / 編集"
erase_issue_subject_and_description: "タイトルと詳細をクリア"