change_to_right_and_left_resizable_panel_v2.patch

Mizuki ISHIKAWA, 2017-07-25 10:25

Download (2.42 KB)

View differences:

app/views/gantts/show.html.erb
137 137
  <%= content_tag(:div, :style => style, :class => "gantt_subjects_container") do %>
138 138
    <%
139 139
      style  = ""
140
      style += "right:-2px;"
141 140
      style += "width: #{subject_width}px;"
142 141
      style += "height: #{headers_height}px;"
143 142
      style += 'background: #eee;'
......
145 144
    <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %>
146 145
    <%
147 146
      style  = ""
148
      style += "right:-2px;"
149 147
      style += "width: #{subject_width}px;"
150 148
      style += "height: #{t_height}px;"
151 149
      style += 'border-left: 1px solid #c0c0c0;'
......
272 270
     wday = 1 if wday > 7
273 271
    %>
274 272
  <% end %>
275
<% end %> 
273
<% end %>
276 274

  
277 275
<% ###### Days headers ####### %>
278 276
<% if show_days %>
......
369 367

  
370 368
<%= javascript_tag do %>
371 369
  var issue_relation_type = <%= raw Redmine::Helpers::Gantt::DRAW_TYPES.to_json %>;
372
  $(document).ready(drawGanttHandler);
373
  $(window).resize(drawGanttHandler);
374 370
  $(function() {
371
    drawGanttHandler();
372
    resizableSubjectColumn();
375 373
    $("#draw_relations").change(drawGanttHandler);
376 374
    $("#draw_progress_line").change(drawGanttHandler);
377 375
  });
376
  $(window).resize(function() {
377
    drawGanttHandler();
378
    resizableSubjectColumn();
379
  });
378 380
<% end %>
public/javascripts/gantt.js
173 173
  if ($("#draw_relations").prop('checked'))
174 174
    drawRelations();
175 175
}
176

  
177
function resizableSubjectColumn(){
178
  $('.issue-subject, .project-name, .version-name').each(function(){
179
    $(this).width($(".gantt_subjects_column").width()-$(this).position().left);
180
  });
181
  $('td.gantt_subjects_column').resizable({
182
    alsoResize: '.gantt_subjects_container, .gantt_subjects_container>.gantt_hdr, .project-name, .issue-subject, .version-name',
183
    minWidth: 100,
184
    handles: 'e',
185
    containment: '#content',
186
    create: function( event, ui ) {
187
      $('.ui-resizable-e').css('cursor','ew-resize');
188
    }
189
  }).on('resize', function (e) {
190
      e.stopPropagation();
191
  });
192
  if(isMobile()) {
193
    $('td.gantt_subjects_column').resizable('disable');
194
  }else{
195
    $('td.gantt_subjects_column').resizable('enable');
196
  };
197
}