[ARVADOS] updated: e0619201d96eb7f9cb8229d1c883f0665d1488ba
git at public.curoverse.com
git at public.curoverse.com
Tue Feb 3 16:32:23 EST 2015
Summary of changes:
.../app/controllers/collections_controller.rb | 13 +-
apps/workbench/app/controllers/jobs_controller.rb | 7 +-
.../controllers/pipeline_instances_controller.rb | 7 +-
.../controllers/pipeline_templates_controller.rb | 7 +-
.../app/controllers/projects_controller.rb | 7 +-
apps/workbench/app/models/collection.rb | 4 -
apps/workbench/app/models/job.rb | 4 -
.../app/views/collections/_show_files.html.erb | 173 ++++++++++-----------
.../app/views/jobs/_show_job_buttons.html.erb | 2 +-
apps/workbench/app/views/layouts/body.html.erb | 8 +-
.../pipeline_instances/_running_component.html.erb | 4 +-
.../views/pipeline_instances/_show_inputs.html.erb | 17 +-
.../app/views/pipeline_templates/show.html.erb | 40 ++---
.../app/views/projects/_show_tab_contents.html.erb | 108 ++++++-------
apps/workbench/test/integration/errors_test.rb | 3 +-
15 files changed, 196 insertions(+), 208 deletions(-)
via e0619201d96eb7f9cb8229d1c883f0665d1488ba (commit)
via 4d8209df92198e6207d3d38cbb7a189cb319bf3c (commit)
via afabee438a48de83632f0eec51f78a0529b71a0e (commit)
via 5b7495879ac4e9b34fc989f58aae4773f56bb191 (commit)
via 1b39a6e15bb68a088f25bb31c31298a1155dc26c (commit)
via 416c543625bb6a7195a48988dc8f32643ca10aa1 (commit)
via 4cd97b2cf2035c44762865f10b0f51e3ac807566 (commit)
via 0d2e6cf379f33188fa19aed9c0c246a2514e9e81 (commit)
from 9fcabe977798468f2ee896b5f5c1ba6d80703341 (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 e0619201d96eb7f9cb8229d1c883f0665d1488ba
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Feb 3 16:33:18 2015 -0500
2659: Check anon config at runtime instead of boot time in skip_before_filter. This makes it possible for test cases to toggle behavior by changing configuration on the fly.
diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index 36c214c..613ed98 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -3,13 +3,12 @@ require "arvados/keep"
class CollectionsController < ApplicationController
include ActionController::Live
- if Rails.configuration.anonymous_user_token
- skip_around_filter(:require_thread_api_token,
- only: [:show_file, :show_file_links, :show])
- else
- skip_around_filter(:require_thread_api_token,
- only: [:show_file, :show_file_links])
- end
+ skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ Rails.configuration.anonymous_user_token and
+ 'show' == ctrl.action_name
+ }
+ skip_around_filter(:require_thread_api_token,
+ only: [:show_file, :show_file_links])
skip_before_filter(:find_object_by_uuid,
only: [:provenance, :show_file, :show_file_links])
# We depend on show_file to display the user agreement:
diff --git a/apps/workbench/app/controllers/jobs_controller.rb b/apps/workbench/app/controllers/jobs_controller.rb
index 9090d64..b90210f 100644
--- a/apps/workbench/app/controllers/jobs_controller.rb
+++ b/apps/workbench/app/controllers/jobs_controller.rb
@@ -1,7 +1,8 @@
class JobsController < ApplicationController
- if Rails.configuration.anonymous_user_token
- skip_around_filter :require_thread_api_token, only: :show
- end
+ skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ Rails.configuration.anonymous_user_token and
+ 'show' == ctrl.action_name
+ }
include JobsHelper
diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb
index 2f875ed..b4cce9b 100644
--- a/apps/workbench/app/controllers/pipeline_instances_controller.rb
+++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb
@@ -1,9 +1,10 @@
class PipelineInstancesController < ApplicationController
skip_before_filter :find_object_by_uuid, only: :compare
before_filter :find_objects_by_uuid, only: :compare
- if Rails.configuration.anonymous_user_token
- skip_around_filter :require_thread_api_token, only: :show
- end
+ skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ Rails.configuration.anonymous_user_token and
+ 'show' == ctrl.action_name
+ }
include PipelineInstancesHelper
include PipelineComponentsHelper
diff --git a/apps/workbench/app/controllers/pipeline_templates_controller.rb b/apps/workbench/app/controllers/pipeline_templates_controller.rb
index eb5f379..83ab88f 100644
--- a/apps/workbench/app/controllers/pipeline_templates_controller.rb
+++ b/apps/workbench/app/controllers/pipeline_templates_controller.rb
@@ -1,7 +1,8 @@
class PipelineTemplatesController < ApplicationController
- if Rails.configuration.anonymous_user_token
- skip_around_filter :require_thread_api_token, only: :show
- end
+ skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ Rails.configuration.anonymous_user_token and
+ 'show' == ctrl.action_name
+ }
include PipelineComponentsHelper
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index d0c5f8c..abba785 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -1,8 +1,9 @@
class ProjectsController < ApplicationController
before_filter :set_share_links, if: -> { defined? @object }
- if Rails.configuration.anonymous_user_token
- skip_around_filter :require_thread_api_token, only: [:show, :tab_counts]
- end
+ skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ Rails.configuration.anonymous_user_token and
+ %w(show tab_counts).include? ctrl.action_name
+ }
def model_class
Group
commit 4d8209df92198e6207d3d38cbb7a189cb319bf3c
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Feb 3 15:24:24 2015 -0500
2659: Remove obsolete "don't create jobs in workbench" rule.
diff --git a/apps/workbench/app/models/job.rb b/apps/workbench/app/models/job.rb
index c59bb89..3ece865 100644
--- a/apps/workbench/app/models/job.rb
+++ b/apps/workbench/app/models/job.rb
@@ -11,10 +11,6 @@ class Job < ArvadosBase
%w(description)
end
- def self.creatable?
- false
- end
-
def default_name
if script
x = "\"#{script}\" job"
commit afabee438a48de83632f0eec51f78a0529b71a0e
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Feb 3 14:57:28 2015 -0500
2659: Update test to match changed error message.
diff --git a/apps/workbench/test/integration/errors_test.rb b/apps/workbench/test/integration/errors_test.rb
index 37846a8..1cac667 100644
--- a/apps/workbench/test/integration/errors_test.rb
+++ b/apps/workbench/test/integration/errors_test.rb
@@ -128,8 +128,7 @@ class ErrorsTest < ActionDispatch::IntegrationTest
test "404 page checks if user not logged in and makes suggestion" do
visit "/collections/#{BAD_UUID}"
- assert_includes page.text, 'You are not logged into Arvados',
- 'Not found: You are not logged into Arvados'
+ assert_text 'you are not logged in'
end
end
commit 5b7495879ac4e9b34fc989f58aae4773f56bb191
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Feb 3 14:56:41 2015 -0500
2659: Remove obsolete "don't create collections in workbench" rule.
diff --git a/apps/workbench/app/models/collection.rb b/apps/workbench/app/models/collection.rb
index 686b816..1bd711b 100644
--- a/apps/workbench/app/models/collection.rb
+++ b/apps/workbench/app/models/collection.rb
@@ -70,10 +70,6 @@ class Collection < ArvadosBase
%w(name description manifest_text)
end
- def self.creatable?
- false
- end
-
def provenance
arvados_api_client.api "collections/#{self.uuid}/", "provenance"
end
commit 1b39a6e15bb68a088f25bb31c31298a1155dc26c
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Feb 3 14:28:00 2015 -0500
2659: Back out unneeded condition. Fix up whitespace.
diff --git a/apps/workbench/app/views/layouts/body.html.erb b/apps/workbench/app/views/layouts/body.html.erb
index 687dcfc..fb28efe 100644
--- a/apps/workbench/app/views/layouts/body.html.erb
+++ b/apps/workbench/app/views/layouts/body.html.erb
@@ -7,7 +7,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
- <a class="navbar-brand" href="/" data-push=true><%= Rails.configuration.site_name.downcase rescue Rails.application.class.parent_name %> </a>
+ <a class="navbar-brand" href="/" data-push=true><%= Rails.configuration.site_name.downcase rescue Rails.application.class.parent_name %></a>
</div>
<div class="collapse navbar-collapse">
@@ -51,11 +51,7 @@
<li role="menuitem"><a href="/users/<%=current_user.uuid%>/profile" role="menuitem"><i class="fa fa-key fa-fw"></i> Manage profile</a></li>
<% end %>
<% end %>
- <% if current_user %>
- <li role="menuitem"><a href="<%= logout_path %>" role="menuitem"><i class="fa fa-sign-out fa-fw"></i> Log out</a></li>
- <% else %>
- <li><a href="<%= arvados_api_client.arvados_login_url(return_to: root_url) %>">Log in</a></li>
- <% end %>
+ <li role="menuitem"><a href="<%= logout_path %>" role="menuitem"><i class="fa fa-sign-out fa-fw"></i> Log out</a></li>
<% if user_notifications.any? %>
<li role="presentation" class="divider"></li>
<% user_notifications.each_with_index do |n, i| %>
commit 416c543625bb6a7195a48988dc8f32643ca10aa1
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Feb 3 14:27:10 2015 -0500
2659: Toggle features according to editable? and creatable? instead of current_user.is_active. Fix up whitespace.
diff --git a/apps/workbench/app/views/jobs/_show_job_buttons.html.erb b/apps/workbench/app/views/jobs/_show_job_buttons.html.erb
index a186615..b6c39df 100644
--- a/apps/workbench/app/views/jobs/_show_job_buttons.html.erb
+++ b/apps/workbench/app/views/jobs/_show_job_buttons.html.erb
@@ -1,4 +1,4 @@
-<% if @object.state != "Running" && current_user.andand.is_active %>
+<% if @object.state != "Running" and Job.creatable? %>
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#jobRerunModal">
<i class="fa fa-fw fa-gear"></i> Re-run job...
</button>
diff --git a/apps/workbench/app/views/pipeline_instances/_running_component.html.erb b/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
index d0929d5..f87dede 100644
--- a/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
@@ -75,8 +75,7 @@
</div>
<% end %>
- <% if current_user.andand.is_active %>
- <% if current_job[:state].in? ["Queued", "Running"] %>
+ <% if current_job[:state].in? ["Queued", "Running"] and @object.editable? %>
<%# column offset 11 %>
<div class="col-md-1 pipeline-instance-spacing">
<%= form_tag "/jobs/#{current_job[:uuid]}/cancel", remote: true, style: "display:inline; padding-left: 1em" do |f| %>
@@ -85,7 +84,6 @@
<% end %>
</div>
<% end %>
- <% end %>
<% end %>
</div>
</div>
diff --git a/apps/workbench/app/views/pipeline_instances/_show_inputs.html.erb b/apps/workbench/app/views/pipeline_instances/_show_inputs.html.erb
index 9523375..e6b7ef2 100644
--- a/apps/workbench/app/views/pipeline_instances/_show_inputs.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_show_inputs.html.erb
@@ -33,15 +33,14 @@
<p>This pipeline does not need any further inputs specified. You can start it by clicking the "Run" button whenever you're ready. (It's not too late to change existing settings, though.)</p>
<% else %>
<p><i>Provide <%= n_inputs > 1 ? 'values' : 'a value' %> for the following <%= n_inputs > 1 ? 'parameters' : 'parameter' %>, then click the "Run" button to start the pipeline.</i></p>
- <%= content_for :pi_input_form %>
-
- <% if current_user.andand.is_active %>
- <%= link_to(url_for('pipeline_instance[state]' => 'RunningOnServer'),
- class: 'btn btn-primary run-pipeline-button',
- method: :patch
- ) do %>
- Run <i class="fa fa-fw fa-play"></i>
- <% end %>
+ <% if @object.editable? %>
+ <%= content_for :pi_input_form %>
+ <%= link_to(url_for('pipeline_instance[state]' => 'RunningOnServer'),
+ class: 'btn btn-primary run-pipeline-button',
+ method: :patch
+ ) do %>
+ Run <i class="fa fa-fw fa-play"></i>
+ <% end %>
<% end %>
<% end %>
diff --git a/apps/workbench/app/views/pipeline_templates/show.html.erb b/apps/workbench/app/views/pipeline_templates/show.html.erb
index f9f9480..b4264e5 100644
--- a/apps/workbench/app/views/pipeline_templates/show.html.erb
+++ b/apps/workbench/app/views/pipeline_templates/show.html.erb
@@ -1,21 +1,25 @@
-<% if current_user.andand.is_active %>
-<% content_for :tab_line_buttons do %>
- <%= link_to(choose_projects_path(id: "run-pipeline-button",
- title: 'Choose project',
- editable: true,
- action_name: 'Choose',
- action_href: pipeline_instances_path,
- action_method: 'post',
- action_data: {selection_param: 'pipeline_instance[owner_uuid]',
- 'pipeline_instance[pipeline_template_uuid]' => @object.uuid,
- 'pipeline_instance[description]' => "Created at #{Time.now.localtime}" + (@object.name.andand.size.andand>0 ? " using the pipeline template *#{@object.name}*" : ""),
- 'success' => 'redirect-to-created-object'
- }.to_json),
- { class: "btn btn-primary btn-sm", remote: true, title: 'Run this pipeline' }
- ) do %>
- <i class="fa fa-gear"></i> Run this pipeline
- <% end %>
-<% end %>
+<% if @object.editable? %>
+ <% content_for :tab_line_buttons do %>
+ <%= link_to(choose_projects_path(
+ id: "run-pipeline-button",
+ title: 'Choose project',
+ editable: true,
+ action_name: 'Choose',
+ action_href: pipeline_instances_path,
+ action_method: 'post',
+ action_data: {
+ 'selection_param' => 'pipeline_instance[owner_uuid]',
+ 'pipeline_instance[pipeline_template_uuid]' => @object.uuid,
+ 'pipeline_instance[description]' => "Created at #{Time.now.localtime}" + (@object.name.andand.size.andand>0 ? " using the pipeline template *#{@object.name}*" : ""),
+ 'success' => 'redirect-to-created-object',
+ }.to_json), {
+ class: "btn btn-primary btn-sm",
+ remote: true,
+ title: 'Run this pipeline'
+ }) do %>
+ <i class="fa fa-gear"></i> Run this pipeline
+ <% end %>
+ <% end %>
<% end %>
<%= render file: 'application/show.html.erb', locals: local_assigns %>
diff --git a/apps/workbench/app/views/projects/_show_tab_contents.html.erb b/apps/workbench/app/views/projects/_show_tab_contents.html.erb
index b3b5993..0b308db 100644
--- a/apps/workbench/app/views/projects/_show_tab_contents.html.erb
+++ b/apps/workbench/app/views/projects/_show_tab_contents.html.erb
@@ -5,17 +5,17 @@
<div class="btn-group btn-group-sm">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Selection <span class="caret"></span></button>
<ul class="dropdown-menu" role="menu">
- <% if current_user.andand.is_active %>
- <li><%= link_to "Create new collection with selected collections", '#',
- 'data-href' => combine_selected_path(
- action_data: {current_project_uuid: @object.uuid}.to_json
- ),
- 'id' => 'combine_selections_button',
- method: :post,
- 'data-selection-param-name' => 'selection[]',
- 'data-selection-action' => 'combine-project-contents',
- 'data-toggle' => 'dropdown'
- %></li>
+ <% if Collection.creatable? %>
+ <li><%= link_to "Create new collection with selected collections", '#',
+ 'data-href' => combine_selected_path(
+ action_data: {current_project_uuid: @object.uuid}.to_json
+ ),
+ 'id' => 'combine_selections_button',
+ method: :post,
+ 'data-selection-param-name' => 'selection[]',
+ 'data-selection-action' => 'combine-project-contents',
+ 'data-toggle' => 'dropdown'
+ %></li>
<% end %>
<li><%= link_to "Compare selected", '#',
'data-href' => compare_pipeline_instances_path,
@@ -23,51 +23,51 @@
'data-selection-action' => 'compare',
'data-toggle' => 'dropdown'
%></li>
- <% if current_user.andand.is_active %>
- <li><%= link_to "Copy selected...", '#',
- 'data-href' => choose_projects_path(
- title: 'Copy selected items to...',
- editable: true,
- action_name: 'Copy',
- action_href: actions_path,
- action_method: 'post',
- action_data_from_params: ['selection'],
- action_data: {
- copy_selections_into_project: true,
- selection_param: 'uuid',
- success: 'page-refresh'}.to_json),
- 'data-remote' => true,
- 'data-selection-param-name' => 'selection[]',
- 'data-selection-action' => 'copy',
- 'data-toggle' => 'dropdown'
- %></li>
+ <% if Collection.creatable? %>
+ <li><%= link_to "Copy selected...", '#',
+ 'data-href' => choose_projects_path(
+ title: 'Copy selected items to...',
+ editable: true,
+ action_name: 'Copy',
+ action_href: actions_path,
+ action_method: 'post',
+ action_data_from_params: ['selection'],
+ action_data: {
+ copy_selections_into_project: true,
+ selection_param: 'uuid',
+ success: 'page-refresh'}.to_json),
+ 'data-remote' => true,
+ 'data-selection-param-name' => 'selection[]',
+ 'data-selection-action' => 'copy',
+ 'data-toggle' => 'dropdown'
+ %></li>
<% end %>
<% if @object.editable? %>
- <li><%= link_to "Move selected...", '#',
- 'data-href' => choose_projects_path(
- title: 'Move selected items to...',
- editable: true,
- action_name: 'Move',
- action_href: actions_path,
- action_method: 'post',
- action_data_from_params: ['selection'],
- action_data: {
- move_selections_into_project: true,
- selection_param: 'uuid',
- success: 'page-refresh'}.to_json),
- 'data-remote' => true,
- 'data-selection-param-name' => 'selection[]',
- 'data-selection-action' => 'move',
- 'data-toggle' => 'dropdown'
- %></li>
- <li><%= link_to "Remove selected", '#',
- method: :delete,
- 'data-href' => url_for(action: :remove_items),
- 'data-selection-param-name' => 'item_uuids[]',
- 'data-selection-action' => 'remove',
- 'data-remote' => true,
- 'data-toggle' => 'dropdown'
- %></li>
+ <li><%= link_to "Move selected...", '#',
+ 'data-href' => choose_projects_path(
+ title: 'Move selected items to...',
+ editable: true,
+ action_name: 'Move',
+ action_href: actions_path,
+ action_method: 'post',
+ action_data_from_params: ['selection'],
+ action_data: {
+ move_selections_into_project: true,
+ selection_param: 'uuid',
+ success: 'page-refresh'}.to_json),
+ 'data-remote' => true,
+ 'data-selection-param-name' => 'selection[]',
+ 'data-selection-action' => 'move',
+ 'data-toggle' => 'dropdown'
+ %></li>
+ <li><%= link_to "Remove selected", '#',
+ method: :delete,
+ 'data-href' => url_for(action: :remove_items),
+ 'data-selection-param-name' => 'item_uuids[]',
+ 'data-selection-action' => 'remove',
+ 'data-remote' => true,
+ 'data-toggle' => 'dropdown'
+ %></li>
<% end %>
</ul>
</div>
commit 4cd97b2cf2035c44762865f10b0f51e3ac807566
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Feb 3 14:14:43 2015 -0500
2659: Fix indentation.
diff --git a/apps/workbench/app/views/collections/_show_files.html.erb b/apps/workbench/app/views/collections/_show_files.html.erb
index 75293fc..383ec64 100644
--- a/apps/workbench/app/views/collections/_show_files.html.erb
+++ b/apps/workbench/app/views/collections/_show_files.html.erb
@@ -21,99 +21,98 @@ function unselect_all_files() {
<div class="selection-action-container" style="padding-left: <%=padding_left%>">
<% if Collection.creatable? and (!defined? no_checkboxes or !no_checkboxes) %>
- <div class="row">
- <div class="pull-left">
- <div class="btn-group btn-group-sm">
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Selection... <span class="caret"></span></button>
- <ul class="dropdown-menu" role="menu">
- <li><%= link_to "Create new collection with selected files", '#',
- method: :post,
- 'data-href' => combine_selected_path(
- action_data: {current_project_uuid: @object.owner_uuid}.to_json
- ),
- 'data-selection-param-name' => 'selection[]',
- 'data-selection-action' => 'combine-collections',
- 'data-toggle' => 'dropdown'
- %></li>
- </ul>
+ <div class="row">
+ <div class="pull-left">
+ <div class="btn-group btn-group-sm">
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Selection... <span class="caret"></span></button>
+ <ul class="dropdown-menu" role="menu">
+ <li><%= link_to "Create new collection with selected files", '#',
+ method: :post,
+ 'data-href' => combine_selected_path(
+ action_data: {current_project_uuid: @object.owner_uuid}.to_json
+ ),
+ 'data-selection-param-name' => 'selection[]',
+ 'data-selection-action' => 'combine-collections',
+ 'data-toggle' => 'dropdown'
+ %></li>
+ </ul>
+ </div>
+ <div class="btn-group btn-group-sm">
+ <button id="select-all" type="button" class="btn btn-default" onClick="select_all_files()">Select all</button>
+ <button id="unselect-all" type="button" class="btn btn-default" onClick="unselect_all_files()">Unselect all</button>
+ </div>
</div>
- <div class="btn-group btn-group-sm">
- <button id="select-all" type="button" class="btn btn-default" onClick="select_all_files()">Select all</button>
- <button id="unselect-all" type="button" class="btn btn-default" onClick="unselect_all_files()">Unselect all</button>
+ <div class="pull-right">
+ <input class="form-control filterable-control" data-filterable-target="ul#collection_files" id="file_regex" name="file_regex" placeholder="filename regex" type="text"/>
</div>
</div>
- <div class="pull-right">
- <input class="form-control filterable-control" data-filterable-target="ul#collection_files" id="file_regex" name="file_regex" placeholder="filename regex" type="text"/>
- </div>
- </div>
- <p/>
+ <p/>
<% end %>
-<% 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 <%=preview_selectable_container%>">
- <% dirstack = [file_tree.first.first] %>
- <% file_tree.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 %></ul></li>
- <% end %>
- <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-fw fa-folder-open"></i> <%= filename %></div>
- </div>
- <ul class="collection_files">
- <% else %>
- <% link_params = {controller: 'collections', action: 'show_file',
- uuid: @object.portable_data_hash, file: file_path, size: size} %>
- <div class="collection_files_row filterable <%=preview_selectable%>" href="<%=@object.uuid%>/<%=file_path%>">
- <div class="collection_files_buttons pull-right">
- <%= raw(human_readable_bytes_html(size)) %>
- <% disable_search = (Rails.configuration.filename_suffixes_with_view_icon.include? file_path.split('.')[-1]) ? false : true %>
- <%= link_to(raw('<i class="fa fa-search"></i>'),
- link_params.merge(disposition: 'inline'),
- {title: "View #{file_path}", class: "btn btn-info btn-sm", disabled: disable_search}) %>
- <%= 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>
-
- <div class="collection_files_name">
- <% if !defined? no_checkboxes or !no_checkboxes %>
- <%= 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_file',
- uuid: @object.portable_data_hash, file: file_path),
- :title => "Include #{file_path} in your selections",
- } %>
- <span> </span>
- <% end %>
- <% if CollectionsHelper::is_image(filename) %>
- <i class="fa fa-fw 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}) %>
+ <% 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 <%=preview_selectable_container%>">
+ <% dirstack = [file_tree.first.first] %>
+ <% file_tree.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 %></ul></li>
+ <% end %>
+ <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-fw fa-folder-open"></i> <%= filename %></div>
</div>
- </div>
+ <ul class="collection_files">
<% else %>
- <i class="fa fa-fw fa-file" href="<%=@object.uuid%>/<%=file_path%>" ></i> <%= filename %></div>
- </div>
- <% end %>
- </li>
- <% end # if file or directory %>
- <% end # file_tree.each %>
- <%= raw(dirstack.map { |_| "</ul>" }.join("</li>")) %>
-<% end # if file_tree %>
+ <% link_params = {controller: 'collections', action: 'show_file',
+ uuid: @object.portable_data_hash, file: file_path, size: size} %>
+ <div class="collection_files_row filterable <%=preview_selectable%>" href="<%=@object.uuid%>/<%=file_path%>">
+ <div class="collection_files_buttons pull-right">
+ <%= raw(human_readable_bytes_html(size)) %>
+ <% disable_search = (Rails.configuration.filename_suffixes_with_view_icon.include? file_path.split('.')[-1]) ? false : true %>
+ <%= link_to(raw('<i class="fa fa-search"></i>'),
+ link_params.merge(disposition: 'inline'),
+ {title: "View #{file_path}", class: "btn btn-info btn-sm", disabled: disable_search}) %>
+ <%= 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>
+
+ <div class="collection_files_name">
+ <% if !defined? no_checkboxes or !no_checkboxes %>
+ <%= 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_file',
+ uuid: @object.portable_data_hash, file: file_path),
+ :title => "Include #{file_path} in your selections",
+ } %>
+ <span> </span>
+ <% end %>
+ <% if CollectionsHelper::is_image(filename) %>
+ <i class="fa fa-fw 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>
+ </div>
+ <% else %>
+ <i class="fa fa-fw fa-file" href="<%=@object.uuid%>/<%=file_path%>" ></i> <%= filename %></div>
+ </div>
+ <% end %>
+ </li>
+ <% end # if file or directory %>
+ <% end # file_tree.each %>
+ <%= raw(dirstack.map { |_| "</ul>" }.join("</li>")) %>
+ <% end # if file_tree %>
+</div>
<% content_for :footer_html do %>
<div id="collection-sharing-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
<% end %>
-
-</div>
commit 0d2e6cf379f33188fa19aed9c0c246a2514e9e81
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Feb 3 14:13:52 2015 -0500
2659: Use Collection.creatable? to toggle selection actions.
diff --git a/apps/workbench/app/views/collections/_show_files.html.erb b/apps/workbench/app/views/collections/_show_files.html.erb
index 125896b..75293fc 100644
--- a/apps/workbench/app/views/collections/_show_files.html.erb
+++ b/apps/workbench/app/views/collections/_show_files.html.erb
@@ -20,9 +20,8 @@ function unselect_all_files() {
%>
<div class="selection-action-container" style="padding-left: <%=padding_left%>">
- <% if !defined? no_checkboxes or !no_checkboxes %>
+ <% if Collection.creatable? and (!defined? no_checkboxes or !no_checkboxes) %>
<div class="row">
- <% if current_user %>
<div class="pull-left">
<div class="btn-group btn-group-sm">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Selection... <span class="caret"></span></button>
@@ -46,7 +45,6 @@ function unselect_all_files() {
<div class="pull-right">
<input class="form-control filterable-control" data-filterable-target="ul#collection_files" id="file_regex" name="file_regex" placeholder="filename regex" type="text"/>
</div>
- <% end %>
</div>
<p/>
<% end %>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list