11185: Now we only have one "Re-run" button that will give the user the option to...
authorLucas Di Pentima <lucas@curoverse.com>
Thu, 27 Apr 2017 13:55:26 +0000 (10:55 -0300)
committerLucas Di Pentima <lucas@curoverse.com>
Thu, 27 Apr 2017 13:55:26 +0000 (10:55 -0300)
Updated test.

apps/workbench/app/views/container_requests/_extra_tab_line_buttons.html.erb
apps/workbench/test/controllers/container_requests_controller_test.rb

index 46f4bc919d50f00f93876668ac0d5ede2c526ed8..6d5ba6422ec14553dcbf9cf767af1b7140603d62 100644 (file)
@@ -1,16 +1,37 @@
 <% if @object.state == 'Final' %>
-  <%= link_to(copy_container_request_path('id' => @object.uuid, 'no_reuse' => true),
-      class: 'btn btn-sm btn-primary',
-      data: {toggle: :tooltip, placement: :top}, title: 'This will make a copy and take you there. You can then make any needed changes and run it without container reuse',
-      method: :post,
-      ) do %>
-    <i class="fa fa-fw fa-play"></i> Re-run without reuse
-  <% end %>
-  <%= link_to(copy_container_request_path('id' => @object.uuid),
-      class: 'btn btn-sm btn-primary',
-      data: {toggle: :tooltip, placement: :top}, title: 'This will make a copy and take you there. You can then make any needed changes and run it',
-      method: :post,
-      ) do %>
-    <i class="fa fa-fw fa-play"></i> Re-run
-  <% end %>
+  <%= link_to raw('<i class="fa fa-fw fa-play"></i> Re-run'),
+      "#",
+      {class: 'btn btn-sm btn-primary', 'data-toggle' => 'modal',
+       'data-target' => '#clone-and-edit-modal-window',
+       title: 'This will make a copy and take you there. You can then make any needed changes and run it'}  %>
 <% end %>
+
+<div id="clone-and-edit-modal-window" class="modal fade" role="dialog"
+     aria-labelledby="myModalLabel" aria-hidden="true">
+  <div class="modal-dialog">
+    <div class="modal-content">
+
+    <%= form_tag copy_container_request_path do |f| %>
+
+      <div class="modal-header">
+        <button type="button" class="close" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">&times;</button>
+        <div>
+          <div class="col-sm-6"> <h4 class="modal-title">Re-run container request</h4> </div>
+        </div>
+        <br/>
+      </div>
+
+      <div class="modal-body">
+              <%= check_box_tag(:no_reuse, "true", false) %>
+              <%= label_tag(:script_use_latest, "Disable container reuse") %>
+      </div>
+
+      <div class="modal-footer">
+        <button class="btn btn-default" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">Cancel</button>
+        <button type="submit" class="btn btn-primary" name="container_request[state]" value="Uncommitted">Copy and edit inputs</button>
+      </div>
+
+    </div>
+    <% end %>
+  </div>
+</div>
index af7abcd3b2bb345893eaefdd2e173c227f44b4e8..9b4009eeda63044a149cf084bf53cc21ad5612c7 100644 (file)
@@ -30,7 +30,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
     assert_select 'Download the log', false
   end
 
-  test "completed container request offers re-run options" do
+  test "completed container request offers re-run option" do
     use_token 'active'
 
     uuid = api_fixture('container_requests')['completed']['uuid']
@@ -38,8 +38,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
     get :show, {id: uuid}, session_for(:active)
     assert_response :success
 
-   assert_includes @response.body, "href=\"/container_requests/#{uuid}/copy\""
-   assert_includes @response.body, "href=\"/container_requests/#{uuid}/copy?no_reuse=true\""
+   assert_includes @response.body, "action=\"/container_requests/#{uuid}/copy\""
   end
 
   test "container request copy" do