X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0728458bfd4236fbcfe42a59ccd58754de026bb4..c592f178659ed5ebfd03720a02940daa62931d14:/apps/workbench/app/controllers/application_controller.rb diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 9438da3fb6..1fc15807c9 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -94,7 +94,10 @@ class ApplicationController < ActionController::Base # Fall back to the default-setting code later. end end + @starred_projects ||= [] @my_wanted_projects_tree ||= [] + @my_project_tree ||= [] + @shared_project_tree ||= [] render_error(err_opts) end @@ -443,6 +446,15 @@ class ApplicationController < ActionController::Base end end + helper_method :is_starred + def is_starred + links = Link.where(tail_uuid: current_user.uuid, + head_uuid: @object.uuid, + link_class: 'star') + + return links.andand.any? + end + protected helper_method :strip_token_from_path @@ -832,6 +844,17 @@ class ApplicationController < ActionController::Base {collections: c, owners: own} end + helper_method :my_starred_projects + def my_starred_projects user + return if @starred_projects + links = Link.filter([['tail_uuid', '=', user.uuid], + ['link_class', '=', 'star'], + ['head_uuid', 'is_a', 'arvados#group']]).select(%w(head_uuid)) + uuids =links.collect { |x| x.head_uuid } + starred_projects = Group.filter([['uuid', 'in', uuids]]).order('name') + @starred_projects = starred_projects.results + end + # If there are more than 200 projects that are readable by the user, # build the tree using only the top 200+ projects owned by the user, # from the top three levels.