Collection
end
+ def show_pane_list
+ %w(Recent)
+ end
+
def find_objects_for_index
# If it's not the index rows partial display, just return
# The /index request will again be invoked to display the
trashed_items
if @objects.any?
+ @objects = @objects.sort_by { |obj| obj.created_at }.reverse
@next_page_filters = next_page_filters('<=')
@next_page_href = url_for(partial: :trash_rows,
filters: @next_page_filters.to_json)
--- /dev/null
+<%# There is no such thing %>
<colgroup>
<col width="5%" />
<col width="20%" />
+ <col width="15%" />
+ <col width="15%" />
<col width="10%" />
- <col width="10%" />
- <col width="10%" />
- <col width="40%" />
+ <col width="30%" />
<col width="5%" />
</colgroup>
-<% @objects.sort_by { |obj| obj.created_at }.reverse.each do |obj| %>
+<% @objects.each do |obj| %>
<tr data-object-uuid="<%= obj.uuid %>" data-kind="<%= obj.kind %>" >
<td>
<% if obj.editable? %>
<td>
<%= if !obj.name.blank? then obj.name else obj.uuid end %>
<td>
- <%= obj.created_at.to_s if obj.created_at %>
+ <%= render_localized_date(obj.created_at) if obj.created_at %>
<td>
- <%= obj.trash_at.to_s if obj.trash_at %>
+ <%= render_localized_date(obj.trash_at) if obj.trash_at %>
</td>
<td>
<%= link_to_if_arvados_object obj.owner_uuid, friendly_name: true %>
<%= file_path %><br />
<% end %>
<% if obj.files.length > 3 %>
- ⋮
+ <%= "(#{obj.files.length-3} more files)" %>
<% end %>
</td>
<td>
<% if object.editable? %>
- <% msg = "Un-trash '" + if !object.name.blank? then object.name else object.uuid end + "'?" %>
+ <% msg = "Untrash '" + if !object.name.blank? then object.name else object.uuid end + "'?" %>
<%= link_to({action: 'untrash_items', selection: [object.uuid]}, remote: true, method: :post,
- data: {confirm: msg}) do %>
+ title: "Untrash", data: {confirm: msg}) do %>
<i class="fa fa-fw fa-recycle"></i>
<% end %>
<% end %>
-<%= render partial: 'show_trash_items' %>
+<%= render file: 'application/index.html.erb', locals: local_assigns %>
assert_operator c.delete_at, :>=, time_before_trashing + Rails.configuration.default_trash_lifetime
end
end
+
+ test 'untrash a trashed collection' do
+ authorize_with :active
+ post :untrash, {
+ id: collections(:expired_collection).uuid,
+ }
+ assert_response 200
+ assert_equal false, json_response['is_trashed']
+ assert_nil json_response['trash_at']
+ end
+
+ test 'untrash error on not trashed collection' do
+ authorize_with :active
+ post :untrash, {
+ id: collections(:collection_owned_by_active).uuid,
+ }
+ assert_response 422
+ end
end