Show / hide work package relations table after AJAX updates

Fixes integration tests
pull/810/head
Till Breuer 11 years ago
parent f022ca714f
commit ee11a9fe7d
  1. 1
      app/assets/stylesheets/default/main.css.erb
  2. 1
      app/views/work_package_relations/create.js.erb
  3. 4
      app/views/work_package_relations/destroy.js.erb
  4. 34
      app/views/work_packages/_relations.html.erb

@ -43,6 +43,7 @@ table.list td.buttons a { padding-right: 0.6em; }
table.list caption { text-align: left; padding: 0.5em 0.5em 0.5em 0; }
table.work-package-data-table { margin-top: 5px; }
table.work-package-data-table.hidden { display: none; }
table.work-package-data-table td { text-align: left; padding: 3px 6px; }
tr.project td.name a { white-space: nowrap; }

@ -30,6 +30,7 @@ See doc/COPYRIGHT.rdoc for more details.
jQuery('#relations #errorExplanation').remove();
<% if relation.errors.empty? %>
jQuery('#work-package-relations-table').removeClass('hidden');
jQuery('#relations tbody').append("<%= escape_javascript(render :partial => 'work_packages/relation', :locals => { :relation => relation, :work_package => work_package }) %>");
jQuery('#relation_to_id').val('');

@ -28,3 +28,7 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
jQuery('#work_package_relation_<%= @relation.id %>').remove();
var relationsTable = jQuery('#work-package-relations-table');
if (relationsTable.find('tbody tr').length === 0) relationsTable.addClass('hidden');

@ -34,24 +34,22 @@ See doc/COPYRIGHT.rdoc for more details.
<% end %>
</p>
<% if relations.any? %>
<table class="list work-package-data-table">
<thead>
<tr>
<th><%= Relation.human_attribute_name(:to)%></th>
<th><%= WorkPackage.human_attribute_name(:type)%></th>
<th><%= WorkPackage.human_attribute_name(:start_date)%></th>
<th><%= WorkPackage.human_attribute_name(:due_date)%></th>
<th><spen class="hidden-for-sighted"><%= t('button_delete') %></span></th>
</tr>
</thead>
<tbody>
<%= render :partial => 'relation', :collection => relations,
:as => :relation,
:locals => { :work_package => work_package } -%>
</tbody>
</table>
<% end %>
<table id="work-package-relations-table" class="list work-package-data-table <%= 'hidden' if relations.empty? %>">
<thead>
<tr>
<th><%= Relation.human_attribute_name(:to)%></th>
<th><%= WorkPackage.human_attribute_name(:type)%></th>
<th><%= WorkPackage.human_attribute_name(:start_date)%></th>
<th><%= WorkPackage.human_attribute_name(:due_date)%></th>
<th><spen class="hidden-for-sighted"><%= t('button_delete') %></span></th>
</tr>
</thead>
<tbody>
<%= render :partial => 'relation', :collection => relations,
:as => :relation,
:locals => { :work_package => work_package } -%>
</tbody>
</table>
<%= form_for(work_package.new_relation,
:as => :relation,

Loading…
Cancel
Save