2 function select_all_files() {
3 $("#collection_files :checkbox").filter(":visible").prop("checked", true).trigger("change");
6 function unselect_all_files() {
7 $("#collection_files :checkbox").filter(":visible").prop("checked", false).trigger("change");
12 preview_selectable_container = ''
13 preview_selectable = ''
15 if !params['use_preview_selection'].nil? and params['use_preview_selection'] == 'true'
16 preview_selectable_container = 'preview-selectable-container selectable-container'
17 preview_selectable = 'preview-selectable selectable'
22 <div class="selection-action-container" style="padding-left: <%=padding_left%>">
23 <% if !defined? no_checkboxes or !no_checkboxes %>
26 <div class="pull-left">
27 <div class="btn-group btn-group-sm">
28 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Selection... <span class="caret"></span></button>
29 <ul class="dropdown-menu" role="menu">
30 <li><%= link_to "Create new collection with selected files", '#',
32 'data-href' => combine_selected_path(
33 action_data: {current_project_uuid: @object.owner_uuid}.to_json
35 'data-selection-param-name' => 'selection[]',
36 'data-selection-action' => 'combine-collections',
37 'data-toggle' => 'dropdown'
41 <div class="btn-group btn-group-sm">
42 <button id="select-all" type="button" class="btn btn-default" onClick="select_all_files()">Select all</button>
43 <button id="unselect-all" type="button" class="btn btn-default" onClick="unselect_all_files()">Unselect all</button>
46 <div class="pull-right">
47 <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 <%=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 <% disable_search = (Rails.configuration.filename_suffixes_with_view_icon.include? file_path.split('.')[-1]) ? false : true %>
79 <%= link_to(raw('<i class="fa fa-search"></i>'),
80 link_params.merge(disposition: 'inline'),
81 {title: "View #{file_path}", class: "btn btn-info btn-sm", disabled: disable_search}) %>
82 <%= link_to(raw('<i class="fa fa-download"></i>'),
83 link_params.merge(disposition: 'attachment'),
84 {title: "Download #{file_path}", class: "btn btn-info btn-sm"}) %>
87 <div class="collection_files_name">
88 <% if !defined? no_checkboxes or !no_checkboxes %>
89 <%= check_box_tag 'uuids[]', "#{@object.uuid}/#{file_path}", false, {
90 :class => "persistent-selection",
91 :friendly_type => "File",
92 :friendly_name => "#{@object.uuid}/#{file_path}",
93 :href => url_for(controller: 'collections', action: 'show_file',
94 uuid: @object.portable_data_hash, file: file_path),
95 :title => "Include #{file_path} in your selections",
99 <% if CollectionsHelper::is_image(filename) %>
100 <i class="fa fa-fw fa-bar-chart-o"></i> <%= filename %></div>
101 <div class="collection_files_inline">
102 <%= link_to(image_tag("#{url_for @object}/#{file_path}"),
103 link_params.merge(disposition: 'inline'),
104 {title: file_path}) %>
108 <i class="fa fa-fw fa-file" href="<%=@object.uuid%>/<%=file_path%>" ></i> <%= filename %></div>
112 <% end # if file or directory %>
113 <% end # file_tree.each %>
114 <%= raw(dirstack.map { |_| "</ul>" }.join("</li>")) %>
115 <% end # if file_tree %>
117 <% content_for :footer_html do %>
118 <div id="collection-sharing-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>