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 <% object = @object unless object %>
14 <div class="selection-action-container" style="padding-left: <%=padding_left%>">
15 <% if Collection.creatable? and (!defined? no_checkboxes or !no_checkboxes) %>
17 <div class="pull-left">
18 <div class="btn-group btn-group-sm">
19 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Selection... <span class="caret"></span></button>
20 <ul class="dropdown-menu" role="menu">
21 <li><%= link_to "Create new collection with selected files", '#',
23 'data-href' => combine_selected_path(
24 action_data: {current_project_uuid: object.owner_uuid}.to_json
26 'data-selection-param-name' => 'selection[]',
27 'data-selection-action' => 'combine-collections',
28 'data-toggle' => 'dropdown'
32 <div class="btn-group btn-group-sm">
33 <button id="select-all" type="button" class="btn btn-default" onClick="select_all_items()">Select all</button>
34 <button id="unselect-all" type="button" class="btn btn-default" onClick="unselect_all_items()">Unselect all</button>
37 <div class="pull-right">
38 <input class="form-control filterable-control" data-filterable-target="ul#collection_files" id="file_regex" name="file_regex" placeholder="filename regex" type="text"/>
44 <% file_tree = object.andand.files_tree %>
45 <% if file_tree.nil? or file_tree.empty? %>
46 <p>This collection is empty.</p>
48 <ul id="collection_files" class="collection_files arv-selectable-items <%=preview_selectable_container%>">
49 <% dirstack = [file_tree.first.first] %>
50 <% file_tree.take(10000).each_with_index do |(dirname, filename, size), index| %>
51 <% file_path = CollectionsHelper::file_path([dirname, filename]) %>
52 <% while dirstack.any? and (dirstack.last != dirname) %>
53 <% dirstack.pop %></ul></li>
56 <% if size.nil? # This is a subdirectory. %>
57 <% dirstack.push(File.join(dirname, filename)) %>
58 <div class="collection_files_row">
59 <div class="collection_files_name"><i class="fa fa-fw fa-folder-open"></i> <%= filename %></div>
61 <ul class="collection_files">
63 <% link_params = {controller: 'collections', action: 'show_file',
64 uuid: object.portable_data_hash, file: file_path, size: size} %>
65 <div class="collection_files_row filterable <%=preview_selectable%>" href="<%=object.uuid%>/<%=file_path%>">
66 <div class="collection_files_buttons pull-right">
67 <%= raw(human_readable_bytes_html(size)) %>
68 <%= link_to(raw('<i class="fa fa-search"></i>'),
69 link_params.merge(disposition: 'inline'),
70 {title: "View #{file_path}", class: "btn btn-info btn-sm", disabled: !preview_allowed_for(file_path)}) %>
71 <%= link_to(raw('<i class="fa fa-download"></i>'),
72 link_params.merge(disposition: 'attachment'),
73 {title: "Download #{file_path}", class: "btn btn-info btn-sm"}) %>
76 <div class="collection_files_name">
77 <% if (!defined? no_checkboxes or !no_checkboxes) and current_user %>
78 <%= check_box_tag 'uuids[]', "#{object.uuid}/#{file_path}", false, {
79 :class => "persistent-selection",
80 :friendly_type => "File",
81 :friendly_name => "#{object.uuid}/#{file_path}",
82 :href => url_for(controller: 'collections', action: 'show_file',
83 uuid: object.portable_data_hash, file: file_path),
84 :title => "Include #{file_path} in your selections",
85 :id => "#{object.uuid}_file_#{index}",
89 <% if CollectionsHelper::is_image(filename) %>
90 <i class="fa fa-fw fa-bar-chart-o"></i> <%= filename %></div>
91 <div class="collection_files_inline">
92 <%= link_to(image_tag("#{url_for object}/#{file_path}"),
93 link_params.merge(disposition: 'inline'),
94 {title: file_path}) %>
98 <i class="fa fa-fw fa-file" href="<%=object.uuid%>/<%=file_path%>" ></i> <%= filename %></div>
102 <% end # if file or directory %>
103 <% end # file_tree.each %>
104 <%= raw(dirstack.map { |_| "</ul>" }.join("</li>")) %>
105 <% end # if file_tree %>
108 <% content_for :footer_html do %>
109 <div id="collection-sharing-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>