Defect #7280 » gantt_truncate_subjects_add_tooltip.diff
app/views/gantts/show.html.erb | ||
---|---|---|
60 | 60 |
# Width of the entire chart |
61 | 61 |
g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom |
62 | 62 | |
63 |
@gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width) |
|
63 |
@gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width, :subject_width => subject_width)
|
|
64 | 64 | |
65 | 65 |
g_height = [(20 * (@gantt.number_of_rows + 6))+150, 206].max |
66 | 66 |
t_height = g_height + headers_height |
lib/redmine/helpers/gantt.rb | ||
---|---|---|
263 | 263 |
def subject_for_project(project, options) |
264 | 264 |
case options[:format] |
265 | 265 |
when :html |
266 |
subject = "<span class='icon icon-projects #{project.overdue? ? 'project-overdue' : ''}'>" |
|
266 |
text_style = "width:#{options[:subject_width]-options[:indent]-20}px;" if options[:subject_width] |
|
267 | ||
268 |
subject = "<span class=\"gantt_subject-text icon icon-projects #{project.overdue? ? 'project-overdue' : ''}\"" |
|
269 |
subject << " title=\"#{project.name}\"" |
|
270 |
subject << " style=\"#{text_style}\"" if text_style |
|
271 |
subject << '>' |
|
267 | 272 |
subject << view.link_to_project(project) |
268 | 273 |
subject << '</span>' |
269 | 274 |
html_subject(options, subject, :css => "project-name") |
... | ... | |
301 | 306 |
def subject_for_version(version, options) |
302 | 307 |
case options[:format] |
303 | 308 |
when :html |
304 |
subject = "<span class='icon icon-package #{version.behind_schedule? ? 'version-behind-schedule' : ''} #{version.overdue? ? 'version-overdue' : ''}'>" |
|
309 |
text_style = "width:#{options[:subject_width]-options[:indent]-20}px;" if options[:subject_width] |
|
310 | ||
311 |
subject = "<span class=\"gantt_subject-text icon icon-package #{version.behind_schedule? ? 'version-behind-schedule' : ''} #{version.overdue? ? 'version-overdue' : ''}\"" |
|
312 |
subject << " title=\"#{version.to_s_with_project}\"" |
|
313 |
subject << " style=\"#{text_style}\"" if text_style |
|
314 |
subject << '>' |
|
305 | 315 |
subject << view.link_to_version(version) |
306 | 316 |
subject << '</span>' |
307 | 317 |
html_subject(options, subject, :css => "version-name") |
... | ... | |
345 | 355 |
|
346 | 356 |
output = case options[:format] |
347 | 357 |
when :html |
348 |
css_classes = '' |
|
358 | ||
359 |
css_classes = 'gantt_subject-text' |
|
349 | 360 |
css_classes << ' issue-overdue' if issue.overdue? |
350 | 361 |
css_classes << ' issue-behind-schedule' if issue.behind_schedule? |
351 |
css_classes << ' icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to |
|
352 |
|
|
353 |
subject = "<span class='#{css_classes}'>" |
|
354 |
if issue.assigned_to.present? |
|
362 | ||
363 |
if Setting.gravatar_enabled? && issue.assigned_to.present? |
|
355 | 364 |
assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name |
356 |
subject << view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string) |
|
365 |
subject = view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string) |
|
366 |
text_style = 'left:20px;' |
|
367 |
else |
|
368 |
css_classes << ' icon icon-issue' |
|
369 |
subject = '' |
|
370 |
text_style = '' |
|
357 | 371 |
end |
372 | ||
373 |
text_style += "width:#{options[:subject_width]-options[:indent]-20}px;" if options[:subject_width] |
|
374 | ||
375 |
subject << "<span class=\"#{css_classes}\"" |
|
376 |
subject << " title=\"#{issue.subject}\"" |
|
377 |
subject << " style=\"#{text_style}\"" if text_style |
|
378 |
subject << '>' |
|
358 | 379 |
subject << view.link_to_issue(issue) |
359 | 380 |
subject << '</span>' |
360 |
html_subject(options, subject, :css => "issue-subject") + "\n"
|
|
381 |
html_subject(options, subject, :css => 'issue-subject') + "\n"
|
|
361 | 382 |
when :image |
362 | 383 |
image_subject(options, issue.subject) |
363 | 384 |
when :pdf |
... | ... | |
369 | 390 |
@issue_ancestors << issue |
370 | 391 |
options[:indent] += options[:indent_increment] |
371 | 392 |
end |
372 |
|
|
393 | ||
373 | 394 |
output |
374 | 395 |
end |
375 | 396 | |
... | ... | |
709 | 730 |
end |
710 | 731 |
|
711 | 732 |
def html_subject(params, subject, options={}) |
712 |
output = "<div class=' #{options[:css] }' style='position: absolute;line-height:1.2em;height:16px;top:#{params[:top]}px;left:#{params[:indent]}px;overflow:hidden;'>"
|
|
733 |
output = "<div class=\"gantt_subject #{options[:css] }\" style=\"top:#{params[:top]}px;left:#{params[:indent]}px;\">"
|
|
713 | 734 |
output << subject |
714 | 735 |
output << "</div>" |
715 | 736 |
@subjects << output |
public/stylesheets/application.css | ||
---|---|---|
783 | 783 |
} |
784 | 784 | |
785 | 785 |
.gantt_subjects { font-size: 0.8em; } |
786 |
.gantt_subject { position: absolute; height: 16px; line-height: 1.2em; } |
|
787 |
.gantt_subject-text { position: absolute; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } |
|
786 | 788 | |
787 | 789 |
.task { |
788 | 790 |
position: absolute; |
... | ... | |
924 | 926 | |
925 | 927 |
/* Used on 12px Gravatar img tags without the icon background */ |
926 | 928 |
.icon-gravatar { |
927 |
float: left; |
|
928 | 929 |
margin-right: 4px; |
929 | 930 |
} |
930 | 931 |
test/unit/lib/redmine/helpers/gantt_test.rb | ||
---|---|---|
283 | 283 |
end |
284 | 284 |
|
285 | 285 |
context ":html format" do |
286 |
should "add an absolute positioned div" do |
|
287 |
@response.body = @gantt.subject_for_project(@project, {:format => :html}) |
|
288 |
assert_select "div[style*=absolute]" |
|
289 |
end |
|
290 | ||
291 | 286 |
should "use the indent option to move the div to the right" do |
292 | 287 |
@response.body = @gantt.subject_for_project(@project, {:format => :html, :indent => 40}) |
293 | 288 |
assert_select "div[style*=left:40]" |
... | ... | |
449 | 444 |
end |
450 | 445 | |
451 | 446 |
context ":html format" do |
452 |
should "add an absolute positioned div" do |
|
453 |
@response.body = @gantt.subject_for_version(@version, {:format => :html}) |
|
454 |
assert_select "div[style*=absolute]" |
|
455 |
end |
|
456 | ||
457 | 447 |
should "use the indent option to move the div to the right" do |
458 | 448 |
@response.body = @gantt.subject_for_version(@version, {:format => :html, :indent => 40}) |
459 | 449 |
assert_select "div[style*=left:40]" |
... | ... | |
615 | 605 |
end |
616 | 606 | |
617 | 607 |
context ":html format" do |
618 |
should "add an absolute positioned div" do |
|
619 |
@response.body = @gantt.subject_for_issue(@issue, {:format => :html}) |
|
620 |
assert_select "div[style*=absolute]" |
|
621 |
end |
|
622 | ||
623 | 608 |
should "use the indent option to move the div to the right" do |
624 | 609 |
@response.body = @gantt.subject_for_issue(@issue, {:format => :html, :indent => 40}) |
625 | 610 |
assert_select "div[style*=left:40]" |
- « Previous
- 1
- …
- 4
- 5
- 6
- Next »