[ARVADOS] updated: e1d71c83e17ba6d06e2442ed775f7efd4ea32d84
git at public.curoverse.com
git at public.curoverse.com
Wed May 21 12:06:09 EDT 2014
Summary of changes:
.../app/assets/stylesheets/collections.css.scss | 46 +++++++++
.../app/controllers/collections_controller.rb | 7 +-
apps/workbench/app/helpers/application_helper.rb | 1 +
apps/workbench/app/models/collection.rb | 21 ++++
.../app/views/collections/_show_files.html.erb | 111 ++++++++++-----------
apps/workbench/test/unit/collection_test.rb | 27 +++++
.../test/unit/helpers/collections_helper_test.rb | 8 ++
services/api/test/fixtures/collections.yml | 21 ++++
8 files changed, 178 insertions(+), 64 deletions(-)
via e1d71c83e17ba6d06e2442ed775f7efd4ea32d84 (commit)
via 735a268880783acc77a2b99a5ac32c819c154ad9 (commit)
via 46e29d7fbf2628a01cb31ff7117732293129fd65 (commit)
via ea4b289bea3baebde1d23bbf38ded4e8da7ff298 (commit)
via 8cc0ba260202de5627af49691d259928ad7ffcc6 (commit)
via 43f38dbf96127a4036be5e8b01f9e82d825ad949 (commit)
via 4b6ae0c2b418fd3192b8248b3e8a614502c47060 (commit)
via e5b3a58e1106fe71d781995560f8b197dbaecbca (commit)
via e817beda3c9aefd99b1ce9b9c77cd2f346e14a01 (commit)
via fc16a366bf1061bfc2dc08ab1477c7febf8c3c5a (commit)
from 9a86712b5b6ca3490739e5b75d809be4c853e9a3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit e1d71c83e17ba6d06e2442ed775f7efd4ea32d84
Merge: 9a86712 735a268
Author: Brett Smith <brett at curoverse.com>
Date: Wed May 21 12:04:00 2014 -0400
Merge branch '2753-collection-tree-view'
Closes #2777, #2828, #2753.
commit 735a268880783acc77a2b99a5ac32c819c154ad9
Author: Brett Smith <brett at curoverse.com>
Date: Wed May 21 10:27:10 2014 -0400
2753: Add space between Workspace file tree buttons and scrollbar.
diff --git a/apps/workbench/app/assets/stylesheets/collections.css.scss b/apps/workbench/app/assets/stylesheets/collections.css.scss
index 0c3c396..2bd9bd8 100644
--- a/apps/workbench/app/assets/stylesheets/collections.css.scss
+++ b/apps/workbench/app/assets/stylesheets/collections.css.scss
@@ -1,7 +1,7 @@
/* Style for _show_files tree view. */
ul#collection_files {
- padding-left: 0;
+ padding: 0 .5em;
}
ul.collection_files {
commit 46e29d7fbf2628a01cb31ff7117732293129fd65
Author: Brett Smith <brett at curoverse.com>
Date: Wed May 21 10:19:55 2014 -0400
2753: Move file tree CSS to collections.css.
diff --git a/apps/workbench/app/assets/stylesheets/collections.css.scss b/apps/workbench/app/assets/stylesheets/collections.css.scss
index 24b08fa..0c3c396 100644
--- a/apps/workbench/app/assets/stylesheets/collections.css.scss
+++ b/apps/workbench/app/assets/stylesheets/collections.css.scss
@@ -1,3 +1,49 @@
+/* Style for _show_files tree view. */
+
+ul#collection_files {
+ padding-left: 0;
+}
+
+ul.collection_files {
+ line-height: 2.5em;
+ list-style-type: none;
+ padding-left: 2.3em;
+}
+
+ul.collection_files li {
+ clear: both;
+}
+
+.collection_files_row {
+ padding: 1px; /* Replaced by border for :hover */
+}
+
+.collection_files_row:hover {
+ background-color: #D9EDF7;
+ padding: 0px;
+ border: 1px solid #BCE8F1;
+ border-radius: 3px;
+}
+
+.collection_files_inline {
+ clear: both;
+ width: 80%;
+ height: auto;
+ max-height: 6em;
+ margin: 0 1em;
+}
+
+.collection_files_name {
+ padding-left: .5em;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.collection_files_name i.fa-fw:first-child {
+ width: 1.6em;
+}
+
/*
"active" and "inactive" colors are too similar for a toggle switch
in the default bootstrap theme.
diff --git a/apps/workbench/app/views/collections/_show_files.html.erb b/apps/workbench/app/views/collections/_show_files.html.erb
index fbd8c4b..38c5d00 100644
--- a/apps/workbench/app/views/collections/_show_files.html.erb
+++ b/apps/workbench/app/views/collections/_show_files.html.erb
@@ -1,49 +1,3 @@
-<% content_for :css do %>
-ul#collection_files {
- padding-left: 0;
-}
-
-ul.collection_files {
- line-height: 2.5em;
- list-style-type: none;
- padding-left: 2.3em;
-}
-
-ul.collection_files li {
- clear: both;
-}
-
-.collection_files_row {
- padding: 1px; /* Replaced by border for :hover */
-}
-
-.collection_files_row:hover {
- background-color: #D9EDF7;
- padding: 0px;
- border: 1px solid #BCE8F1;
- border-radius: 3px;
-}
-
-.collection_files_inline {
- clear: both;
- width: 80%;
- height: auto;
- max-height: 6em;
- margin: 0 1em;
-}
-
-.collection_files_name {
- padding-left: .5em;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.collection_files_name i.fa-fw:first-child {
- width: 1.6em;
-}
-<% end %>
-
<% content_for :tab_line_buttons do %>
<div class="row">
<div class="col-md-6"></div>
commit ea4b289bea3baebde1d23bbf38ded4e8da7ff298
Author: Brett Smith <brett at curoverse.com>
Date: Wed May 21 10:17:29 2014 -0400
2753: Refactor Collection view to use library CSS.
diff --git a/apps/workbench/app/views/collections/_show_files.html.erb b/apps/workbench/app/views/collections/_show_files.html.erb
index cbdbef6..fbd8c4b 100644
--- a/apps/workbench/app/views/collections/_show_files.html.erb
+++ b/apps/workbench/app/views/collections/_show_files.html.erb
@@ -39,14 +39,8 @@ ul.collection_files li {
text-overflow: ellipsis;
}
-.collection_files_name i.fa {
- display: block-inline;
- width: 1.75em;
- text-align: center;
-}
-
-.collection_files_buttons {
- float: right;
+.collection_files_name i.fa-fw:first-child {
+ width: 1.6em;
}
<% end %>
@@ -77,14 +71,14 @@ ul.collection_files li {
<% if size.nil? # This is a subdirectory. %>
<% dirstack.push(File.join(dirname, filename)) %>
<div class="collection_files_row">
- <div class="collection_files_name"><i class="fa fa-folder-open"></i> <%= filename %></div>
+ <div class="collection_files_name"><i class="fa fa-fw fa-folder-open"></i> <%= filename %></div>
</div>
<ul class="collection_files">
<% else %>
<% link_params = {controller: 'collections', action: 'show_file',
uuid: @object.uuid, file: file_path, size: size} %>
<div class="collection_files_row">
- <div class="collection_files_buttons">
+ <div class="collection_files_buttons pull-right">
<%= raw(human_readable_bytes_html(size)) %>
<%= check_box_tag 'uuids[]', "#{@object.uuid}/#{file_path}", false, {
:class => 'persistent-selection',
@@ -102,7 +96,7 @@ ul.collection_files li {
{title: "Download #{file_path}", class: "btn btn-info btn-sm"}) %>
</div>
<% if CollectionsHelper::is_image(filename) %>
- <div class="collection_files_name"><i class="fa fa-bar-chart-o"></i> <%= filename %></div>
+ <div class="collection_files_name"><i class="fa fa-fw fa-bar-chart-o"></i> <%= filename %></div>
</div>
<div class="collection_files_inline">
<%= link_to(image_tag("#{url_for @object}/#{file_path}"),
@@ -110,7 +104,7 @@ ul.collection_files li {
{title: file_path}) %>
</div>
<% else %>
- <div class="collection_files_name"><i class="fa fa-file"></i> <%= filename %></div>
+ <div class="collection_files_name"><i class="fa fa-fw fa-file"></i> <%= filename %></div>
</div>
<% end %>
</li>
commit 8cc0ba260202de5627af49691d259928ad7ffcc6
Author: Brett Smith <brett at curoverse.com>
Date: Wed May 21 10:07:28 2014 -0400
2753: Replace Workbench file tree backgrounds with hover effect.
Based on feedback from Tom in refs #2753. I'm still concerned about
users being able to line up buttons with filenames, so the highlight
on :hover is intended to help with that.
diff --git a/apps/workbench/app/views/collections/_show_files.html.erb b/apps/workbench/app/views/collections/_show_files.html.erb
index 4cc262e..cbdbef6 100644
--- a/apps/workbench/app/views/collections/_show_files.html.erb
+++ b/apps/workbench/app/views/collections/_show_files.html.erb
@@ -1,20 +1,27 @@
<% content_for :css do %>
+ul#collection_files {
+ padding-left: 0;
+}
+
ul.collection_files {
line-height: 2.5em;
list-style-type: none;
- background: #FFF;
+ padding-left: 2.3em;
}
ul.collection_files li {
clear: both;
}
-li.collection_files_row_even {
- background: #FFF;
+.collection_files_row {
+ padding: 1px; /* Replaced by border for :hover */
}
-li.collection_files_row_odd {
- background: #EEE;
+.collection_files_row:hover {
+ background-color: #D9EDF7;
+ padding: 0px;
+ border: 1px solid #BCE8F1;
+ border-radius: 3px;
}
.collection_files_inline {
@@ -66,14 +73,17 @@ li.collection_files_row_odd {
<% while dirstack.any? and (dirstack.last != dirname) %>
<% dirstack.pop %></ul></li>
<% end %>
- <li class="collection_files_row_<%= (index.odd?) ? 'odd' : 'even' %>">
+ <li>
<% if size.nil? # This is a subdirectory. %>
<% dirstack.push(File.join(dirname, filename)) %>
- <div class="collection_files_name"><i class="fa fa-folder-open"></i> <%= filename %></div>
- <ul class="collection_files">
+ <div class="collection_files_row">
+ <div class="collection_files_name"><i class="fa fa-folder-open"></i> <%= filename %></div>
+ </div>
+ <ul class="collection_files">
<% else %>
<% link_params = {controller: 'collections', action: 'show_file',
uuid: @object.uuid, file: file_path, size: size} %>
+ <div class="collection_files_row">
<div class="collection_files_buttons">
<%= raw(human_readable_bytes_html(size)) %>
<%= check_box_tag 'uuids[]', "#{@object.uuid}/#{file_path}", false, {
@@ -93,6 +103,7 @@ li.collection_files_row_odd {
</div>
<% if CollectionsHelper::is_image(filename) %>
<div class="collection_files_name"><i class="fa fa-bar-chart-o"></i> <%= filename %></div>
+ </div>
<div class="collection_files_inline">
<%= link_to(image_tag("#{url_for @object}/#{file_path}"),
link_params.merge(disposition: 'inline'),
@@ -100,6 +111,7 @@ li.collection_files_row_odd {
</div>
<% else %>
<div class="collection_files_name"><i class="fa fa-file"></i> <%= filename %></div>
+ </div>
<% end %>
</li>
<% end # if file or directory %>
commit 43f38dbf96127a4036be5e8b01f9e82d825ad949
Author: Brett Smith <brett at curoverse.com>
Date: Thu May 15 10:55:47 2014 -0400
2753: Workbench shows Collection files in a tree.
diff --git a/apps/workbench/app/views/collections/_show_files.html.erb b/apps/workbench/app/views/collections/_show_files.html.erb
index 4b63162..4cc262e 100644
--- a/apps/workbench/app/views/collections/_show_files.html.erb
+++ b/apps/workbench/app/views/collections/_show_files.html.erb
@@ -1,7 +1,45 @@
<% content_for :css do %>
-.file-list-inline-image {
- width: 50%;
+ul.collection_files {
+ line-height: 2.5em;
+ list-style-type: none;
+ background: #FFF;
+}
+
+ul.collection_files li {
+ clear: both;
+}
+
+li.collection_files_row_even {
+ background: #FFF;
+}
+
+li.collection_files_row_odd {
+ background: #EEE;
+}
+
+.collection_files_inline {
+ clear: both;
+ width: 80%;
height: auto;
+ max-height: 6em;
+ margin: 0 1em;
+}
+
+.collection_files_name {
+ padding-left: .5em;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.collection_files_name i.fa {
+ display: block-inline;
+ width: 1.75em;
+ text-align: center;
+}
+
+.collection_files_buttons {
+ float: right;
}
<% end %>
@@ -17,59 +55,54 @@
</div>
<% end %>
-<table class="table table-condensed table-fixedlayout">
- <colgroup>
- <col width="4%" />
- <col width="35%" />
- <col width="40%" />
- <col width="15%" />
- <col width="10%" />
- </colgroup>
- <thead>
- <tr>
- <th></th>
- <th>path</th>
- <th>file</th>
- <th style="text-align:right">size</th>
- <th>d/l</th>
- </tr>
- </thead><tbody>
- <% if @object then @object.files.sort_by{|f|[f[0],f[1]]}.each do |file| %>
- <% file_path = CollectionsHelper::file_path file %>
- <tr>
- <td>
- <%= check_box_tag 'uuids[]', @object.uuid+'/'+file_path, false, {
+<% file_tree = @object.andand.files_tree %>
+<% if file_tree.nil? or file_tree.empty? %>
+ <p>This collection is empty.</p>
+<% else %>
+ <ul id="collection_files" class="collection_files">
+ <% dirstack = [file_tree.first.first] %>
+ <% file_tree.each_with_index do |(dirname, filename, size), index| %>
+ <% file_path = CollectionsHelper::file_path([dirname, filename]) %>
+ <% while dirstack.any? and (dirstack.last != dirname) %>
+ <% dirstack.pop %></ul></li>
+ <% end %>
+ <li class="collection_files_row_<%= (index.odd?) ? 'odd' : 'even' %>">
+ <% if size.nil? # This is a subdirectory. %>
+ <% dirstack.push(File.join(dirname, filename)) %>
+ <div class="collection_files_name"><i class="fa fa-folder-open"></i> <%= filename %></div>
+ <ul class="collection_files">
+ <% else %>
+ <% link_params = {controller: 'collections', action: 'show_file',
+ uuid: @object.uuid, file: file_path, size: size} %>
+ <div class="collection_files_buttons">
+ <%= raw(human_readable_bytes_html(size)) %>
+ <%= check_box_tag 'uuids[]', "#{@object.uuid}/#{file_path}", false, {
:class => 'persistent-selection',
:friendly_type => "File",
:friendly_name => "#{@object.uuid}/#{file_path}",
- :href => "#{url_for controller: 'collections', action: 'show', id: @object.uuid }/#{file_path}",
- :title => "Click to add this item to your selection list"
+ :href => url_for(controller: 'collections', action: 'show_file',
+ uuid: @object.uuid, file: file_path),
+ :title => "Include #{file_path} in your selections",
} %>
- </td>
- <td>
- <%= file[0] %>
- </td>
-
- <td>
- <%= link_to (if CollectionsHelper::is_image file[1]
- image_tag "#{url_for @object}/#{file_path}", class: "file-list-inline-image"
- else
- file[1]
- end),
- {controller: 'collections', action: 'show_file', uuid: @object.uuid, file: file_path, size: file[2], disposition: 'inline'},
- {title: file_path} %>
- </td>
-
- <td style="text-align:right">
- <%= raw(human_readable_bytes_html(file[2])) %>
- </td>
-
- <td>
- <div style="display:inline-block">
- <%= link_to raw('<i class="glyphicon glyphicon-download-alt"></i>'), {controller: 'collections', action: 'show_file', uuid: @object.uuid, file: file_path, size: file[2], disposition: 'attachment'}, {class: 'btn btn-info btn-sm', title: 'Download'} %>
- </div>
- </td>
- </tr>
- <% end; end %>
- </tbody>
-</table>
+ <%= link_to(raw('<i class="fa fa-search"></i>'),
+ link_params.merge(disposition: 'inline'),
+ {title: "View #{file_path}", class: "btn btn-info btn-sm"}) %>
+ <%= link_to(raw('<i class="fa fa-download"></i>'),
+ link_params.merge(disposition: 'attachment'),
+ {title: "Download #{file_path}", class: "btn btn-info btn-sm"}) %>
+ </div>
+ <% if CollectionsHelper::is_image(filename) %>
+ <div class="collection_files_name"><i class="fa fa-bar-chart-o"></i> <%= filename %></div>
+ <div class="collection_files_inline">
+ <%= link_to(image_tag("#{url_for @object}/#{file_path}"),
+ link_params.merge(disposition: 'inline'),
+ {title: file_path}) %>
+ </div>
+ <% else %>
+ <div class="collection_files_name"><i class="fa fa-file"></i> <%= filename %></div>
+ <% end %>
+ </li>
+ <% end # if file or directory %>
+ <% end # file_tree.each %>
+ </ul>
+<% end # if file_tree %>
commit 4b6ae0c2b418fd3192b8248b3e8a614502c47060
Author: Brett Smith <brett at curoverse.com>
Date: Tue May 13 17:31:29 2014 -0400
2753: Workbench renders "0 bytes" for empty file sizes.
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index 720173c..f8bb589 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -17,6 +17,7 @@ module ApplicationHelper
def human_readable_bytes_html(n)
return h(n) unless n.is_a? Fixnum
+ return "0 bytes" if (n == 0)
orders = {
1 => "bytes",
commit e5b3a58e1106fe71d781995560f8b197dbaecbca
Author: Brett Smith <brett at curoverse.com>
Date: Mon May 12 17:29:55 2014 -0400
2753: Add Workbench Collection#files_tree.
diff --git a/apps/workbench/app/models/collection.rb b/apps/workbench/app/models/collection.rb
index 6022d82..2346a27 100644
--- a/apps/workbench/app/models/collection.rb
+++ b/apps/workbench/app/models/collection.rb
@@ -22,6 +22,27 @@ class Collection < ArvadosBase
end
end
+ def files_tree
+ tree = files.group_by { |file_spec| File.split(file_spec.first) }
+ # Fill in entries for empty directories.
+ tree.keys.map { |basedir, _| File.split(basedir) }.each do |splitdir|
+ until tree.include?(splitdir)
+ tree[splitdir] = []
+ splitdir = File.split(splitdir.first)
+ end
+ end
+ dir_to_tree = lambda do |dirname|
+ # First list subdirectories, with their files inside.
+ subnodes = tree.keys.select { |bd, td| (bd == dirname) and (td != '.') }
+ .sort.flat_map do |parts|
+ [parts + [nil]] + dir_to_tree.call(File.join(parts))
+ end
+ # Then extend that list with files in this directory.
+ subnodes + tree[File.split(dirname)]
+ end
+ dir_to_tree.call('.')
+ end
+
def attribute_editable?(attr)
false
end
diff --git a/apps/workbench/test/unit/collection_test.rb b/apps/workbench/test/unit/collection_test.rb
index bbfc983..512ad47 100644
--- a/apps/workbench/test/unit/collection_test.rb
+++ b/apps/workbench/test/unit/collection_test.rb
@@ -13,4 +13,31 @@ class CollectionTest < ActiveSupport::TestCase
assert_equal false, Collection.is_empty_blob_locator?(x)
end
end
+
+ def get_files_tree(coll_name)
+ use_token :admin
+ Collection.find(api_fixture('collections')[coll_name]['uuid']).files_tree
+ end
+
+ test "easy files_tree" do
+ files_in = lambda do |dirname|
+ (1..3).map { |n| [dirname, "file#{n}", 0] }
+ end
+ assert_equal([['.', 'dir1', nil], ['./dir1', 'subdir', nil]] +
+ files_in['./dir1/subdir'] + files_in['./dir1'] +
+ [['.', 'dir2', nil]] + files_in['./dir2'] + files_in['.'],
+ get_files_tree('multilevel_collection_1'),
+ "Collection file tree was malformed")
+ end
+
+ test "files_tree with files deep in subdirectories" do
+ # This test makes sure files_tree generates synthetic directory entries.
+ # The manifest doesn't list directories with no files.
+ assert_equal([['.', 'dir1', nil], ['./dir1', 'sub1', nil],
+ ['./dir1/sub1', 'a', 0], ['./dir1/sub1', 'b', 0],
+ ['.', 'dir2', nil], ['./dir2', 'sub2', nil],
+ ['./dir2/sub2', 'c', 0], ['./dir2/sub2', 'd', 0]],
+ get_files_tree('multilevel_collection_2'),
+ "Collection file tree was malformed")
+ end
end
diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index ce05d18..26f5f48 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -37,3 +37,24 @@ baz_file:
modified_at: 2014-02-03T17:22:54Z
updated_at: 2014-02-03T17:22:54Z
manifest_text: ". 73feffa4b7f6bb68e44cf984c85f6e88+3 0:3:baz\n"
+
+multilevel_collection_1:
+ uuid: 1fd08fc162a5c6413070a8bd0bffc818+150
+ owner_uuid: qr1hi-tpzed-000000000000000
+ created_at: 2014-02-03T17:22:54Z
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+ modified_at: 2014-02-03T17:22:54Z
+ updated_at: 2014-02-03T17:22:54Z
+ manifest_text: ". 0:0:file1 0:0:file2 0:0:file3\n./dir1 0:0:file1 0:0:file2 0:0:file3\n./dir1/subdir 0:0:file1 0:0:file2 0:0:file3\n./dir2 0:0:file1 0:0:file2 0:0:file3\n"
+
+multilevel_collection_2:
+ # All of this collection's files are deep in subdirectories.
+ uuid: 80cf6dd2cf079dd13f272ec4245cb4a8+48
+ owner_uuid: qr1hi-tpzed-000000000000000
+ created_at: 2014-02-03T17:22:54Z
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+ modified_at: 2014-02-03T17:22:54Z
+ updated_at: 2014-02-03T17:22:54Z
+ manifest_text: "./dir1/sub1 0:0:a 0:0:b\n./dir2/sub2 0:0:c 0:0:d\n"
commit e817beda3c9aefd99b1ce9b9c77cd2f346e14a01
Author: Brett Smith <brett at curoverse.com>
Date: Mon May 12 11:21:12 2014 -0400
2753: Add tests for CollectionsHelper.file_path.
diff --git a/apps/workbench/test/unit/helpers/collections_helper_test.rb b/apps/workbench/test/unit/helpers/collections_helper_test.rb
index 16a85d9..56d23c5 100644
--- a/apps/workbench/test/unit/helpers/collections_helper_test.rb
+++ b/apps/workbench/test/unit/helpers/collections_helper_test.rb
@@ -1,4 +1,12 @@
require 'test_helper'
class CollectionsHelperTest < ActionView::TestCase
+ test "file_path generates short names" do
+ assert_equal('foo', CollectionsHelper.file_path(['.', 'foo', 0]),
+ "wrong result for filename in collection root")
+ assert_equal('foo/bar', CollectionsHelper.file_path(['foo', 'bar', 0]),
+ "wrong result for filename in directory without leading .")
+ assert_equal('foo/bar', CollectionsHelper.file_path(['./foo', 'bar', 0]),
+ "wrong result for filename in directory with leading .")
+ end
end
commit fc16a366bf1061bfc2dc08ab1477c7febf8c3c5a
Author: Brett Smith <brett at curoverse.com>
Date: Mon May 12 10:37:55 2014 -0400
2753: Make Collection filenames with existing helper.
This is pure refactoring to make the code more consistent.
diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index 656c063..370c681 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -185,12 +185,9 @@ class CollectionsController < ApplicationController
end
def file_in_collection?(collection, filename)
- def normalized_path(part_list)
- File.join(part_list).sub(%r{^\./}, '')
- end
- target = normalized_path([filename])
+ target = CollectionsHelper.file_path(File.split(filename))
collection.files.each do |file_spec|
- return true if (normalized_path(file_spec[0, 2]) == target)
+ return true if (CollectionsHelper.file_path(file_spec) == target)
end
false
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list