From 121d9814c5f035d19950bdac062b02486c81d094 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Tue, 3 Sep 2019 10:41:34 +0500 Subject: [PATCH] Move form into partial --- app/views/settings/profiles/_form.html.erb | 14 ++++++++++++++ app/views/settings/profiles/edit.html.erb | 15 +-------------- 2 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 app/views/settings/profiles/_form.html.erb diff --git a/app/views/settings/profiles/_form.html.erb b/app/views/settings/profiles/_form.html.erb new file mode 100644 index 0000000..4ba6be8 --- /dev/null +++ b/app/views/settings/profiles/_form.html.erb @@ -0,0 +1,14 @@ +<%= simple_form_for account, url: settings_profile_path do |f| %> + <%= f.error_notification %> + + <%= f.input :nickname, required: true %> + <%= f.input :public_name %> + <%= f.input :biography %> + <%= f.input :avatar, direct_upload: true %> + + <% if f.object.avatar.attached? %> + <%= image_tag f.object.avatar, class: 'img-thumbnail mb-4' %> + <% end %> + + <%= f.button :submit, translate('users.registrations.edit.update') %> +<% end %> diff --git a/app/views/settings/profiles/edit.html.erb b/app/views/settings/profiles/edit.html.erb index c4b6236..b2fcefe 100644 --- a/app/views/settings/profiles/edit.html.erb +++ b/app/views/settings/profiles/edit.html.erb @@ -5,20 +5,7 @@
- <%= simple_form_for @account, url: settings_profile_path do |f| %> - <%= f.error_notification %> - - <%= f.input :nickname, required: true %> - <%= f.input :public_name %> - <%= f.input :biography %> - <%= f.input :avatar, direct_upload: true %> - - <% if f.object.avatar.attached? %> - <%= image_tag f.object.avatar, class: 'img-thumbnail mb-4' %> - <% end %> - - <%= f.button :submit, translate('users.registrations.edit.update') %> - <% end %> + <%= render partial: 'form', locals: { account: @account } %>