7453: Disable submit button in add group dialog until a name is entered.
[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.resource_class.andand.class_for_display}" %></h4>
7       </div>
8
9       <div class="modal-body">
10         <% if params[:message].present? %>
11           <p> <%= params[:message] %> </p>
12         <% end %>
13
14         <% project_filters, chooser_filters = (params[:filters] || []).partition do |attr, op, val|
15              attr == "owner_uuid" and op == "="
16            end %>
17         <div class="input-group">
18           <% if params[:by_project].to_s != "false" %>
19             <% if project_filters.empty?
20                  selected_project_name = 'All projects'
21                else
22                  val = project_filters.last.last
23                  if val == current_user.uuid
24                    selected_project_name = "Home"
25                  else
26                    selected_project_name = Group.find(val).name rescue val
27                  end
28                end
29                %>
30             <div class="input-group-btn" data-filterable-target=".modal.arv-choose .selectable-container">
31               <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
32                 <%= selected_project_name %> <span class="caret"></span>
33               </button>
34               <ul class="dropdown-menu" role="menu">
35                 <li>
36                   <%= link_to '#', class: 'chooser-show-project' do %>
37                     All projects
38                   <% end %>
39                 </li>
40                 <li class="divider" />
41                 <%= render partial: "projects_tree_menu", locals: {
42                       :project_link_to => Proc.new do |pnode, &block|
43                         link_to "#", {
44                           class: "chooser-show-project",
45                           data: {'project_uuid' => pnode[:object].uuid},
46                         }, &block
47                       end,
48                       :top_button => nil
49                     } %>
50               </ul>
51             </div>
52           <% end %>
53           <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"/>
54         </div>
55         <div style="height: 1em" />
56
57         <% preview_pane = (params[:preview_pane].to_s != "false") %>
58         <div class="row" style="height: 20em">
59           <div class="<%= 'col-sm-6' if preview_pane %> col-xs-12 arv-filterable-list selectable-container <%= 'multiple' if multiple %>"
60                style="height: 100%; overflow-y: scroll"
61                data-infinite-scroller="#choose-scroll"
62                id="choose-scroll"
63                data-infinite-content-params-from-chooser="<%= {filters: chooser_filters}.to_json %>"
64                <% if project_filters.any? %>
65                  data-infinite-content-params-from-project-dropdown="<%= {filters: project_filters, project_uuid: project_filters.last.last}.to_json %>"
66                <% end %>
67                <%
68                   action_data = JSON.parse params['action_data'] if params['action_data']
69                   use_preview_sel = action_data ? action_data['use_preview_selection'] : false
70                 %>
71                data-infinite-content-href="<%= url_for partial: true,
72                                                        use_preview_selection: use_preview_sel %>">
73           </div>
74           <% if preview_pane %>
75             <div class="col-sm-6 col-xs-12 modal-dialog-preview-pane" style="height: 100%; overflow-y: scroll">
76             </div>
77           <% end %>
78         </div>
79
80         <div class="modal-footer">
81           <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
82           <button class="btn btn-primary" aria-hidden="true" data-enable-if-selection disabled><%= raw(params[:action_name]) || 'Select' %></button>
83           <div class="modal-error hide" style="text-align: left; margin-top: 1em;">
84           </div>
85         </div>
86       </div>
87     </div>
88   </div>
89 </div>