.grid_13
- form_tag do
  = restful_submit_tag "Remove Selected", 'destroy', remove_assemblies_image_factory_deployable_path(@deployable), 'DELETE', :id => 'delete_button'
  = link_to "Add Assembly...", pick_assemblies_image_factory_deployable_path(@deployable), :class => 'button', :id => 'add_assembly'

  %table#assemblies_table
    %thead
      %tr
        %th
        %th= "Name"
        %th= "Created"
    -@deployable.assemblies(:include => :templates).each do |assembly|
      %tr
        %td
          %input{:name => "assemblies_selected[]", :type => "checkbox", :value => assembly.id, :id => "assembly_checkbox_#{assembly.id}" }
        %td= assembly.name
        %td= assembly.created_at

:javascript
  $(document).ready(function () {
    $('#add_assembly').click(function(e) {
      e.preventDefault();
      var url = $(this).attr('href');
      $.get(url, function(data) {
        $('#ui-tabs-2').html(data);
      });
    });
  });
.grid_13
- form_tag do
  = restful_submit_tag "Remove Selected", 'destroy', remove_assemblies_image_factory_deployable_path(@deployable), 'DELETE', :id => 'delete_button'
  = link_to "Add Assembly...", pick_assemblies_image_factory_deployable_path(@deployable), :class => 'button', :id => 'add_assembly'

  %table#assemblies_table
    %thead
      %tr
        %th
        %th= "Name"
        %th= "Created"
    -@deployable.assemblies(:include => :templates).each do |assembly|
      %tr
        %td
          %input{:name => "assemblies_selected[]", :type => "checkbox", :value => assembly.id, :id => "assembly_checkbox_#{assembly.id}" }
        %td= assembly.name
        %td= assembly.created_at

:javascript
  $(document).ready(function () {
    $('#add_assembly').click(function(e) {
      e.preventDefault();
      var url = $(this).attr('href');
      $.get(url, function(data) {
        var selectedTabIndex = $("#details-view").tabs('option', 'selected');
        var $selectedTab = $("#details-view div.ui-tabs-panel").eq(selectedTabIndex);
        $selectedTab.html(data);
      });
    });
  });

Fix ajax behaviour of deployables > assemblies tab
Fix ajax behaviour of deployables > assemblies tab

Redmine #1269

In the Image Factory -> Deployables -> Assemblies tab, the "Add Assembly"
button didn't work on occasions because the JS code referenced the currently
selected tab incorrectly.
