Add "remove item from folder" buttons
[arvados.git] / apps / workbench / app / controllers / folders_controller.rb
index 43b6f407b877a3c583e2cf41781c6b23038aa7ef..0a7f0f9e1e7cf063c4ee46a4f673ee9d8eb3db44 100644 (file)
@@ -7,6 +7,10 @@ class FoldersController < ApplicationController
     %w(My_folders Shared_with_me)
   end
 
+  def remove_item
+    raise "Not implemented yet!"
+  end
+
   def index
     @my_folders = []
     @shared_with_me = []
@@ -35,6 +39,7 @@ class FoldersController < ApplicationController
         @shared_with_me << folder
       end
     end
+    @object
   end
 
   def show
@@ -42,6 +47,22 @@ class FoldersController < ApplicationController
     @share_links = Link.filter([['head_uuid', '=', @object.uuid],
                                 ['link_class', '=', 'permission']])
     @logs = Log.limit(10).filter([['object_uuid', '=', @object.uuid]])
+
+    @objects_and_names = []
+    @objects.each do |object|
+      if !(name_links = @objects.links_for(object, 'name')).empty?
+        name_links.each do |name_link|
+          @objects_and_names << [object, name_link]
+        end
+      else
+        @objects_and_names << [object,
+                               Link.new(tail_uuid: @object.uuid,
+                                        head_uuid: object.uuid,
+                                        link_class: "name",
+                                        name: "")]
+      end
+    end
+
     super
   end