osunyorg/admin

View on GitHub
app/views/extranet/personal_data/edit.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, @l10n %>

<%= simple_form_for @person, url: personal_data_path do |f| %>
  <%= f.simple_fields_for :localizations, @l10n do |lf| %>
    <%= f.error_notification %>
    <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
    <%= lf.hidden_field :language_id, value: current_language.id %>

    <h2 class="h5 mt-5">
      <%= University::Person.human_attribute_name('essentials') %>
    </h2>

    <div class="row">
      <div class="col-lg-4">
        <%= f.input :gender, label_method: lambda { |g| t("activerecord.attributes.university/person.genders.#{g[1]}") } %>
        <%= f.input :birthdate, discard_year: true, include_blank: true %>
      </div>
      <div class="col-lg-8">
        <%= lf.input :biography,
                    as: :summernote,
                    input_html: {
                      data: { 'summernote-config' => 'mini' }
                    } %>
      </div>
    </div>

    <h2 class="h5 mt-5">
      <%= University::Person.human_attribute_name('contacts') %>
    </h2>

    <div class="row mt-4">
      <div class="col-lg-4">
        <%= f.input :phone_mobile %>
      </div>
      <div class="col-lg-8">
        <%= f.input :phone_mobile_visibility, **personal_data_visibility_input_options %>
      </div>
    </div>
    <div class="row mt-4">
      <div class="col-lg-4">
        <%= f.input :phone_professional %>
      </div>
      <div class="col-lg-8">
        <%= f.input :phone_professional_visibility, **personal_data_visibility_input_options %>
      </div>
    </div>
    <div class="row mt-4">
      <div class="col-lg-4">
        <%= f.input :phone_personal %>
      </div>
      <div class="col-lg-8">
        <%= f.input :phone_personal_visibility, **personal_data_visibility_input_options %>
      </div>
    </div>

    <div class="row mt-4">
      <div class="col-lg-4">
        <%= f.input :zipcode %>
        <%= f.input :city %>
        <%= f.input :country, input_html: { class: 'form-select' } %>
      </div>
      <div class="col-lg-8">
        <%= f.input :address %>
        <%= f.input :address_visibility, **personal_data_visibility_input_options %>
      </div>
    </div>

    <h2 class="h5 mt-5">
      <%= University::Person.human_attribute_name('socials') %>
    </h2>

    <div class="row mt-4">
      <div class="col-lg-4">
        <%= lf.input :url %>
      </div>
    </div>

    <div class="row mt-4">
      <div class="col-lg-4">
        <%= lf.input :linkedin %>
      </div>
      <div class="col-lg-8">
        <%= f.input :linkedin_visibility, **personal_data_visibility_input_options %>
      </div>
    </div>

    <div class="row mt-4">
      <div class="col-lg-4">
        <%= lf.input :twitter %>
      </div>
      <div class="col-lg-8">
        <%= f.input :twitter_visibility, **personal_data_visibility_input_options %>
      </div>
    </div>

    <div class="row mt-4">
      <div class="col-lg-4">
        <%= lf.input :mastodon %>
      </div>
      <div class="col-lg-8">
        <%= f.input :mastodon_visibility, **personal_data_visibility_input_options %>
      </div>
    </div>

    <%= submit f %>
  <% end %>
<% end %>