4291: Clean up HTTP methods in Workbench URL generators.
authorBrett Smith <brett@curoverse.com>
Tue, 25 Nov 2014 22:57:47 +0000 (17:57 -0500)
committerBrett Smith <brett@curoverse.com>
Wed, 3 Dec 2014 16:23:38 +0000 (11:23 -0500)
According to the docs at
<http://api.rubyonrails.org/files/actionview/lib/action_view/helpers/url_helper_rb.html>:

* `button_to` and `form_for` take :method as a symbol.
* `link_to` takes :method as a symbol, and only supports :delete,
  :post, :patch, and :put.  Any link that should be done with GET
  should not have a method specified.
* Note that `form_tag` *does* take a string, so not every method
  should be symbolized.

14 files changed:
apps/workbench/app/views/collections/_sharing_button.html.erb
apps/workbench/app/views/collections/_show_files.html.erb
apps/workbench/app/views/collections/_show_recent.html.erb
apps/workbench/app/views/layouts/body.html.erb
apps/workbench/app/views/pipeline_templates/_show_recent.html.erb
apps/workbench/app/views/pipeline_templates/show.html.erb
apps/workbench/app/views/projects/_show_dashboard.html.erb
apps/workbench/app/views/projects/_show_sharing.html.erb
apps/workbench/app/views/projects/_show_tab_contents.html.erb
apps/workbench/app/views/projects/show.html.erb
apps/workbench/app/views/user_agreements/index.html.erb
apps/workbench/app/views/users/_add_ssh_key_popup.html.erb
apps/workbench/app/views/users/_manage_ssh_keys.html.erb
apps/workbench/app/views/users/_tables.html.erb

index fc81e705e4b4096d4f18d34e96cd07e5a3f2a4ca..ae915523b3ebd6ee49a9778e3fd0021b7f99cbad 100644 (file)
@@ -7,7 +7,7 @@ disable this feature entirely. %>
         <%= link_to "Unshare", unshare_collection_url, {
               class: 'btn-xs btn-info',
               remote: true,
-              method: 'post'
+              method: :post,
             } %></span>
       <div class="smaller-text" style="word-break: break-all"><%= link_to download_link, download_link %></div>
     </div>
@@ -15,7 +15,7 @@ disable this feature entirely. %>
     <%= link_to "Create sharing link", share_collection_url, {
           class: 'btn-xs btn-info',
           remote: true,
-          method: 'post'
+          method: :post,
         } %>
   <% end %>
 <% end %>
index 39a1b36c3180c5415cd6782ee8a9d081daa864d6..b7c05b2be3abe5fd6dbd3ebd630976717cfcc98a 100644 (file)
@@ -38,12 +38,12 @@ function unselect_all_files() {
         <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Selection... <span class="caret"></span></button>
         <ul class="dropdown-menu" role="menu">
           <li><%= link_to "Create new collection with selected files", '#',
+                  method: :post,
                   'data-href' => combine_selected_path(
                     action_data: {current_project_uuid: @object.owner_uuid}.to_json
                   ),
                   'data-selection-param-name' => 'selection[]',
                   'data-selection-action' => 'combine-collections',
-                  'method' => 'post',
                   'data-toggle' => 'dropdown'
             %></li>
         </ul>
index 6ebb3b2a28e67632b134959e612be7fa8c319637..39651cc419fcd6eb026ef11d299d122ecbf5625d 100644 (file)
@@ -5,10 +5,10 @@
         <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Selection... <span class="caret"></span></button>
         <ul class="dropdown-menu" role="menu">
           <li><%= link_to "Create new collection with selected collections", '#',
+                  method: :post,
                   'data-href' => combine_selected_path,
                   'data-selection-param-name' => 'selection[]',
                   'data-selection-action' => 'combine-collections',
-                  'method' => 'post',
                   'data-toggle' => 'dropdown'
             %></li>
         </ul>
index 9e966e148a9de3e54254259a7d1e911a35aaaaf7..035d147f0458411517130da0d6899dfaa56926a1 100644 (file)
                       &block)
                   end,
                   :top_button => Proc.new do %>
-                    <% link_to projects_path, method: 'post', class: 'btn btn-xs btn-default pull-right' do %>
+                    <% link_to projects_path, method: :post, class: 'btn btn-xs btn-default pull-right' do %>
                       <i class="fa fa-plus"></i> New project
                     <% end %>
                   <% end %>
index 252b93ad45664ac041c7016ab6b82c09bcbf4ba2..a1749a7de91303d3e4d2db5f905dd942aef4b0e3 100644 (file)
@@ -38,7 +38,7 @@
                                                    'pipeline_instance[description]' => "Created at #{Time.now.localtime}" + (ob.name.andand.size.andand>0 ? " using the pipeline template *#{ob.name}*" : ""),
                                                    'success' => 'redirect-to-created-object'
                                                   }.to_json),
-                { class: "btn btn-default btn-xs", title: "Run #{ob.name}", remote: true, method: 'get' }
+                { class: "btn btn-default btn-xs", title: "Run #{ob.name}", remote: true, method: :get }
             ) do %>
                <i class="fa fa-fw fa-play"></i> Run
               <% end %>
index 02ebd6d9cd09d5aecdd59338714932e8d8f16067..0faa48fed3091ce825e993989b25d62e2a63e619 100644 (file)
@@ -10,7 +10,7 @@
                                                    'pipeline_instance[description]' => "Created at #{Time.now.localtime}" + (@object.name.andand.size.andand>0 ? " using the pipeline template *#{@object.name}*" : ""),
                                                    'success' => 'redirect-to-created-object'
                                                   }.to_json),
-                { class: "btn btn-primary btn-sm", remote: true, method: 'get', title: 'Run this pipeline' }
+                { class: "btn btn-primary btn-sm", remote: true, title: 'Run this pipeline' }
                ) do %>
                    <i class="fa fa-gear"></i> Run this pipeline
                  <% end %>
index 0d71f947c758aca3829326ef4230f280a529fbd3..40f319f6da3ab364d730cf2a6cfffcb00b04f26a 100644 (file)
@@ -11,7 +11,7 @@
            action_href: pipeline_instances_path,
            action_method: 'post',
            action_data: {'selection_param' => 'pipeline_instance[pipeline_template_uuid]', 'pipeline_instance[owner_uuid]' => current_user.uuid, 'success' => 'redirect-to-created-object'}.to_json),
-         { class: "btn btn-primary btn-xs", remote: true, method: 'get' }) do %>
+         { class: "btn btn-primary btn-xs", remote: true }) do %>
       <i class="fa fa-fw fa-gear"></i> Run a pipeline...
     <% end %>
     </span>
index cc862c425c168e5ab61e4a12827bed2df517adbc..480f401f7ad2750bb35e0499ca68502932a79839 100644 (file)
@@ -45,7 +45,7 @@
       action_href: share_with_project_path,
       action_name: 'Add',
       action_data: {selection_param: 'uuids[]', success: 'tab-refresh'}.to_json),
-      class: "btn btn-primary btn-sm", remote: true, method: 'get') do %>
+      class: "btn btn-primary btn-sm", remote: true) do %>
   <i class="fa fa-fw fa-plus"></i> Share with <%= share_class %>&hellip;
   <% end %>
 
index d9ec4bc977024749102e0577f03edc362fa6b445..66c469ef4ca1e6e93a2bf10c1eb54525444b5079 100644 (file)
@@ -10,9 +10,9 @@
                     action_data: {current_project_uuid: @object.uuid}.to_json
                   ),
                   'id' => 'combine_selections_button',
+                  method: :post,
                   'data-selection-param-name' => 'selection[]',
                   'data-selection-action' => 'combine-project-contents',
-                  'method' => 'post',
                   'data-toggle' => 'dropdown'
             %></li>
           <li><%= link_to "Compare selected", 'action',
             %></li>
           <% if @object.editable? %>
           <li><%= link_to "Remove selected", '#',
+                  method: :delete,
                   'data-href' => url_for(action: :remove_items),
                   'data-selection-param-name' => 'item_uuids[]',
                   'data-selection-action' => 'remove',
                   'data-remote' => true,
-                  'method' => 'delete',
                   'data-toggle' => 'dropdown'
             %></li>
           <% end %>
index 0429f33b4102920ab424f13a887321af9dd4f7f7..7a9eda00f46653f889a1a3fb1f7e87166e367b4f 100644 (file)
@@ -14,7 +14,7 @@
            action_href: actions_path(id: @object.uuid),
            action_method: 'post',
            action_data: {selection_param: 'selection[]', copy_selections_into_project: @object.uuid, success: 'page-refresh'}.to_json),
-         { class: "btn btn-primary btn-sm", remote: true, method: 'get', title: "Add data to this project", data: {'event-after-select' => 'page-refresh'} }) do %>
+         { class: "btn btn-primary btn-sm", remote: true, title: "Add data to this project", data: {'event-after-select' => 'page-refresh'} }) do %>
       <i class="fa fa-fw fa-plus"></i> Add data...
     <% end %>
     <%= link_to(
            action_href: pipeline_instances_path,
            action_method: 'post',
            action_data: {'selection_param' => 'pipeline_instance[pipeline_template_uuid]', 'pipeline_instance[owner_uuid]' => @object.uuid, 'success' => 'redirect-to-created-object'}.to_json),
-         { class: "btn btn-primary btn-sm", remote: true, method: 'get', title: "Run a pipeline in this project" }) do %>
+         { class: "btn btn-primary btn-sm", remote: true, title: "Run a pipeline in this project" }) do %>
       <i class="fa fa-fw fa-gear"></i> Run a pipeline...
     <% end %>
-    <%= link_to projects_path({'project[owner_uuid]' => @object.uuid, 'options' => {'ensure_unique_name' => true}}), method: 'post', title: "Add a subproject to this project", class: 'btn btn-sm btn-primary' do %>
+    <%= link_to projects_path({'project[owner_uuid]' => @object.uuid, 'options' => {'ensure_unique_name' => true}}), method: :post, title: "Add a subproject to this project", class: 'btn btn-sm btn-primary' do %>
       <i class="fa fa-fw fa-plus"></i>
       Add a subproject
     <% end %>
index d73ccffef8ddde3d6961975f3b64bf9cc4e8901f..4c80cafd8dfb22447dfda4aab20e9287c58d341b 100644 (file)
@@ -9,7 +9,7 @@ User agreements
 <% end %>
 <% end %>
 
-<%= form_for(unsigned_user_agreements.first, {url: {action: 'sign', controller: 'user_agreements'}, method: 'post'}) do |f| %>
+<%= form_for(unsigned_user_agreements.first, {url: {action: 'sign', controller: 'user_agreements'}, method: :post}) do |f| %>
 <%= hidden_field_tag :return_to, request.url %>
 <div id="open_user_agreement">
   <div class="alert alert-info">
index efa8cae5c98f7356b92216fb0c71d1d5d0b16811..3bfaf6982ecccb777b22d50a230f9102060d41c0 100644 (file)
@@ -14,7 +14,7 @@
 
       <div class="modal-body">
         <div> <%= link_to "Click here to learn about SSH keys in Arvados.",
-                 "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html", 
+                 "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html",
                  style: "font-weight: bold",
                  target: "_blank" %>
         </div>
index 17b64b27f9f7c7d74141bc55ea52de7ba3b080ff..34dbb591aefc859d78445b02d97d2669cd269bab 100644 (file)
@@ -2,7 +2,7 @@
   <% if !@my_ssh_keys.any? %>
      <p> You have not yet set up an SSH public key for use with Arvados. </p>
      <p>  <%= link_to "Click here",
-                 "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html", 
+                 "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html",
                  style: "font-weight: bold",
                  target: "_blank" %>  to learn about SSH keys in Arvados.
      </p>
@@ -43,7 +43,7 @@
               <% end %>
             </td>
             <td>
-              <%= link_to(authorized_key_path(id: key[:uuid]), method: 'delete', class: 'btn btn-sm', data: {confirm: "Really delete key?"}) do %>
+              <%= link_to(authorized_key_path(id: key[:uuid]), method: :delete, class: 'btn btn-sm', data: {confirm: "Really delete key?"}) do %>
                   <i class="fa fa-fw fa-trash-o"></i>
               <% end %>
             </td>
index 45ca939281431a2aaee8301a80d489d77771e2a0..b0f57530de9d054756b2f238edffe9b68fd356d3 100644 (file)
@@ -1,7 +1,7 @@
 <% if current_user.andand.is_active %>
   <div>
     <strong>Recent jobs</strong>
-    <%= link_to '(refresh)', {format: :js}, {class: 'refresh', remote: true, method: 'get'} %>
+    <%= link_to '(refresh)', {format: :js}, {class: 'refresh', remote: true} %>
     <%= link_to raw("Show all jobs &rarr;"), jobs_path, class: 'pull-right' %>
     <% if not current_user.andand.is_active or @my_jobs.empty? %>
       <p>(None)</p>
 
 <div>
   <strong>Recent pipeline instances</strong>
-  <%= link_to '(refresh)', {format: :js}, {class: 'refresh', remote: true, method: 'get'} %>
+  <%= link_to '(refresh)', {format: :js}, {class: 'refresh', remote: true} %>
   <%= link_to raw("Show all pipeline instances &rarr;"), pipeline_instances_path, class: 'pull-right' %>
   <% if not current_user.andand.is_active or @my_pipelines.empty? %>
     <p>(None)</p>
 
 <div>
   <strong>Recent collections</strong>
-  <%= link_to '(refresh)', {format: :js}, {class: 'refresh', remote: true, method: 'get'} %>
+  <%= link_to '(refresh)', {format: :js}, {class: 'refresh', remote: true} %>
   <%= link_to raw("Show all collections &rarr;"), collections_path, class: 'pull-right' %>
   <div class="pull-right" style="padding-right: 1em; width: 30%;">
     <%= form_tag collections_path,