diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 9a74f72ba..9703e962e 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -137,7 +137,6 @@ <%= content_tag(:div, :style => style, :class => "gantt_subjects_container") do %> <% style = "" - style += "right:-2px;" style += "width: #{subject_width}px;" style += "height: #{headers_height}px;" style += 'background: #eee;' @@ -145,7 +144,6 @@ <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> <% style = "" - style += "right:-2px;" style += "width: #{subject_width}px;" style += "height: #{t_height}px;" style += 'border-left: 1px solid #c0c0c0;' @@ -272,7 +270,7 @@ wday = 1 if wday > 7 %> <% end %> -<% end %> +<% end %> <% ###### Days headers ####### %> <% if show_days %> @@ -369,10 +367,14 @@ <%= javascript_tag do %> var issue_relation_type = <%= raw Redmine::Helpers::Gantt::DRAW_TYPES.to_json %>; - $(document).ready(drawGanttHandler); - $(window).resize(drawGanttHandler); $(function() { + drawGanttHandler(); + resizableSubjectColumn(); $("#draw_relations").change(drawGanttHandler); $("#draw_progress_line").change(drawGanttHandler); }); + $(window).resize(function() { + drawGanttHandler(); + resizableSubjectColumn(); + }); <% end %> diff --git a/public/javascripts/gantt.js b/public/javascripts/gantt.js index f83eea9f1..2e71178b0 100644 --- a/public/javascripts/gantt.js +++ b/public/javascripts/gantt.js @@ -173,3 +173,25 @@ function drawGanttHandler() { if ($("#draw_relations").prop('checked')) drawRelations(); } + +function resizableSubjectColumn(){ + $('.issue-subject, .project-name, .version-name').each(function(){ + $(this).width($(".gantt_subjects_column").width()-$(this).position().left); + }); + $('td.gantt_subjects_column').resizable({ + alsoResize: '.gantt_subjects_container, .gantt_subjects_container>.gantt_hdr, .project-name, .issue-subject, .version-name', + minWidth: 100, + handles: 'e', + containment: '#content', + create: function( event, ui ) { + $('.ui-resizable-e').css('cursor','ew-resize'); + } + }).on('resize', function (e) { + e.stopPropagation(); + }); + if(isMobile()) { + $('td.gantt_subjects_column').resizable('disable'); + }else{ + $('td.gantt_subjects_column').resizable('enable'); + }; +}