closes #9587
[arvados.git] / apps / workbench / app / views / projects / _choose.html.erb
1 <div class="modal modal-with-loading-spinner">
2   <div class="modal-dialog">
3     <div class="modal-content">
4
5       <div class="modal-header">
6         <button type="button" class="close" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">&times;</button>
7         <div>
8           <div class="col-sm-6"> <h4 class="modal-title"><%= params[:title] || 'Choose project' %></h4> </div>
9           <div class="spinner spinner-32px spinner-h-center col-sm-1" hidden="true"></div>
10         </div>
11         <br/>
12       </div>
13
14       <div class="modal-body">
15         <div class="selectable-container" style="height: 15em; overflow-y: scroll">
16           <% starred_projects = my_starred_projects current_user%>
17           <% if starred_projects.andand.any? %>
18             <% writable_projects = starred_projects.select(&:editable?) %>
19             <% writable_projects.each do |projectnode| %>
20               <% row_name = projectnode.friendly_link_name || 'New project' %>
21               <div class="selectable project row"
22                    style="padding-left: 1em; margin-right: 0px"
23                    data-object-uuid="<%= projectnode.uuid %>">
24                 <i class="fa fa-fw fa-folder-o"></i> <%= row_name %> <i class="fa fa-fw fa-star"></i>
25               </div>
26             <% end %>
27           <% end %>
28
29           <% my_projects = my_wanted_projects_tree(current_user) %>
30           <% my_projects[0].each do |projectnode| %>
31             <% if projectnode[:object].uuid == current_user.uuid
32                  row_name = "Home"
33                else
34                  row_name = projectnode[:object].friendly_link_name || 'New project'
35                end %>
36             <div class="selectable project row"
37                  style="padding-left: <%= 1 + projectnode[:depth] %>em; margin-right: 0px"
38                  data-object-uuid="<%= projectnode[:object].uuid %>">
39               <i class="fa fa-fw fa-folder-o"></i> <%= row_name %>
40             </div>
41           <% end %>
42         </div>
43
44         <% if my_projects[1] or my_projects[2] or my_projects[0].size > 200 %>
45           <div>Some of your projects are omitted. Add projects of interest to favorites.</div>
46         <% end %>
47       </div>
48
49       <div class="modal-footer">
50         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
51         <button class="btn btn-primary" aria-hidden="true" data-enable-if-selection disabled><%= params[:action_name] || 'Select' %></button>
52         <div class="modal-error hide" style="text-align: left; margin-top: 1em;">
53         </div>
54       </div>
55     </div>
56   </div>
57 </div>