1 <div class="selection-action-container" style="padding-left: 1em">
2 <% if !defined? no_checkboxes or !no_checkboxes %>
4 <div class="pull-left">
5 <div class="btn-group btn-group-sm">
6 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Selection... <span class="caret"></span></button>
7 <ul class="dropdown-menu" role="menu">
8 <li><%= link_to "Create new collection with selected files", '#',
9 'data-href' => combine_selected_path(
10 action_data: {current_project_uuid: @object.owner_uuid}.to_json
12 'data-selection-param-name' => 'selection[]',
13 'data-selection-action' => 'combine-collections',
15 'data-toggle' => 'dropdown'
20 <div class="pull-right">
21 <%= form_tag collection_path(@object.uuid), {method: 'get'} do %>
22 <input class="form-control" id="file_regex" name="file_regex" value="<%= params[:file_regex] %>" type="text"/>
23 <button id="file_regex_submit" type="submit" class="btn btn-primary" autofocus>Filter</button>
32 if params[:file_regex]
34 file_regex = Regexp.new(params[:file_regex])
36 # If the pattern is not a valid regex, quote it
37 # (i.e. use it as a simple substring search)
38 file_regex = Regexp.new(Regexp.quote(params[:file_regex]))
43 <% file_tree = @object.andand.files_tree %>
44 <% if file_tree.nil? or file_tree.empty? %>
45 <p>This collection is empty.</p>
47 <ul id="collection_files" class="collection_files">
48 <% dirstack = [file_tree.first.first] %>
49 <% file_tree.take(10000).each_with_index do |(dirname, filename, size), index| %>
50 <% file_path = CollectionsHelper::file_path([dirname, filename]) %>
51 <% while dirstack.any? and (dirstack.last != dirname) %>
52 <% dirstack.pop %></ul></li>
55 <% if size.nil? # This is a subdirectory. %>
56 <% dirstack.push(File.join(dirname, filename)) %>
57 <div class="collection_files_row">
58 <div class="collection_files_name"><i class="fa fa-fw fa-folder-open"></i> <%= filename %></div>
60 <ul class="collection_files">
62 <% if !file_regex.nil? and !file_regex.match(filename) %>
65 <% link_params = {controller: 'collections', action: 'show_file',
66 uuid: @object.portable_data_hash, file: file_path, size: size} %>
67 <div class="collection_files_row">
68 <div class="collection_files_buttons pull-right">
69 <%= raw(human_readable_bytes_html(size)) %>
70 <% disable_search = (Rails.configuration.filename_suffixes_with_view_icon.include? file_path.split('.')[-1]) ? false : true %>
71 <%= link_to(raw('<i class="fa fa-search"></i>'),
72 link_params.merge(disposition: 'inline'),
73 {title: "View #{file_path}", class: "btn btn-info btn-sm", disabled: disable_search}) %>
74 <%= link_to(raw('<i class="fa fa-download"></i>'),
75 link_params.merge(disposition: 'attachment'),
76 {title: "Download #{file_path}", class: "btn btn-info btn-sm"}) %>
79 <div class="collection_files_name">
80 <% if !defined? no_checkboxes or !no_checkboxes %>
81 <%= check_box_tag 'uuids[]', "#{@object.uuid}/#{file_path}", false, {
82 :class => 'persistent-selection',
83 :friendly_type => "File",
84 :friendly_name => "#{@object.uuid}/#{file_path}",
85 :href => url_for(controller: 'collections', action: 'show_file',
86 uuid: @object.portable_data_hash, file: file_path),
87 :title => "Include #{file_path} in your selections",
91 <% if CollectionsHelper::is_image(filename) %>
92 <i class="fa fa-fw fa-bar-chart-o"></i> <%= filename %></div>
94 <div class="collection_files_inline">
95 <%= link_to(image_tag("#{url_for @object}/#{file_path}"),
96 link_params.merge(disposition: 'inline'),
97 {title: file_path}) %>
100 <i class="fa fa-fw fa-file"></i> <%= filename %></div>
104 <% end # if file or directory %>
105 <% end # file_tree.each %>
106 <%= raw(dirstack.map { |_| "</ul>" }.join("</li>")) %>
107 <% end # if file_tree %>
109 <% content_for :footer_html do %>
110 <div id="collection-sharing-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>