-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy path_edit_form.html.erb
108 lines (91 loc) · 4.34 KB
/
_edit_form.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<div style="padding:10px;">
<%= form_for @user, :url => {:controller => 'users', :action => 'update'}, :html => {:class => "row",:id => 'edit-form' } do |f| %>
<%= hidden_field_tag "user[ui_update]", "true" %>
<div class="col-md-10">
<% if f.error_messages != "" %>
<div class="alert alert-danger"><%= f.error_messages %></div>
<% end %>
<div class='col-md-12' style="display:flex; justify-content: center;">
<h3> Link your Public Lab account to providers </h3>
</div>
<div class='col-md-12' style="display:flex; justify-content: center;">
<%= render :partial => "layouts/social_icons" %>
</div>
<br style="clear:both;"/>
<div class="row">
<div class="form-group col-md-6">
<label for="username"><%= translation('users._form.username') %></label>
<%= f.text_field :username, { readonly: true, tabindex: 1, placeholder: "Username", class: 'form-control', id: 'username' , title: 'Username field cannot be changed', disabled: true} %>
<input type="hidden" name="id" value="<%= @user.username %>" />
</div>
<div class="form-group col-md-6">
<label for="email"><%= translation('users._form.email') %></label>
<%= f.text_field :email, { tabindex: 3, required: true, placeholder: "[email protected]", class: 'form-control', id: 'email'} %>
</div>
</div>
<div class="form-group">
<label for="current_password"><%= translation('users._form.current_password') %></label>
<%= f.password_field :current_password, { placeholder: "Type your current password for verification",
tabindex: 4,
class: 'form-control',
id: 'current-password' }
%>
</div>
<div class="row">
<div class="form-group col-md-6">
<% if @user.crypted_password.nil? %>
<label for="password"><%= translation('users._form.create_password') %></label>
<% else %>
<label for="password"><%= translation('users._form.change_password') %></label>
<% end %>
<%= f.password_field :password, { placeholder: "Enter your new password",
tabindex: 5,
class: 'form-control',
id: 'password1',
onpaste: 'return false;' }
%>
</div>
<div class="form-group col-md-6">
<label for="password_confirmation"><%= translation('users._form.password_confirmation') %></label>
<%= f.password_field :password_confirmation, { placeholder: I18n.t('users._form.confirm_password'),
tabindex: 6,
class: 'form-control',
id: 'password-confirmation',
onpaste: 'return false;' }
%>
</div>
</div>
<div class="form-group">
<label for="user_bio"><%= translation('users._form.bio') %></label>
<%= f.text_area :bio, { placeholder: I18n.t('users._form.add_bio'),
rows: 8,
class: 'form-control',
tabindex: 7 }
%>
</div>
<div class="form-group form-inline" style="clear:both;padding-top:10px;">
<!-- button for saving edits for existing users -->
<button class="btn btn-lg btn-primary btn-save" type="submit" tabindex="8"><%= translation('users._form.save') %></button>
<script>
(function() {
$('.btn-save').click(function onClick(e) {
if(document.form.email.text_field != "" && document.form.email.pattern == '[^@]+@[^@]+\.[a-zA-Z]{2,6}')
{
$(this).addClass("disabled") // disable the button after it is clicked
.html("<i class='fa fa-spinner fa-spin'></i>"); // make a spinner that spins when clicked
}
})
})();
</script>
</div>
</div>
<div class="col-md-2">
<%= render :partial => 'users/photo' %>
</div>
<% end %>
</div>
<style>
.error {
color: #D34836;
}
</style>