]> source.dussan.org Git - redmine.git/commitdiff
Make gantt columns resizable (#20481).
authorGo MAEDA <maeda@farend.jp>
Sat, 25 Nov 2017 13:51:20 +0000 (13:51 +0000)
committerGo MAEDA <maeda@farend.jp>
Sat, 25 Nov 2017 13:51:20 +0000 (13:51 +0000)
Contributed by Mizuki ISHIKAWA.

git-svn-id: http://svn.redmine.org/redmine/trunk@17026 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/gantts/show.html.erb
public/javascripts/gantt.js

index 9a74f72baa971685639199c641cb8edc6dbb8d1a..9703e962ea61c84c5d6c4273cb1ebf49dfbf1ea7 100644 (file)
   <%= 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;'
     <%= 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;'
      wday = 1 if wday > 7
     %>
   <% end %>
-<% end %> 
+<% end %>
 
 <% ###### Days headers ####### %>
 <% if show_days %>
 
 <%= 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 %>
index f83eea9f1aaa278e50958c207e535785b1bec791..2e71178b0f494c8cd9b9a45dc3ef204d5b1ec019 100644 (file)
@@ -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');
+  };
+}