Make "create folder" button work
[arvados.git] / apps / workbench / app / controllers / groups_controller.rb
1 class GroupsController < ApplicationController
2   def model_class_for_display
3     params[:group_class] || super
4   end
5
6   def index
7     if params[:group_class]
8       @groups = Group.where(group_class: params[:group_class])
9     else
10       @groups = Group.all
11     end
12     @group_uuids = @groups.collect &:uuid
13     @links_from = Link.where link_class: 'permission', tail_uuid: @group_uuids
14     @links_to = Link.where link_class: 'permission', head_uuid: @group_uuids
15   end
16
17   def show
18     @objects = @object.contents include_linked: true
19     super
20   end
21
22   def create
23     # params[:group_class]=='folder' if we were routed through /folders
24     logger.error params.inspect
25     if (rsc = params[:group_class])
26       params['group'] = (params[rsc] || {}).merge(group_class: rsc)
27     end
28     super
29   end
30 end