3140: add additional content tabs to pane list
[arvados.git] / apps / workbench / app / controllers / projects_controller.rb
index cd32c65e17624fa2c7fd4aed8bed3b026a701b6c..1a062f24e8b32fa0f4128556efa86f82b5710f47 100644 (file)
@@ -8,7 +8,7 @@ class ProjectsController < ApplicationController
   end
 
   def show_pane_list
-    %w(Contents Permissions Advanced)
+    %w(Data_collections Jobs_and_pipelines Pipeline_templates Subprojects Permissions Advanced)
   end
 
   def remove_item
@@ -60,49 +60,17 @@ class ProjectsController < ApplicationController
         object.update_attributes! owner_uuid: current_user.uuid
       end
     end
+    if ArvadosBase::resource_class_for_uuid(@object.owner_uuid) == Group
+      params[:return_to] ||= group_path(@object.owner_uuid)
+    else
+      params[:return_to] ||= projects_path
+    end
     super
   end
 
   def find_objects_for_index
-    @objects = Group.
-      filter([['group_class','in',['project','folder']]]).
-      order('name')
+    @objects = all_projects
     super
-    parent_of = {current_user.uuid => 'me'}
-    @objects.each do |ob|
-      parent_of[ob.uuid] = ob.owner_uuid
-    end
-    children_of = {false => [], 'me' => [current_user]}
-    @objects.each do |ob|
-      if ob.owner_uuid != current_user.uuid and
-          not parent_of.has_key? ob.owner_uuid
-        parent_of[ob.uuid] = false
-      end
-      children_of[parent_of[ob.uuid]] ||= []
-      children_of[parent_of[ob.uuid]] << ob
-    end
-    buildtree = lambda do |children_of, root_uuid=false|
-      tree = {}
-      children_of[root_uuid].andand.each do |ob|
-        tree[ob] = buildtree.call(children_of, ob.uuid)
-      end
-      tree
-    end
-    sorted_paths = lambda do |tree, depth=0|
-      paths = []
-      tree.keys.sort_by { |ob|
-        ob.is_a?(String) ? ob : ob.friendly_link_name
-      }.each do |ob|
-        paths << {object: ob, depth: depth}
-        paths += sorted_paths.call tree[ob], depth+1
-      end
-      paths
-    end
-    @my_project_tree =
-      sorted_paths.call buildtree.call(children_of, 'me')
-    @shared_project_tree =
-      sorted_paths.call({'Shared with me' =>
-                          buildtree.call(children_of, false)})
   end
 
   def show