+ <%= form_tag collection_path(@object.uuid), {method: 'get'} do %>
+
+
+
+
+
+
+ <% end %>
+
<% end %>
+<% file_regex = nil %>
+<% if params[:file_regex] %>
+ <% begin %>
+ <% file_regex = Regexp.new(params[:file_regex]) %>
+ <% rescue RegexpError %>
+ <% # If the pattern is not a valid regex, quote it %>
+ <% # (i.e. use it as a simple substring search) %>
+
+
The search term <%= params[:file_regex] %> could not be parsed as a regular expression.
+
Searching for files named <%= params[:file_regex] %> instead.
+
+ <% file_regex = Regexp.new(Regexp.quote(params[:file_regex])) %>
+ <% end %>
+<% end %>
+
<% file_tree = @object.andand.files_tree %>
<% if file_tree.nil? or file_tree.empty? %>
This collection is empty.
<% else %>
<% dirstack = [file_tree.first.first] %>
- <% file_tree.take(10000).each_with_index do |(dirname, filename, size), index| %>
+ <% file_tree.reject { |(dirname, filename, size)|
+ # Eliminate any files that don't match file_regex
+ # (or accept all files if no file_regex was given)
+ size and file_regex and !file_regex.match(filename)
+ }
+ .take(10000)
+ .each_with_index do |(dirname, filename, size), index| %>
<% file_path = CollectionsHelper::file_path([dirname, filename]) %>
<% while dirstack.any? and (dirstack.last != dirname) %>
<% dirstack.pop %>