1 <div class="modal-body">
3 <% uuid = @object.uuid %>
4 <% email = @object.email %>
6 <% disable_email = uuid != nil %>
7 <% identity_url_prefix = @current_selections[:identity_url_prefix] %>
8 <% disable_url_prefix = identity_url_prefix != nil %>
9 <% selected_repo = @current_selections[:repo_name] %>
10 <% selected_vm = @current_selections[:vm_uuid] %>
12 <%= form_tag setup_user_path, {id: 'setup_form', name: 'setup_form', method: 'get',
13 class: 'form-search', remote: true} do %>
14 <input id="user_uuid" maxlength="250" name="user_uuid" type="hidden" value="<%=uuid%>">
18 <% if disable_email %>
20 <td> <input id="email" maxlength="250" name="email" type="text" value="<%=email%>"
24 <td> <input id="email" maxlength="250" name="email" type="text" > </td>
28 <% if disable_url_prefix %>
29 <td> Identity URL Prefix   </td>
30 <td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text"
31 value="<%=identity_url_prefix%>" disabled=true > </td>
33 <td> Openid Prefix </td>
34 <td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text"
35 value="<%= Rails.configuration.default_openid_prefix %>"> </td>
39 <td> Repository Name </td>
40 <td> <input id="repo_name" maxlength="250" name="repo_name" type="text" value="<%=selected_repo%>">
43 <td> Virtual Machine </td>
45 <select name="vm_uuid">
47 <option value=""> Choose One: </option>
49 <option value="" selected> Choose One: </option>
51 <% @vms.each do |vm| %>
52 <% if selected_vm == vm.uuid %>
53 <option value=<%=vm.uuid%> selected> <%=vm.hostname%> </option>
55 <option value=<%=vm.uuid%> > <%=vm.hostname%> </option>
65 <button type="submit" id="register" class="btn btn-primary" autofocus>Submit</button>
66 <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Cancel</button>
72 var $input = $('input:text'),
73 $register = $('#register');
75 var email_disabled = document.forms["setup_form"]["email"].disabled;
76 var email_value = document.forms["setup_form"]["email"].value;
77 var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
78 if ((email_disabled == false) && (email_value == null || email_value == "" ||
79 prefix_value == null || prefix_value == "")) {
80 $register.attr('disabled', true);
83 $input.keyup(function() {
86 var email_disabled = document.forms["setup_form"]["email"].disabled;
87 var email_value = document.forms["setup_form"]["email"].value;
88 var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
90 var emailRegExp = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
91 var validEmail = false;
92 if (emailRegExp.test(email_value )) {
96 if ((email_disabled == false) && (!validEmail || email_value == null ||
97 email_value == "" || prefix_value == null || prefix_value == "")){
101 trigger ? $register.attr('disabled', true) : $register.removeAttr('disabled');