[ARVADOS] updated: 741a9b3912c382b25507ca76fae15ddac020f302
Git user
git at public.curoverse.com
Wed May 31 13:33:42 EDT 2017
Summary of changes:
apps/workbench/app/assets/javascripts/selection.js.erb | 4 ++++
apps/workbench/app/controllers/trash_items_controller.rb | 13 ++++---------
.../app/views/trash_items/_show_trash_items.html.erb | 6 ++++--
apps/workbench/app/views/trash_items/_untrash_item.html.erb | 2 +-
.../{untrashed_items.js.erb => untrash_items.js.erb} | 1 -
apps/workbench/config/routes.rb | 1 -
6 files changed, 13 insertions(+), 14 deletions(-)
rename apps/workbench/app/views/trash_items/{untrashed_items.js.erb => untrash_items.js.erb} (78%)
via 741a9b3912c382b25507ca76fae15ddac020f302 (commit)
from 1cdeb90e271f2a0c50d3552ff702b8e6f9489c74 (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 741a9b3912c382b25507ca76fae15ddac020f302
Author: radhika <radhika at curoverse.com>
Date: Wed May 31 13:33:19 2017 -0400
9587: untrash option
diff --git a/apps/workbench/app/assets/javascripts/selection.js.erb b/apps/workbench/app/assets/javascripts/selection.js.erb
index f60bef7..a8e2738 100644
--- a/apps/workbench/app/assets/javascripts/selection.js.erb
+++ b/apps/workbench/app/assets/javascripts/selection.js.erb
@@ -81,6 +81,10 @@ function enable_disable_selection_actions() {
toggleClass('disabled',
($checked.length < 0) ||
!($checked.length > 0 && collection_lock_classes && collection_lock_classes.indexOf("fa-unlock") !=-1));
+ $('[data-selection-action=untrash-selected-items]', $container).
+ closest('li').
+ toggleClass('disabled',
+ ($checked.length < 1));
}
$(document).
diff --git a/apps/workbench/app/controllers/trash_items_controller.rb b/apps/workbench/app/controllers/trash_items_controller.rb
index 17d3340..5190474 100644
--- a/apps/workbench/app/controllers/trash_items_controller.rb
+++ b/apps/workbench/app/controllers/trash_items_controller.rb
@@ -72,23 +72,18 @@ class TrashItemsController < ApplicationController
@request_url = request.url
end
- def untrash_item
- params[:item_uuids] = [params[:item_uuid]]
- untrash_items
- render template: 'untrash_items'
- end
-
def untrash_items
@untrashed_uuids = []
updates = {trash_at: nil}
- #updates[:trash_at] = nil
- params[:item_uuids].collect { |uuid| ArvadosBase.find uuid }.each do |item|
+ params[:selection].collect { |uuid| ArvadosBase.find uuid }.each do |item|
item.update_attributes updates
@untrashed_uuids << item.uuid
end
- render_template :untrashed_items
+ respond_to do |format|
+ format.js
+ end
end
end
diff --git a/apps/workbench/app/views/trash_items/_show_trash_items.html.erb b/apps/workbench/app/views/trash_items/_show_trash_items.html.erb
index 2b777fa..dc615fc 100644
--- a/apps/workbench/app/views/trash_items/_show_trash_items.html.erb
+++ b/apps/workbench/app/views/trash_items/_show_trash_items.html.erb
@@ -1,13 +1,15 @@
-<div class="container">
+<div class="container selection-action-container">
<div class="col-md-6 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 "Un-trash selected items", '#',
method: :post,
+ remote: true,
+ 'id' => 'untrash_selected_items',
'data-href' => untrash_items_trash_items_path,
'data-selection-param-name' => 'selection[]',
- 'data-selection-action' => 'untrash-items',
+ 'data-selection-action' => 'untrash-selected-items',
'data-toggle' => 'dropdown'
%></li>
</ul>
diff --git a/apps/workbench/app/views/trash_items/_untrash_item.html.erb b/apps/workbench/app/views/trash_items/_untrash_item.html.erb
index 7fd7af7..a40a4be 100644
--- a/apps/workbench/app/views/trash_items/_untrash_item.html.erb
+++ b/apps/workbench/app/views/trash_items/_untrash_item.html.erb
@@ -1,5 +1,5 @@
<% if object.editable? %>
- <%= link_to({action: 'untrash_item', id: object.uuid}, remote: true, data: {confirm: "Un-trash #{object.class_for_display.downcase} '#{object.friendly_link_name}'?"}) do %>
+ <%= link_to({action: 'untrash_items', selection: [object.uuid]}, remote: true, method: :post, data: {confirm: "Un-trash #{object.class_for_display.downcase} '#{object.friendly_link_name}'?"}) do %>
<i class="fa fa-fw fa-recycle"></i>
<% end %>
<% end %>
diff --git a/apps/workbench/app/views/trash_items/untrashed_items.js.erb b/apps/workbench/app/views/trash_items/untrash_items.js.erb
similarity index 78%
rename from apps/workbench/app/views/trash_items/untrashed_items.js.erb
rename to apps/workbench/app/views/trash_items/untrash_items.js.erb
index 6d79aca..3d26658 100644
--- a/apps/workbench/app/views/trash_items/untrashed_items.js.erb
+++ b/apps/workbench/app/views/trash_items/untrash_items.js.erb
@@ -1,4 +1,3 @@
-$(document).trigger('count-change');
<% @untrashed_uuids.each do |uuid| %>
$('[data-object-uuid=<%= uuid %>]').hide('slow', function() {
$(this).remove();
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 8ac726c..badb471 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -110,7 +110,6 @@ ArvadosWorkbench::Application.routes.draw do
get "trash" => 'trash_items#index', :as => :trash
resources :trash_items do
- post 'untrash_item', on: :member
post 'untrash_items', on: :collection
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list