html - Rails' Devise Edit Profile Page -
i'm trying place form field partial '_form.html.slim' when , render partial in 'edit.html.slim', form not being rendered. browser's inspector, says form element (not including input tags , submit button) being rendered in modified 'edit.html.slim'.
here original 'edit.html.slim'
.row .small-8.columns.small-centered .form-panel p.welcome | edit = resource_name.to_s.humanize = form_for(resource, as: resource_name, \ url: registration_path(resource_name), html: {method: :put}) |f| = devise_error_messages! .row .small-3.columns = f.label :username, class: 'right' .small-9.columns = f.text_field :username, autofocus: true .row .small-3.columns = f.label :email, class: 'right' .small-9.columns = f.text_field :email .row .small-3.columns = f.label :name, class: 'right' .small-9.columns = f.text_field :name .row .small-8.columns.small-centered = f.submit 'save changes', class: 'button small expand' = link_to 'back', :back
here modified 'edit.html.slim' renders form partial
.row .small-8.columns.small-centered .form-panel p.welcome | edit = resource_name.to_s.humanize #profile_form = render 'form'
and here '_form.html.slim' partial
= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {method: :put}) |f| = devise_error_messages! .row .small-3.columns = f.label :username, class: 'right' .small-9.columns = f.text_field :username, autofocus: true .row .small-3.columns = f.label :email, class: 'right' .small-9.columns = f.text_field :email .row .small-3.columns = f.label :name, class: 'right' .small-9.columns = f.text_field :name .row .small-8.columns.small-centered = f.submit 'save changes', class: 'button small expand'
update: error in code indentation of divs under "= devise_error_message!". since slim relies heavily on indentation, divs seen part of "= devise_error_message!" should not case. here's working code:
= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {method: :put}) |f| = devise_error_messages! .row .small-3.columns = f.label :username, class: 'right' .small-9.columns = f.text_field :username, autofocus: true .row .small-3.columns = f.label :email, class: 'right' .small-9.columns = f.text_field :email .row .small-3.columns = f.label :name, class: 'right' .small-9.columns = f.text_field :name .row .small-8.columns.small-centered = f.submit 'save changes', class: 'button small expand'
Comments
Post a Comment