Skip to content

Commit e9dac6c

Browse files
committed
feat: 更新資料
1 parent e8ea217 commit e9dac6c

File tree

3 files changed

+24
-33
lines changed

3 files changed

+24
-33
lines changed

app/controllers/users/registrations_controller.rb

+10-6
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@ def create
2121
# end
2222

2323
# PUT /resource
24-
# def update
25-
# super
26-
# end
24+
def update
25+
super do
26+
flash_if_has_error
27+
end
28+
end
2729

2830
# DELETE /resource
29-
# def destroy
30-
# super
31-
# end
31+
def destroy
32+
super do
33+
flash_if_has_error
34+
end
35+
end
3236

3337
# GET /resource/cancel
3438
# Forces the session data which is usually expired after sign

app/views/users/registrations/edit.html.erb

-27
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
= admin_form_for resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }, wrapper: :admin_landing do |f|
2+
= f.input :email, placeholder: 'Email', required: true, autofocus: true
3+
4+
- if devise_mapping.confirmable? && resource.pending_reconfirmation?
5+
p= "Currently waiting confirmation for: #{resource.unconfirmed_email}"
6+
= f.input :password, placeholder: 'New password', autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false
7+
= f.input :password_confirmation, placeholder: 'New password confirmation', required: false
8+
= f.input :current_password, placeholder: 'Current password', hint: "we need your current password to confirm your changes", required: true
9+
= f.full_size_submit '更新'
10+
11+
.row
12+
= admin_app_button_to '刪除帳號', registration_path(resource_name), icon: 'bomb', data: { confirm: '確定?' }, method: :delete
13+
= admin_app_button_to "回前頁", :back, icon: 'hand-o-left'
14+

0 commit comments

Comments
 (0)