2 preview_selectable_container = ''
3 preview_selectable = ''
5 if !params['use_preview_selection'].nil? and params['use_preview_selection'] == 'true'
6 preview_selectable_container = 'preview-selectable-container selectable-container'
7 preview_selectable = 'preview-selectable selectable'
12 <div class="selection-action-container" style="padding-left: <%=padding_left%>">
13 <% if Collection.creatable? and (!defined? no_checkboxes or !no_checkboxes) %>
15 <div class="pull-left">
16 <div class="btn-group btn-group-sm">
17 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Selection... <span class="caret"></span></button>
18 <ul class="dropdown-menu" role="menu">
19 <li><%= link_to "Create new collection with selected files", '#',
21 'data-href' => combine_selected_path(
22 action_data: {current_project_uuid: @object.owner_uuid}.to_json
24 'data-selection-param-name' => 'selection[]',
25 'data-selection-action' => 'combine-collections',
26 'data-toggle' => 'dropdown'
30 <div class="btn-group btn-group-sm">
31 <button id="select-all" type="button" class="btn btn-default" onClick="select_all_items()">Select all</button>
32 <button id="unselect-all" type="button" class="btn btn-default" onClick="unselect_all_items()">Unselect all</button>
35 <div class="pull-right">
36 <input class="form-control filterable-control" data-filterable-target="ul#collection_files" id="file_regex" name="file_regex" placeholder="filename regex" type="text"/>
42 <% file_tree = @object.andand.files_tree %>
43 <% if file_tree.nil? or file_tree.empty? %>
44 <p>This collection is empty.</p>
46 <ul id="collection_files" class="collection_files arv-selectable-items <%=preview_selectable_container%>">
47 <% dirstack = [file_tree.first.first] %>
48 <% file_tree.take(10000).each_with_index do |(dirname, filename, size), index| %>
49 <% file_path = CollectionsHelper::file_path([dirname, filename]) %>
50 <% while dirstack.any? and (dirstack.last != dirname) %>
51 <% dirstack.pop %></ul></li>
54 <% if size.nil? # This is a subdirectory. %>
55 <% dirstack.push(File.join(dirname, filename)) %>
56 <div class="collection_files_row">
57 <div class="collection_files_name"><i class="fa fa-fw fa-folder-open"></i> <%= filename %></div>
59 <ul class="collection_files">
61 <% link_params = {controller: 'collections', action: 'show_file',
62 uuid: @object.portable_data_hash, file: file_path, size: size} %>
63 <div class="collection_files_row filterable <%=preview_selectable%>" href="<%=@object.uuid%>/<%=file_path%>">
64 <div class="collection_files_buttons pull-right">
65 <%= raw(human_readable_bytes_html(size)) %>
66 <%= link_to(raw('<i class="fa fa-search"></i>'),
67 link_params.merge(disposition: 'inline'),
68 {title: "View #{file_path}", class: "btn btn-info btn-sm", disabled: !preview_allowed_for(file_path)}) %>
69 <%= link_to(raw('<i class="fa fa-download"></i>'),
70 link_params.merge(disposition: 'attachment'),
71 {title: "Download #{file_path}", class: "btn btn-info btn-sm"}) %>
74 <div class="collection_files_name">
75 <% if (!defined? no_checkboxes or !no_checkboxes) and current_user %>
76 <%= check_box_tag 'uuids[]', "#{@object.uuid}/#{file_path}", false, {
77 :class => "persistent-selection",
78 :friendly_type => "File",
79 :friendly_name => "#{@object.uuid}/#{file_path}",
80 :href => url_for(controller: 'collections', action: 'show_file',
81 uuid: @object.portable_data_hash, file: file_path),
82 :title => "Include #{file_path} in your selections",
83 :id => "#{@object.uuid}_file_#{index}",
87 <% if CollectionsHelper::is_image(filename) %>
88 <i class="fa fa-fw fa-bar-chart-o"></i> <%= filename %></div>
89 <div class="collection_files_inline">
90 <%= link_to(image_tag("#{url_for @object}/#{file_path}"),
91 link_params.merge(disposition: 'inline'),
92 {title: file_path}) %>
96 <i class="fa fa-fw fa-file" href="<%=@object.uuid%>/<%=file_path%>" ></i> <%= filename %></div>
100 <% end # if file or directory %>
101 <% end # file_tree.each %>
102 <%= raw(dirstack.map { |_| "</ul>" }.join("</li>")) %>
103 <% end # if file_tree %>
106 <% content_for :footer_html do %>
107 <div id="collection-sharing-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>