-
-
Notifications
You must be signed in to change notification settings - Fork 541
Expand file tree
/
Copy pathedit.html.erb
More file actions
184 lines (164 loc) · 8.12 KB
/
Copy pathedit.html.erb
File metadata and controls
184 lines (164 loc) · 8.12 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<div class="title-wrapper pt-30">
<div class="row align-items-center">
<div class="col-lg-12">
<div class="title mb-30">
<h1>Edit Profile</h1>
</div>
<div>
<p><strong><%= @user.email%>: confirmed</strong> </p>
</div>
<div>
<h5> Old emails: </h5>
<% @user.old_emails.each do | user | %>
<p> <%=user%> </p >
<% end %>
</div>
</div>
<div class="col-lg-12">
<div class="card-style mb-30">
<div class="card-body">
<%= form_with(model: @user, scope: :user, url: users_path, method: :patch) do |form| %>
<div class="mb-30">
<%= render "/shared/error_messages", resource: @user %>
</div>
<div class="input-style-1">
<%= form.label :display_name, "Display name" %>
<%= form.text_field :display_name, class: "form-control" %>
</div>
<div class="input-style-1">
<%= form.label :phone_number, "Phone number" %>
<%= form.text_field :phone_number, class: "form-control" %>
</div>
<div class="input-style-1">
<%= form.label :date_of_birth, "Date of birth" %>
<%= form.date_field :date_of_birth,
value: @user.date_of_birth,
class: "form-control label-font-weight" %>
</div>
<% if current_user.address %>
<% address = current_user.address %>
<% else %>
<% address = Address.new %>
<% end %>
<div class="input-style-1">
<%= form.fields_for :address, address do |f| %>
<%= f.label :content, "Address" %>
<%= f.text_field :content, class: "form-control" %>
<% end %>
</div>
<%= form.hidden_field :casa_org_id, value: current_user.casa_org_id %>
<%= render "edit_profile", resource: current_user %>
<br>
<div class="actions" id="accordionExample">
<%= form.button "Update Profile", type: "submit", class: "main-btn primary-btn btn-hover mb-3" %>
<button class="main-btn primary-btn btn-hover accordion mb-3" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Change Password
</button>
<button class="main-btn primary-btn btn-hover accordion mb-3" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo">
Change Email
</button>
<% if policy(CasaAdmin).see_deactivate_option? %>
<% if @active_casa_admins.length > 1 %>
<%= link_to "Deactivate",
deactivate_casa_admin_path(current_user),
method: :patch,
class: "btn btn-outline-danger mb-3",
data: {confirm: "WARNING: Marking an admin inactive will make them unable to login. Are you sure you want to do this?"} %>
<% else %>
<%= link_to "Deactivate",
"#",
class: "main-btn danger-btn-outline btn-hover mb-3",
data: {confirm: "Contact your administrator at Ruby For Good to deactivate this account."} %>
<% end %>
<% end %>
<% end %>
<div class="accordionGroup">
<div id="collapseOne" class="collapse" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
<br>
<%= form_with(model: @user, scope: :user, url: {action: "update_password"}, method: :patch) do |f| %>
<div class="input-style-1">
<%= f.label :current_password, "Current Password" %><br>
<%= f.password_field :current_password, autocomplete: "off", class: "form-control" %>
</div>
<div class="input-style-1">
<%= f.label :password, "New Password" %><br>
<%= f.password_field :password, autocomplete: "off", class: "form-control password-new",
minlength: User.password_length.min %>
</div>
<div class="input-style-1">
<%= f.label :password_confirmation, "New Password Confirmation" %><br>
<%= f.password_field :password_confirmation, class: "form-control password-confirmation",
minlength: User.password_length.min %>
</div>
<div class="actions mb-10">
<%= f.submit "Update Password", class: "btn btn-danger submit-password" %>
</div>
<% end %>
</div>
<div id="collapseTwo" class="collapse" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
<br>
<%= turbo_frame_tag "form" do %>
<%= form_with(model: @user, scope: :user, url: {action: "update_email"}, method: :patch, data: {turbo_frame: true}) do |f| %>
<div class="input-style-1">
<%= f.label :current_password, "Current Password" %><br>
<%= f.password_field :current_password, autocomplete: "off", class: "form-control", id: "current_password_email", required: true %>
</div>
<div class="input-style-1">
<%= f.label :email, "New Email" %><br>
<%= f.text_field :email, type: "email", class: "form-control email-new", autocomplete: "off", value: nil, required: true %>
</div>
<div class="actions mb-10">
<%= f.submit "Update Email", class: "btn btn-danger submit-email" %>
</div>
<% end %>
<% end %>
<div id="email-confirmed-message">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<%= form_with(model: @user, scope: :user, url: users_path, method: :patch) do |form| %>
<div class="title mb-30">
<h2>Communication Preferences</h2>
</div>
<div class="card-style">
<p>Tell us how you'd like to receive notifications.</p>
<div class="form-check checkbox-style mb-20">
<%= form.check_box :receive_email_notifications, class: "toggle-email-notifications form-check-input" %>
<%= form.label :receive_email_notifications, "Email Me", class: "form-check-label" %>
</div>
<% if @user.casa_org.twilio_enabled? %>
<div class="form-check checkbox-style mb-20">
<%= form.check_box :receive_sms_notifications, class: "toggle-sms-notifications form-check-input" %>
<%= form.label :receive_sms_notifications, "Text Me", class: "form-check-label" %>
</div>
<div class="ps-4 pb-4">
<%= form.collection_check_boxes("sms_notification_event_ids", SmsNotificationEvent.where(user_type: @user.type),
:id, :name) do |event| %>
<div class="form-check checkbox-style mb-20">
<%= event.check_box(class: "form-check-input form-check-input", id: "toggle-sms-notification-event") %>
<%= event.label(class: "form-check-label") %>
</div>
<% end %>
</div>
<% else %>
<div class="form-check checkbox-style mb-20">
<%= form.check_box :receive_sms_notifications, class: "toggle-sms-notifications form-check-input", disabled: true %>
<%= form.label :receive_sms_notifications, "Enable Twilio For Text Messaging", class: "form-check-label" %>
</div>
<% end %>
<div class="actions mb-10">
<%= form.submit "Save Preferences", class: "main-btn primary-btn btn-hover mb-3 save-preference" %>
</div>
</div>
<% end %>
</div>
<% if current_user.volunteer? %>
<%= render partial: "languages", locals: { volunteer: current_user } %>
<% end %>