Merge branch '3605-node-info-field' refs #3605
[arvados.git] / apps / workbench / app / views / application / _choose.html.erb
1 <div class="modal arv-choose modal-with-loading-spinner">
2   <div class="modal-dialog" style="width:80%">
3     <div class="modal-content">
4       <div class="modal-header">
5         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
6         <h4 class="modal-title"><%= params[:title] || "Choose #{@objects.first.andand.class_for_display}" %></h4>
7       </div>
8
9       <div class="modal-body">
10         <% project_filters, chooser_filters = (params[:filters] || []).partition do |attr, op, val|
11              attr == "owner_uuid" and op == "="
12            end %>
13         <div class="input-group">
14           <% if params[:by_project].to_s != "false" %>
15             <% if project_filters.empty?
16                  selected_project_name = 'All projects'
17                else
18                  val = project_filters.last.last
19                  if val == current_user.uuid
20                    selected_project_name = "Home"
21                  else
22                    selected_project_name = Group.find(val).name rescue val
23                  end
24                end
25                %>
26             <div class="input-group-btn" data-filterable-target=".modal.arv-choose .selectable-container">
27               <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
28                 <%= selected_project_name %> <span class="caret"></span>
29               </button>
30               <ul class="dropdown-menu" role="menu">
31                 <li>
32                   <%= link_to '#', class: 'chooser-show-project' do %>
33                     All projects
34                   <% end %>
35                 </li>
36                 <li class="divider" />
37                 <%= render partial: "projects_tree_menu", locals: {
38                       :project_link_to => Proc.new do |pnode, &block|
39                         link_to "#", {
40                           class: "chooser-show-project",
41                           data: {'project_uuid' => pnode[:object].uuid},
42                         }, &block
43                       end,
44                       :top_button => nil
45                     } %>
46               </ul>
47             </div>
48           <% end %>
49           <input type="text" value="<%=params[:preconfigured_search_str] || ''%>" class="form-control filterable-control focus-on-display" placeholder="Search" data-filterable-target=".modal.arv-choose .selectable-container"/>
50         </div>
51         <div style="height: 1em" />
52
53         <% preview_pane = (params[:preview_pane].to_s != "false")
54            pane_col_class = preview_pane ? "col-md-6" : "col-md-12" %>
55         <div class="row" style="height: 20em">
56           <div class="<%= pane_col_class %> arv-filterable-list selectable-container <%= 'multiple' if multiple %>"
57                style="height: 100%; overflow-y: scroll"
58                data-infinite-scroller="#choose-scroll"
59                id="choose-scroll"
60                data-infinite-content-params-from-chooser="<%= {filters: chooser_filters}.to_json %>"
61                <% if project_filters.any? %>
62                  data-infinite-content-params-from-project-dropdown="<%= {filters: project_filters, project_uuid: project_filters.last.last}.to_json %>"
63                <% end %>
64                data-infinite-content-href="<%= url_for partial: true %>">
65           </div>
66           <% if preview_pane %>
67             <div class="col-md-6 hidden-xs hidden-sm modal-dialog-preview-pane" style="height: 100%; overflow-y: scroll">
68             </div>
69           <% end %>
70         </div>
71
72         <div class="modal-footer">
73           <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
74           <button class="btn btn-primary" aria-hidden="true" data-enable-if-selection disabled><%= raw(params[:action_name]) || 'Select' %></button>
75           <div class="modal-error hide" style="text-align: left; margin-top: 1em;">
76           </div>
77         </div>
78       </div>
79     </div>
80   </div>
81 </div>