Fix 2.4.2 upgrade notes formatting refs #19330
[arvados.git] / apps / workbench / app / views / collections / _sharing_button.html.erb
index fc81e705e4b4096d4f18d34e96cd07e5a3f2a4ca..3d8ea3fff199846ab0cda07b8ba19dac5dbaf3cc 100644 (file)
@@ -1,21 +1,21 @@
-<%# a nil @search_sharing means we got an AccessForbiddenException and should
-disable this feature entirely. %>
-<% if @search_sharing != nil %>
-  <% 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>
-  <% else %>
-    <%= link_to "Create sharing link", share_collection_url, {
-          class: 'btn-xs btn-info',
-          remote: true,
-          method: 'post'
-        } %>
-  <% end %>
+<%# Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: AGPL-3.0 %>
+
+<% 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 %>
+  <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 %>