From ae0eecc845e85a55e12ca40680ca1cdb9146a3e1 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Mon, 29 Aug 2022 14:58:52 +0200 Subject: [PATCH] experience --- .../_default/components/_buttons.sass | 4 ++++ app/views/extranet/account/show.html.erb | 12 ++++++----- .../extranet/experiences/_experience.html.erb | 6 +++--- app/views/extranet/experiences/_form.html.erb | 21 +++++++++++++++---- app/views/extranet/persons/_header.html.erb | 4 ++-- config/locales/university/en.yml | 5 +++++ config/locales/university/fr.yml | 5 +++++ 7 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 app/assets/stylesheets/extranet/_default/components/_buttons.sass diff --git a/app/assets/stylesheets/extranet/_default/components/_buttons.sass b/app/assets/stylesheets/extranet/_default/components/_buttons.sass new file mode 100644 index 000000000..bda00e3c7 --- /dev/null +++ b/app/assets/stylesheets/extranet/_default/components/_buttons.sass @@ -0,0 +1,4 @@ +.btn-secondary + border: 1px solid black + background: transparent + color: black \ No newline at end of file diff --git a/app/views/extranet/account/show.html.erb b/app/views/extranet/account/show.html.erb index f0cee2369..511cbd41b 100644 --- a/app/views/extranet/account/show.html.erb +++ b/app/views/extranet/account/show.html.erb @@ -2,19 +2,17 @@ <%= render 'extranet/persons/header', person: @person unless @person.nil? %> -<%= link_to t('extranet.account.edit'), edit_account_path, class: 'btn btn-primary' %> -<%= link_to t('extranet.account.logout'), destroy_user_session_path, method: :delete, class: 'btn text-danger' %> - <div class="row"> <div class="col-md-9"> <div class="biography"> <p><%= @person.biography %></p> </div> <div class="experiences"> - <p class="mb-4">Parcours professionel</p> <%= link_to University::Person::Experience.human_attribute_name('new'), new_experience_path, - class: 'btn btn-sm btn-primary mb-4' %> + class: 'btn btn-sm btn-secondary float-end mb-4' %> + <p class="mb-4">Parcours professionel</p> + <br> <% if @person.experiences.any? %> <ul> <% @person.experiences.ordered.each do |experience| %> @@ -25,6 +23,10 @@ </div> </div> <div class="col-md-3"> + <div class="mb-4"> + <%= link_to t('extranet.account.edit'), edit_account_path, class: 'btn btn-primary' %> + <%= link_to t('extranet.account.logout'), destroy_user_session_path, method: :delete, class: 'btn text-danger' %> + </div> <%= render 'extranet/persons/details', person: @person unless @person.nil? %> </div> </div> \ No newline at end of file diff --git a/app/views/extranet/experiences/_experience.html.erb b/app/views/extranet/experiences/_experience.html.erb index 73a8f1e67..d2d10a82e 100644 --- a/app/views/extranet/experiences/_experience.html.erb +++ b/app/views/extranet/experiences/_experience.html.erb @@ -8,9 +8,6 @@ edit ||= false <%= "#{experience.from_year} —" if experience.from_year %> <%= experience.to_year || t('today') %> </p> - <%= link_to University::Person::Experience.human_attribute_name('edit'), - edit_experience_path(experience), - class: 'btn btn-sm btn-primary mt-2' if edit %> </div> <div> <% if experience.organization.present? %> @@ -28,5 +25,8 @@ edit ||= false <% end %> <% end %> <% end %> + <%= link_to University::Person::Experience.human_attribute_name('edit'), + edit_experience_path(experience), + class: 'btn btn-sm btn-secondary float-end mt-2' if edit %> </div> </li> diff --git a/app/views/extranet/experiences/_form.html.erb b/app/views/extranet/experiences/_form.html.erb index 32e17ddcb..1c90372f6 100644 --- a/app/views/extranet/experiences/_form.html.erb +++ b/app/views/extranet/experiences/_form.html.erb @@ -1,7 +1,20 @@ <%= simple_form_for experience, url: experience.persisted? ? experience_path(experience) : experiences_path do |f| %> - <%= f.association :organization %> - <%= f.input :description %> - <%= f.input :from_year %> - <%= f.input :to_year %> + <div class="row"> + <div class="col-lg-6"> + <%= f.input :description, as: :string %> + <div class="row"> + <div class="col-6"> + <%= f.input :from_year %> + </div> + <div class="col-6"> + <%= f.input :to_year %> + </div> + </div> + </div> + <div class="col-lg-6"> + <%= f.association :organization, include_blank: false %> + <%= link_to 'Créer une nouvelle organisation', '', class: 'btn btn-sm btn-secondary mb-4' %> + </div> + </div> <%= submit f %> <% end %> \ No newline at end of file diff --git a/app/views/extranet/persons/_header.html.erb b/app/views/extranet/persons/_header.html.erb index b0a32dd58..1f10fd55f 100644 --- a/app/views/extranet/persons/_header.html.erb +++ b/app/views/extranet/persons/_header.html.erb @@ -5,8 +5,8 @@ </header> </div> <div class="col-md-3"> - <% if person.picture.attached? %> - <%= kamifusen_tag person.picture, width: 400, class: 'img-fluid' %> + <% if person.best_picture.attached? %> + <%= kamifusen_tag person.best_picture, width: 400, class: 'img-fluid' %> <% else %> <%= image_tag 'extranet/avatar.png', width: 400, class: 'img-fluid' %> <% end %> diff --git a/config/locales/university/en.yml b/config/locales/university/en.yml index 9baf021dc..cd6cb5d0f 100644 --- a/config/locales/university/en.yml +++ b/config/locales/university/en.yml @@ -142,6 +142,11 @@ en: linkedin: "Example: https://www.linkedin.com/in/osuny" tenure: "To differ from temporary lecturer." twitter: "Example: osuny" + university_person_experience: + organization: "Choose the organization if it exists, otherwise create it with the button below" + description: "Ex: Project manager, Communication assistant, Journalist..." + from_year: "In charge since..." + to_year: "Leave blank if you are still in charge" include_blanks: defaults: organization: Select organization diff --git a/config/locales/university/fr.yml b/config/locales/university/fr.yml index 6ce31cfef..56e74a01c 100644 --- a/config/locales/university/fr.yml +++ b/config/locales/university/fr.yml @@ -143,6 +143,11 @@ fr: linkedin: "Exemple : https://www.linkedin.com/in/osuny" tenure: "À différencier d'une personne vacataire." twitter: "Exemple : osuny" + university_person_experience: + organization: "Choisissez l'organisation si elle existe. Si elle n'existe pas encore, créez-là ci-dessous." + description: "Ex: Chargée de projet, Assistant communication, Journaliste..." + from_year: "En poste depuis..." + to_year: "Si vous êtes toujours à ce poste, laissez vide" include_blanks: defaults: organization: Sélectionnez une organisation -- GitLab