3 [@users, @groups].each do |obj_list|
4 obj_list.each { |o| uuid_map[o.uuid] = o }
6 perm_name_desc_map = {}
7 perm_desc_name_map = {}
9 ['Read', 'Write', 'Manage'].each do |link_desc|
10 link_name = "can_#{link_desc.downcase}"
11 perm_name_desc_map[link_name] = link_desc
12 perm_desc_name_map[link_desc] = link_name
13 perms_json << {value: link_name, text: link_desc}
15 perms_json = perms_json.to_json
16 owner_icon = fa_icon_class_for_uuid(@object.owner_uuid)
17 if owner_icon == "fa-users"
18 owner_icon = "fa-folder"
19 owner_type = "parent project"
21 owner_type = "owning user"
25 <div class="pull-right">
26 <% ["users", "groups"].each do |share_class| %>
28 <%= link_to(send("choose_#{share_class}_path",
29 title: "Share with #{share_class}",
33 action_method: 'post',
34 action_href: share_with_project_path,
36 action_data: {selection_param: 'uuids[]', success: 'tab-refresh'}.to_json),
37 class: "btn btn-primary btn-sm", remote: true, method: 'get') do %>
38 <i class="fa fa-fw fa-plus"></i> Share with <%= share_class %>…
44 <p>Permissions for this project are inherited from the <%= owner_type %>
45 <i class="fa fa-fw <%= owner_icon %>"></i>
46 <%= link_to_if_arvados_object @object.owner_uuid, friendly_name: true %>.
49 <table id="project_sharing" class="topalign table" style="clear: both; margin-top: 1em;">
51 <th>User/Group Name</th>
52 <th colspan="2">Project Access</th>
55 <% @share_links.andand.each do |link|
56 shared_with = uuid_map[link.tail_uuid]
58 link_name = link.tail_uuid
59 elsif shared_with.respond_to?(:full_name)
60 link_name = shared_with.full_name
62 link_name = shared_with.name
64 <tr data-object-uuid="<%= link.uuid %>">
66 <i class="fa fa-fw <%= fa_icon_class_for_uuid(link.tail_uuid) %>"></i>
67 <%= link_to_if_arvados_object(link.tail_uuid, link_text: link_name) %>
69 <td><%= link_to perm_name_desc_map[link.name], '#', {
70 "data-emptytext" => "Read",
71 "data-placement" => "bottom",
72 "data-type" => "select",
73 "data-url" => url_for(action: "update", id: link.uuid, controller: "links", merge: true),
74 "data-title" => "Set #{link_name}'s access level",
75 "data-name" => "[name]",
76 "data-pk" => {id: link.tail_uuid, key: "link"}.to_json,
77 "data-value" => link.name,
78 "data-clear" => false,
79 "data-source" => perms_json,
80 "data-tpl" => "<select id=\"share_change_level\"></select>",
81 "class" => "editable form-control",
86 {action: 'destroy', id: link.uuid, controller: "links"},
87 {title: 'Revoke', class: 'btn btn-default btn-nodecorate', method: :delete,
88 data: {confirm: "Revoke #{link_name}'s access to this project?",
90 <i class="fa fa-fw fa-trash-o"></i>