[ARVADOS] created: aff3c1ad491cf4ce7fe7912eaf17c1109d35faf6
git at public.curoverse.com
git at public.curoverse.com
Thu Sep 11 09:37:25 EDT 2014
at aff3c1ad491cf4ce7fe7912eaf17c1109d35faf6 (commit)
commit aff3c1ad491cf4ce7fe7912eaf17c1109d35faf6
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date: Thu Sep 11 09:37:07 2014 -0400
3661: tentative implementation of Capybara "best practice" of using that class's reset_sessions! in the teardown
diff --git a/apps/workbench/test/integration_helper.rb b/apps/workbench/test/integration_helper.rb
index 81ea67c..febcfcf 100644
--- a/apps/workbench/test/integration_helper.rb
+++ b/apps/workbench/test/integration_helper.rb
@@ -25,11 +25,6 @@ class ActionDispatch::IntegrationTest
@@API_AUTHS = self.api_fixture('api_client_authorizations')
- def setup
- reset_session!
- super
- end
-
def page_with_token(token, path='/')
# Generate a page path with an embedded API token.
# Typical usage: visit page_with_token('token_name', page)
@@ -74,5 +69,6 @@ class ActionDispatch::IntegrationTest
if Capybara.current_driver == :selenium
page.execute_script("window.localStorage.clear()")
end
+ Capybara.reset_sessions!
end
end
commit ec48719c7de0d18772b811645956fab87ce14bff
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date: Thu Sep 11 09:35:27 2014 -0400
3661: Add a new test that ensures that the new "Copy to project" button works for collections
diff --git a/apps/workbench/test/integration/collections_test.rb b/apps/workbench/test/integration/collections_test.rb
index ac2625a..c64947b 100644
--- a/apps/workbench/test/integration/collections_test.rb
+++ b/apps/workbench/test/integration/collections_test.rb
@@ -3,6 +3,27 @@ require 'selenium-webdriver'
require 'headless'
class CollectionsTest < ActionDispatch::IntegrationTest
+ setup do
+ Capybara.current_driver = :rack_test
+ end
+
+ test "Can copy a collection to a project" do
+ Capybara.current_driver = Capybara.javascript_driver
+
+ collection_uuid = api_fixture('collections')['foo_file']['uuid']
+ collection_name = api_fixture('collections')['foo_file']['name']
+ project_uuid = api_fixture('groups')['aproject']['uuid']
+ project_name = api_fixture('groups')['aproject']['name']
+ visit page_with_token('active', "/collections/#{collection_uuid}")
+ click_link 'Copy to project...'
+ find('.selectable', text: project_name).click
+ find('.modal-footer a,button', text: 'Copy').click
+ wait_for_ajax
+ # It should navigate to the project after copying...
+ assert(page.has_text?(project_name))
+ assert(page.has_text?("Copy of #{collection_name}"))
+ end
+
test "Collection page renders name" do
uuid = api_fixture('collections')['foo_file']['uuid']
coll_name = api_fixture('collections')['foo_file']['name']
@@ -14,8 +35,6 @@ class CollectionsTest < ActionDispatch::IntegrationTest
end
test "can download an entire collection with a reader token" do
- Capybara.current_driver = :rack_test
-
uuid = api_fixture('collections')['foo_file']['uuid']
token = api_fixture('api_client_authorizations')['active_all_collections']['api_token']
url_head = "/collections/download/#{uuid}/#{token}/"
commit c2a7a5a0e1a89d10d286e060374ad9e1b83a24c7
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date: Wed Sep 10 14:11:12 2014 -0400
3661: make existing tests pass
diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb
index 100f3bb..3df911a 100644
--- a/apps/workbench/test/integration/projects_test.rb
+++ b/apps/workbench/test/integration/projects_test.rb
@@ -155,7 +155,7 @@ class ProjectsTest < ActionDispatch::IntegrationTest
end
wait_for_ajax
- click_link 'Move project...'
+ click_link 'Move to project...'
find('.selectable', text: 'Project 1234').click
find('.modal-footer a,button', text: 'Move').click
wait_for_ajax
commit 9126da70d57cdd32938c4b3814fedf2bd1f1db93
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date: Wed Sep 10 12:48:54 2014 -0400
3661: Added buttons for Copy and Move to the general #show page, showing them if the model class #goes_in_projects?
diff --git a/apps/workbench/app/views/application/show.html.erb b/apps/workbench/app/views/application/show.html.erb
index 490e7e4..264e019 100644
--- a/apps/workbench/app/views/application/show.html.erb
+++ b/apps/workbench/app/views/application/show.html.erb
@@ -6,6 +6,43 @@
<% content_for :content_top do %>
+<% if @object.class.goes_in_projects? && @object.uuid != current_user.uuid # Not the "Home" project %>
+ <% content_for :tab_line_buttons do %>
+ <%= link_to(
+ choose_projects_path(
+ title: 'Copy to project...',
+ action_name: 'Copy',
+ action_href: actions_path,
+ action_method: 'post',
+ action_data: {
+ copy_selections_into_project: true,
+ selection: @name_link.andand.uuid || @object.uuid,
+ selection_param: 'uuid',
+ success: 'redirect-to-created-object'
+ }.to_json),
+ { class: "btn btn-sm btn-primary", remote: true, method: 'get' }) do %>
+ <i class="fa fa-fw fa-copy"></i> Copy to project...
+ <% end %>
+ <% if @object.owner_uuid == current_user.uuid or (Group.find(@object.owner_uuid).writable_by.include?(current_user.uuid) rescue nil) %>
+ <%= link_to(
+ choose_projects_path(
+ title: 'Move to project...',
+ action_name: 'Move',
+ action_href: actions_path,
+ action_method: 'post',
+ action_data: {
+ move_selections_into_project: true,
+ selection: @name_link.andand.uuid || @object.uuid,
+ selection_param: 'uuid',
+ success: 'redirect-to-created-object'
+ }.to_json),
+ { class: "btn btn-sm btn-primary", remote: true, method: 'get' }) do %>
+ <i class="fa fa-fw fa-truck"></i> Move to project...
+ <% end %>
+ <% end %>
+ <% end %>
+<% end %>
+
<% if @object.respond_to? :properties and !@object.properties.nil? %>
<% if @object.properties[:page_content] %>
<% content_for :page_content do %>
diff --git a/apps/workbench/app/views/collections/show.html.erb b/apps/workbench/app/views/collections/show.html.erb
index 94b099a..41458f7 100644
--- a/apps/workbench/app/views/collections/show.html.erb
+++ b/apps/workbench/app/views/collections/show.html.erb
@@ -1,21 +1,3 @@
-<% content_for :tab_line_buttons do %>
- <%= link_to(
- choose_projects_path(
- title: 'Copy to project...',
- action_name: 'Copy',
- action_href: actions_path,
- action_method: 'post',
- action_data: {
- copy_selections_into_project: true,
- selection: @name_link.andand.uuid || @object.uuid,
- selection_param: 'uuid',
- success: 'redirect-to-created-object'
- }.to_json),
- { class: "btn btn-sm btn-primary arv-move-to-project", remote: true, method: 'get' }) do %>
- <i class="fa fa-fw fa-copy"></i> Copy to project...
- <% end %>
-<% end %>
-
<div class="row row-fill-height">
<div class="col-md-6">
<div class="panel panel-info">
diff --git a/apps/workbench/app/views/projects/show.html.erb b/apps/workbench/app/views/projects/show.html.erb
index 2551760..a67f2ad 100644
--- a/apps/workbench/app/views/projects/show.html.erb
+++ b/apps/workbench/app/views/projects/show.html.erb
@@ -40,24 +40,6 @@
Add a subproject
<% end %>
<% end %>
- <% if @object.owner_uuid == current_user.uuid or (Group.find(@object.owner_uuid).writable_by.include?(current_user.uuid) rescue nil) %>
- <% if @object.uuid != current_user.uuid # Not the "Home" project %>
- <%= link_to(
- choose_projects_path(
- title: 'Move this project to...',
- editable: true,
- action_name: 'Move',
- action_href: project_path(@object.uuid),
- action_method: 'put',
- action_data: {selection_param: 'project[owner_uuid]', success: 'page-refresh'}.to_json),
- { class: "btn btn-sm btn-primary arv-move-to-project", remote: true, method: 'get' }) do %>
- <i class="fa fa-fw fa-truck"></i> Move project...
- <% end %>
- <%= link_to(project_path(id: @object.uuid), method: 'delete', class: 'btn btn-sm btn-primary', data: {confirm: "Really delete project '#{@object.name}'?"}) do %>
- <i class="fa fa-fw fa-trash-o"></i> Delete project
- <% end %>
- <% end %>
- <% end %>
<% end %>
<%= render file: 'application/show.html.erb', locals: local_assigns %>
diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 1138bd2..4ef62c9 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -205,6 +205,12 @@ class ArvadosModel < ActiveRecord::Base
head_uuid: target_uuid).any?
end
+ # can this class of object go into a project?
+ # default to false, override to true on individual model classes
+ def self.goes_in_projects?
+ false
+ end
+
protected
def ensure_ownership_path_leads_to_user
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list