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'
30 <% if object.editable? %>
31 <li><%= link_to "Remove selected files", '#',
33 'data-href' => url_for(controller: 'collections', action: :remove_selected_files),
34 'data-selection-param-name' => 'selection[]',
35 'data-selection-action' => 'remove-selected-files',
36 'data-toggle' => 'dropdown',
37 'class' => 'btn-remove-selected-files'
42 <div class="btn-group btn-group-sm">
43 <button id="select-all" type="button" class="btn btn-default" onClick="select_all_items()">Select all</button>
44 <button id="unselect-all" type="button" class="btn btn-default" onClick="unselect_all_items()">Unselect all</button>
47 <div class="pull-right">
48 <input class="form-control filterable-control" data-filterable-target="ul#collection_files" id="file_regex" name="file_regex" placeholder="filename regex" type="text"/>
54 <% file_tree = object.andand.files_tree %>
55 <% if file_tree.nil? or file_tree.empty? %>
56 <p>This collection is empty.</p>
58 <ul id="collection_files" class="collection_files arv-selectable-items <%=preview_selectable_container%>">
59 <% dirstack = [file_tree.first.first] %>
60 <% file_tree.take(10000).each_with_index do |(dirname, filename, size), index| %>
61 <% file_path = CollectionsHelper::file_path([dirname, filename]) %>
62 <% while dirstack.any? and (dirstack.last != dirname) %>
63 <% dirstack.pop %></ul></li>
66 <% if size.nil? # This is a subdirectory. %>
67 <% dirstack.push(File.join(dirname, filename)) %>
68 <div class="collection_files_row">
69 <div class="collection_files_name"><i class="fa fa-fw fa-folder-open"></i> <%= filename %></div>
71 <ul class="collection_files">
73 <% link_params = {controller: 'collections', action: 'show_file',
74 uuid: object.portable_data_hash, file: file_path, size: size} %>
75 <div class="collection_files_row filterable <%=preview_selectable%>" href="<%=object.uuid%>/<%=file_path%>">
76 <div class="collection_files_buttons pull-right">
77 <%= raw(human_readable_bytes_html(size)) %>
78 <%= link_to(raw('<i class="fa fa-search"></i>'),
79 link_params.merge(disposition: 'inline'),
80 {title: "View #{file_path}", class: "btn btn-info btn-sm", disabled: !preview_allowed_for(file_path)}) %>
81 <%= link_to(raw('<i class="fa fa-download"></i>'),
82 link_params.merge(disposition: 'attachment'),
83 {title: "Download #{file_path}", class: "btn btn-info btn-sm"}) %>
86 <div class="collection_files_name">
87 <% if (!defined? no_checkboxes or !no_checkboxes) and current_user %>
88 <%= check_box_tag 'uuids[]', "#{object.uuid}/#{file_path}", false, {
89 :class => "persistent-selection",
90 :friendly_type => "File",
91 :friendly_name => "#{object.uuid}/#{file_path}",
92 :href => url_for(controller: 'collections', action: 'show_file',
93 uuid: object.portable_data_hash, file: file_path),
94 :title => "Include #{file_path} in your selections",
95 :id => "#{object.uuid}_file_#{index}",
100 <% if object.editable? %>
101 <span class="btn-collection-remove-file-span">
102 <%= link_to({controller: 'collections', action: 'remove_selected_files', id: object.uuid, selection: [object.portable_data_hash+'/'+file_path]}, method: :post, remote: true, data: {confirm: "Remove #{file_path}?", toggle: 'tooltip', placement: 'top'}, class: 'btn btn-sm btn-default btn-nodecorate btn-collection-file-control', title: 'Remove this file') do %>
103 <i class="fa fa-fw fa-trash-o"></i>
107 <% if CollectionsHelper::is_image(filename) %>
108 <i class="fa fa-fw fa-bar-chart-o"></i>
109 <% if object.editable? %>
110 <span class="btn-collection-rename-file-span">
111 <%= render_editable_attribute object, 'filename', filename, {'data-value' => file_path, 'data-toggle' => 'manual', 'selection_name' => 'rename-file-path:'+file_path}, {tiptitle: 'Edit name or directory or both for this file', btnclass: 'collection-file-control'} %>
117 <div class="collection_files_inline">
118 <%= link_to(image_tag("#{url_for object}/#{file_path}"),
119 link_params.merge(disposition: 'inline'),
120 {title: file_path}) %>
124 <% if object.editable? %>
125 <i class="fa fa-fw fa-file"></i><span class="btn-collection-rename-file-span"><%= render_editable_attribute object, 'filename', filename, {'data-value' => file_path, 'data-toggle' => 'manual', 'selection_name' => 'rename-file-path:'+file_path}, {tiptitle: 'Edit name or directory or both for this file', btnclass: 'collection-file-control'} %>
128 <i class="fa fa-fw fa-file" href="<%=object.uuid%>/<%=file_path%>" ></i> <%= filename %>
134 <% end # if file or directory %>
135 <% end # file_tree.each %>
136 <%= raw(dirstack.map { |_| "</ul>" }.join("</li>")) %>
137 <% end # if file_tree %>
140 <% content_for :footer_html do %>
141 <div id="collection-sharing-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>