Defect #7280 » gantt_subject_truncation_updated.patch
| app/views/gantts/show.html.erb | ||
|---|---|---|
|
# Width of the entire chart
|
||
|
g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom
|
||
|
@gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width)
|
||
|
@gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width, :subject_width => subject_width)
|
||
|
g_height = [(20 * (@gantt.number_of_rows + 6))+150, 206].max
|
||
|
t_height = g_height + headers_height
|
||
| lib/redmine/helpers/gantt.rb | ||
|---|---|---|
|
def subject_for_project(project, options)
|
||
|
case options[:format]
|
||
|
when :html
|
||
|
subject = "<span class='icon icon-projects #{project.overdue? ? 'project-overdue' : ''}'>"
|
||
|
text_style = "width:#{options[:subject_width]-options[:indent]-20}px;" if options[:subject_width]
|
||
|
subject = "<span class=\"gantt_subject-text icon icon-projects #{project.overdue? ? 'project-overdue' : ''}\""
|
||
|
subject << " style=\"#{text_style}\"" if text_style
|
||
|
subject << '>'
|
||
|
subject << view.link_to_project(project)
|
||
|
subject << '</span>'
|
||
|
html_subject(options, subject, :css => "project-name")
|
||
| ... | ... | |
|
def subject_for_version(version, options)
|
||
|
case options[:format]
|
||
|
when :html
|
||
|
subject = "<span class='icon icon-package #{version.behind_schedule? ? 'version-behind-schedule' : ''} #{version.overdue? ? 'version-overdue' : ''}'>"
|
||
|
text_style = "width:#{options[:subject_width]-options[:indent]-20}px;" if options[:subject_width]
|
||
|
subject = "<span class=\"gantt_subject-text icon icon-package #{version.behind_schedule? ? 'version-behind-schedule' : ''} #{version.overdue? ? 'version-overdue' : ''}\""
|
||
|
subject << " style=\"#{text_style}\"" if text_style
|
||
|
subject << '>'
|
||
|
subject << view.link_to_version(version)
|
||
|
subject << '</span>'
|
||
|
html_subject(options, subject, :css => "version-name")
|
||
| ... | ... | |
|
|
||
|
output = case options[:format]
|
||
|
when :html
|
||
|
css_classes = ''
|
||
|
css_classes = 'gantt_subject-text'
|
||
|
css_classes << ' issue-overdue' if issue.overdue?
|
||
|
css_classes << ' issue-behind-schedule' if issue.behind_schedule?
|
||
|
css_classes << ' icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to
|
||
|
|
||
|
subject = "<span class='#{css_classes}'>"
|
||
|
if issue.assigned_to.present?
|
||
|
if Setting.gravatar_enabled? && issue.assigned_to.present?
|
||
|
assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name
|
||
|
subject << view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string)
|
||
|
subject = view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string)
|
||
|
text_style = 'left:20px;'
|
||
|
else
|
||
|
css_classes << ' icon icon-issue'
|
||
|
subject = ''
|
||
|
text_style = ''
|
||
|
end
|
||
|
text_style += "width:#{options[:subject_width]-options[:indent]-20}px;" if options[:subject_width]
|
||
|
subject << "<span class=\"#{css_classes}\""
|
||
|
subject << " style=\"#{text_style}\"" if text_style
|
||
|
subject << '>'
|
||
|
subject << view.link_to_issue(issue)
|
||
|
subject << '</span>'
|
||
|
html_subject(options, subject, :css => "issue-subject") + "\n"
|
||
|
html_subject(options, subject, :css => 'issue-subject') + "\n"
|
||
|
when :image
|
||
|
image_subject(options, issue.subject)
|
||
|
when :pdf
|
||
| ... | ... | |
|
@issue_ancestors << issue
|
||
|
options[:indent] += options[:indent_increment]
|
||
|
end
|
||
|
|
||
|
output
|
||
|
end
|
||
| ... | ... | |
|
end
|
||
|
|
||
|
def html_subject(params, subject, options={})
|
||
|
output = "<div class=' #{options[:css] }' style='position: absolute;line-height:1.2em;height:16px;top:#{params[:top]}px;left:#{params[:indent]}px;overflow:hidden;'>"
|
||
|
output = "<div class=\"gantt_subject #{options[:css] }\" style=\"top:#{params[:top]}px;left:#{params[:indent]}px;\">"
|
||
|
output << subject
|
||
|
output << "</div>"
|
||
|
@subjects << output
|
||
| public/stylesheets/application.css | ||
|---|---|---|
|
}
|
||
|
.gantt_subjects { font-size: 0.8em; }
|
||
|
.gantt_subject { position: absolute; height: 16px; line-height: 1.2em; }
|
||
|
.gantt_subject-text { position: absolute; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||
|
.task {
|
||
|
position: absolute;
|
||
| ... | ... | |
|
/* Used on 12px Gravatar img tags without the icon background */
|
||
|
.icon-gravatar {
|
||
|
float: left;
|
||
|
margin-right: 4px;
|
||
|
}
|
||
| test/unit/lib/redmine/helpers/gantt_test.rb | ||
|---|---|---|
|
end
|
||
|
|
||
|
context ":html format" do
|
||
|
should "add an absolute positioned div" do
|
||
|
@response.body = @gantt.subject_for_project(@project, {:format => :html})
|
||
|
assert_select "div[style*=absolute]"
|
||
|
end
|
||
|
should "use the indent option to move the div to the right" do
|
||
|
@response.body = @gantt.subject_for_project(@project, {:format => :html, :indent => 40})
|
||
|
assert_select "div[style*=left:40]"
|
||
| ... | ... | |
|
end
|
||
|
context ":html format" do
|
||
|
should "add an absolute positioned div" do
|
||
|
@response.body = @gantt.subject_for_version(@version, {:format => :html})
|
||
|
assert_select "div[style*=absolute]"
|
||
|
end
|
||
|
should "use the indent option to move the div to the right" do
|
||
|
@response.body = @gantt.subject_for_version(@version, {:format => :html, :indent => 40})
|
||
|
assert_select "div[style*=left:40]"
|
||
| ... | ... | |
|
end
|
||
|
context ":html format" do
|
||
|
should "add an absolute positioned div" do
|
||
|
@response.body = @gantt.subject_for_issue(@issue, {:format => :html})
|
||
|
assert_select "div[style*=absolute]"
|
||
|
end
|
||
|
should "use the indent option to move the div to the right" do
|
||
|
@response.body = @gantt.subject_for_issue(@issue, {:format => :html, :indent => 40})
|
||
|
assert_select "div[style*=left:40]"
|
||