Try to use JQueryUI's tooltip.

This commit is contained in:
Akiko Takano 2014-03-31 05:49:56 +09:00
parent 412f9be7c9
commit f38c661f51
7 changed files with 51 additions and 24 deletions

View File

@ -97,26 +97,24 @@ class IssueTemplatesController < ApplicationController
# update pulldown
def set_pulldown
@grouped_options = []
group = []
@default_template = nil
@setting = IssueTemplateSetting.find_or_create(@project.id)
inherit_template = @setting.enabled_inherit_templates?
@default_template = nil
project_ids = inherit_template ? @project.ancestors.collect(&:id) : [@project.id]
issue_templates = IssueTemplate.where('project_id = ? AND tracker_id = ? AND enabled = ?',
@project.id, @tracker.id, true).order('position')
@project.id, @tracker.id, true).order('position')
project_default_template = IssueTemplate.where('project_id = ? AND tracker_id = ? AND enabled = ?
AND is_default = ?',
@project.id, @tracker.id, true, true).first
AND is_default = ?',
@project.id, @tracker.id, true, true).first
unless project_default_template.blank?
@default_template = project_default_template
@default_template = project_default_template
end
@grouped_options = []
group = []
if issue_templates.size > 0
issue_templates.each { |x| group.push([x.title, x.id]) }
end
@ -125,8 +123,8 @@ class IssueTemplatesController < ApplicationController
inherit_templates = []
# keep ordering of project tree
# TODO: Add Test code.
project_ids.each do |i|
# TODO: Add Test code.
project_ids.each do |i|
inherit_templates.concat(IssueTemplate.where('project_id = ? AND tracker_id = ? AND enabled = ?
AND enabled_sharing = ?', i, @tracker.id, true, true).order('position'))
end
@ -135,7 +133,7 @@ class IssueTemplatesController < ApplicationController
inherit_templates.each do |x|
group.push([x.title, x.id, {:class => "inherited"}])
if x.is_default == true
if project_default_template.blank?
if project_default_template.blank?
@default_template = x
end
end
@ -144,16 +142,16 @@ class IssueTemplatesController < ApplicationController
end
@globalIssueTemplates = GlobalIssueTemplate.find(:all,:include => [:projects],
:conditions => [" tracker_id = ? AND projects.id = ?", @tracker.id, @project.id] )
:conditions => [" tracker_id = ? AND projects.id = ?", @tracker.id, @project.id] )
if @globalIssueTemplates.any?
@globalIssueTemplates.each do |x|
group.push([x.title, x.id, {:class => "global"}])
if x.is_default == true
if project_default_template.blank?
@default_template = x
end
end
# Using global template as default template is now disabled.
# if x.is_default == true
# if project_default_template.blank?
# @default_template = x
# end
# end
end
end

View File

@ -119,7 +119,7 @@
<% end %>
<% unless @globalIssueTemplates.blank? %>
<h2 class="template"><%=h "#{l(:label_global_templates)}" %></h2>
<h2 class="template"><%=h "#{l(:global_issue_templates)}" %></h2>
<div class="template_box">
<table class="list issues">
@ -139,7 +139,10 @@
:action => 'show', :id => issue_template.id,
}, {:title => issue_template.note } %></td>
<td><%= issue_template.title %></td>
<td>
<%= link_to h(issue_template.title), {:controller => 'global_issue_templates',
:id => issue_template.id, :action => 'show'}, title: textilizable(issue_template.description), class: "tooltip" %>
</td>
<td><%=h issue_template.tracker.name %></td>
<td><%=h issue_template.author %></td>
<td><%= format_time(issue_template.updated_on)%> </td>

View File

@ -4,6 +4,19 @@
*/
changeType = "";
$(function () {
$(".tooltip").tooltip({
position: {
my: "left top",
at: "left bottom"
},
content: function () {
return $(this).prop('title');
}
});
});
function checkExpand(ch) {
var obj=document.all && document.all(ch) || document.getElementById && document.getElementById(ch);
if(obj && obj.style) obj.style.display=

View File

@ -118,4 +118,14 @@ padding: 6px;
}
.icon-erase { background-image: url(../images/eraser.png); }
#admin-menu a.redmine-issue-templates {
background-image: url(../images/issue_templates.png);
}
label {
display: inline-block;
width: 5em;
}

View File

@ -37,4 +37,5 @@ en:
label_enabledshaing_help_message: "If true, this template can be shared with descendant projects. (You also have to activate Inherited template option at child project.)"
label_should_replaced: "Replace subject and description"
label_should_replaced_help_message: "If true, existing subject and description are cleared and replaced with template text.Default is false, and appended text.)"
label_global_templates: "Global Issue Templates"
global_issue_templates: "Global Issue Templates"
no_issue_templates_for_this_redmine: "No global issue templates are defined for this redmine."

View File

@ -37,4 +37,5 @@ ja:
label_enabledshaing_help_message: "オプションをチェックすると、子プロジェクトでの利用を許可します。(子プロジェクト側での『テンプレートの継承』を設定した場合)"
label_should_replaced: "テンプレート読み込みの際に本文とタイトルを上書き"
label_should_replaced_help_message: "オプションをチェックすると、テンプレートを適用する際に、入力済みの本文とタイトルを上書きします。デフォルトはOFFです"
label_global_templates: "グローバルテンプレート"
global_issue_templates: "グローバル チケットテンプレート"
no_issue_templates_for_this_redmine: "このRedmineにはグローバルチケットテンプレートは定義されていません。"

View File

@ -8,7 +8,8 @@ class IssueTemplatesIssuesHook < Redmine::Hook::ViewListener
o = stylesheet_link_tag('issue_templates', :plugin => 'redmine_issue_templates')
if (context[:controller].class.name == 'IssuesController' and
context[:controller].action_name != 'index') or
(context[:controller].class.name == 'IssueTemplatesController')
(context[:controller].class.name == 'IssueTemplatesController') or
(context[:controller].class.name == 'GlobalIssueTemplatesController')
o << javascript_include_tag('issue_templates', :plugin => 'redmine_issue_templates')
end
return o