-<% if @search_sharing.any? %>
- <% linktext = "Shared" %>
- <% btnstyle = "btn-success" %>
+<% 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 %>
- <% linktext = "Share" %>
- <% btnstyle = "btn-info" %>
+ <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 %>
-<%= link_to linktext, sharing_popup_collection_url(id: @object.uuid), {class: "btn-xs #{btnstyle}", :remote => true, 'data-toggle' => "modal", 'data-target' => '#collection-sharing-modal-window'} %>