4467: Move select_all_items and unselect_all_items methods into selection.js
[arvados.git] / apps / workbench / app / views / collections / _sharing_button.html.erb
index b2ed43ab31a4546be19841c052921880828a210d..4050e3aee4d124c7f976ba9148ea7415b32637dd 100644 (file)
@@ -1,17 +1,17 @@
-<% if @search_sharing.any? %>
-  <div>Shared at:
-    <span class="pull-right">
-  <%= link_to "Unshare", unshare_collection_url, {
-        class: 'btn-xs btn-info',
-        remote: true,
-        method: 'post'
-      } %></span>
-  <div class="smaller-text" style="word-break: break-all"><%= link_to download_link, download_link %></div>
-</div>
+<% button_attrs = {
+     class: 'btn btn-xs btn-info',
+     remote: true,
+     method: :post,
+   } %>
+<% if @search_sharing.nil? %>
+  <p>Your API token is not authorized to manage collection sharing links.</p>
+<% elsif @search_sharing.empty? %>
+  <%= button_to("Create sharing link", {action: "share"}, button_attrs) %>
 <% else %>
-  <%= link_to "Create sharing link", share_collection_url, {
-        class: 'btn-xs btn-info',
-        remote: true,
-        method: 'post'
-      } %>
+  <div>
+    <% button_attrs[:class] += " pull-right" %>
+    <%= button_to("Unshare", {action: "unshare"}, button_attrs) %>
+    Shared at:
+    <div class="smaller-text" style="clear: both; word-break: break-all"><%= link_to download_link, download_link %></div>
+  </div>
 <% end %>