a modal popup. Produces download link that is confirmed works.
end
end
+ helper_method :download_link
+
+ def download_link
+ collections_url + "/download/#{@object.uuid}/#{@search_sharing.first.api_token}"
+ end
+
def share
a = ApiClientAuthorization.create(scopes: sharing_scopes)
@search_sharing = search_scopes.select { |s| s.scopes != ['all'] }
<% if @search_sharing.any? %>
- <% linktext = "Shared" %>
- <% btnstyle = "btn-success" %>
+ <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 %>
- <% linktext = "Share" %>
- <% btnstyle = "btn-info" %>
+ <%= link_to "Create sharing link", share_collection_url, {
+ class: 'btn-xs btn-info',
+ remote: true,
+ method: 'post'
+ } %>
<% end %>
-<%= link_to linktext, sharing_popup_collection_url(id: @object.uuid), {class: "btn #{btnstyle}", :remote => true, 'data-toggle' => "modal", 'data-target' => '#collection-sharing-modal-window'} %>
+++ /dev/null
-
-<div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">×</button>
- <h4 class="modal-title">Sharing</h4>
- </div>
- <div class="modal-body">
- <div id="sharing-text" style="text-align: center; word-wrap: break-word">
- <% if @search_sharing.any? %>
- Use this link to share this collection:<br>
- <big>
- <% link = collections_url + "/download/#{@object.uuid}/#{@search_sharing.first.api_token}" %>
- <%= link_to link, link %>
- </big>
- <% else %>
- Not shared.
- <% end %>
- </div>
- <div style="text-align: center; padding-top: 1em">
- <% if @search_sharing and @search_sharing.any? %>
- <%= link_to "Unshare", unshare_collection_url, {
- class: 'btn btn-success',
- remote: true,
- method: 'post'
- } %>
- <% else %>
- <%= link_to "Share", share_collection_url, {
- class: 'btn btn-info',
- remote: true,
- method: 'post'
- } %>
- <% end %>
- </div>
- </div>
- </div>
-</div>
-$("#collection-sharing-modal-window").html("<%= escape_javascript(render partial: 'sharing_popup') %>");
$("#sharing-button").html("<%= escape_javascript(render partial: 'sharing_button') %>");
<input type="text" class="form-control" placeholder="Search"/>
-->
- <div id="sharing-button" style="text-align: center">
+ <div id="sharing-button">
<%= render partial: 'sharing_button' %>
</div>