app/views/admin/university/people/_form.html.erb
<%= simple_form_for [:admin, person] 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 %>
<div class="row">
<div class="col-lg-8">
<%= osuny_panel University::Person.human_attribute_name('essentials') do %>
<div class="row pure__row--small">
<div class="col-xl-6">
<%= lf.input :first_name %>
</div>
<div class="col-xl-6">
<%= lf.input :last_name %>
</div>
</div>
<div class="row pure__row--small">
<div class="col-xl-6">
<%= f.input :gender, label_method: lambda { |g| t("activerecord.attributes.university/person.genders.#{g[1]}") } %>
</div>
<div class="col-xl-6">
<%= f.input :birthdate, discard_year: true, include_blank: true %>
</div>
</div>
<%= render 'admin/application/summary/form', f: lf, about: l10n %>
<%= lf.input :biography,
as: :summernote,
input_html: {
data: { 'summernote-config' => 'mini-list' }
} %>
<% end %>
<%= osuny_panel University::Person.human_attribute_name('abilities') do %>
<div class="row pure__row--small">
<div class="col-xl-6">
<% if current_university.is_really_a_university? %>
<%= f.input :is_teacher %>
<%= f.input :is_administration %>
<%= f.input :is_alumnus %>
<% end %>
<%= f.input :is_author %>
</div>
<% if current_university.is_really_a_university? %>
<div class="col-xl-6">
<%= f.input :tenure %>
<%= f.input :is_researcher %>
<%= f.input :habilitation %>
</div>
<% end %>
</div>
<% end %>
<%= render 'admin/application/categories/form', f: f, categories: @categories %>
<%= osuny_panel University::Person.human_attribute_name('contacts') do %>
<p><em><%= t("university.person.personal_data_warning") %></em></p>
<div class="row pure__row--small mb-4">
<div class="col-xl-6">
<%= f.input :email %>
</div>
<div class="col-xl-6">
<%= f.input :email_visibility, **personal_data_visibility_input_options %>
</div>
</div>
<div class="row pure__row--small mb-4">
<div class="col-xl-6">
<%= f.input :phone_mobile %>
</div>
<div class="col-xl-6">
<%= f.input :phone_mobile_visibility, **personal_data_visibility_input_options %>
</div>
</div>
<div class="row pure__row--small mb-4">
<div class="col-xl-6">
<%= f.input :phone_professional %>
</div>
<div class="col-xl-6">
<%= f.input :phone_professional_visibility, **personal_data_visibility_input_options %>
</div>
</div>
<div class="row pure__row--small mb-4">
<div class="col-xl-6">
<%= f.input :phone_personal %>
</div>
<div class="col-xl-6">
<%= f.input :phone_personal_visibility, **personal_data_visibility_input_options %>
</div>
</div>
<div class="row pure__row--small mb-4">
<div class="col-xl-6">
<%= f.input :address %>
<%= f.input :zipcode %>
<%= f.input :city %>
<%= f.input :country, input_html: { class: 'form-select' } %>
</div>
<div class="col-xl-6">
<%= f.input :address_visibility, **personal_data_visibility_input_options %>
</div>
</div>
<% end %>
<%= osuny_panel University::Person.human_attribute_name('socials') do %>
<p><em><%= t("university.person.personal_data_warning") %></em></p>
<div class="row pure__row--small mb-4">
<div class="col-xl-6">
<%= lf.input :url %>
</div>
</div>
<div class="row pure__row--small mb-4">
<div class="col-xl-6">
<%= lf.input :linkedin %>
</div>
<div class="col-xl-6">
<%= f.input :linkedin_visibility, **personal_data_visibility_input_options %>
</div>
</div>
<div class="row pure__row--small mb-4">
<div class="col-xl-6">
<%= lf.input :twitter %>
</div>
<div class="col-xl-6">
<%= f.input :twitter_visibility, **personal_data_visibility_input_options %>
</div>
</div>
<div class="row pure__row--small mb-4">
<div class="col-xl-6">
<%= lf.input :mastodon %>
</div>
<div class="col-xl-6">
<%= f.input :mastodon_visibility, **personal_data_visibility_input_options %>
</div>
</div>
<% end %>
<%= f.association :research_laboratories,
collection: osuny_collection(current_university.research_laboratories, localized: true),
as: :check_boxes if person.is_researcher %>
</div>
<div class="col-lg-4">
<%= osuny_panel t('metadata') do %>
<%= render "admin/application/slug/form",
f: lf,
source: '#university_person_localizations_attributes_0_first_name, #university_person_localizations_attributes_0_last_name' %>
<%= f.association :user, collection: current_university.users.ordered if can?(:manage, User) %>
<% end %>
<%= osuny_panel University::Person.human_attribute_name('picture') do %>
<%= f.input :picture,
as: :single_deletable_file,
label: false,
input_html: { accept: default_images_formats_accepted },
preview: 200,
resize: 1 %>
<%= lf.input :picture_credit,
as: :summernote,
hint: t('featured_image.credit.hint'),
input_html: {
data: {
translatable: true,
'summernote-config' => 'link'
}
} %>
<% end %>
<%= render 'admin/application/meta_description/form', f: lf, about: l10n %>
</div>
</div>
<% content_for :action_bar_right do %>
<%= submit f %>
<% end %>
<% end %>
<% end %>