diff --git app/views/gantts/show.html.erb app/views/gantts/show.html.erb index 8203662..05c015b 100644 --- app/views/gantts/show.html.erb +++ app/views/gantts/show.html.erb @@ -60,7 +60,7 @@ end # 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 diff --git lib/redmine/helpers/gantt.rb lib/redmine/helpers/gantt.rb index b0d7229..86b6c48 100644 --- lib/redmine/helpers/gantt.rb +++ lib/redmine/helpers/gantt.rb @@ -263,7 +263,12 @@ module Redmine def subject_for_project(project, options) case options[:format] when :html - subject = "" + text_style = "width:#{options[:subject_width]-options[:indent]-20}px;" if options[:subject_width] + + subject = "' subject << view.link_to_project(project) subject << '' html_subject(options, subject, :css => "project-name") @@ -301,7 +306,12 @@ module Redmine def subject_for_version(version, options) case options[:format] when :html - subject = "" + text_style = "width:#{options[:subject_width]-options[:indent]-20}px;" if options[:subject_width] + + subject = "' subject << view.link_to_version(version) subject << '' html_subject(options, subject, :css => "version-name") @@ -345,19 +355,30 @@ module Redmine 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 = "" - 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 << "' subject << view.link_to_issue(issue) subject << '' - 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 @@ -369,7 +390,7 @@ module Redmine @issue_ancestors << issue options[:indent] += options[:indent_increment] end - + output end @@ -709,7 +730,7 @@ module Redmine end def html_subject(params, subject, options={}) - output = "
" + output = "
" output << subject output << "
" @subjects << output diff --git public/stylesheets/application.css public/stylesheets/application.css index 8ec94f3..9b35665 100644 --- public/stylesheets/application.css +++ public/stylesheets/application.css @@ -783,6 +783,8 @@ background-image:url('../images/close_hl.png'); } .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; @@ -924,7 +926,6 @@ td.username img.gravatar { /* Used on 12px Gravatar img tags without the icon background */ .icon-gravatar { - float: left; margin-right: 4px; } diff --git test/unit/lib/redmine/helpers/gantt_test.rb test/unit/lib/redmine/helpers/gantt_test.rb index ec9b065..56205eb 100644 --- test/unit/lib/redmine/helpers/gantt_test.rb +++ test/unit/lib/redmine/helpers/gantt_test.rb @@ -283,11 +283,6 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase 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]" @@ -449,11 +444,6 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase 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]" @@ -615,11 +605,6 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase 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]"