From a202eeb867cfc333f5e9e589478675c7db1fc461 Mon Sep 17 00:00:00 2001 From: pabois <pierreandre.boissinot@noesya.coop> Date: Fri, 17 Mar 2023 10:21:06 +0100 Subject: [PATCH] adjust account extranet --- app/controllers/extranet/account_controller.rb | 4 ++-- app/views/extranet/account/show.html.erb | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/controllers/extranet/account_controller.rb b/app/controllers/extranet/account_controller.rb index ace02aa0c..563890291 100644 --- a/app/controllers/extranet/account_controller.rb +++ b/app/controllers/extranet/account_controller.rb @@ -1,6 +1,6 @@ class Extranet::AccountController < Extranet::ApplicationController def show - # Superadmins don't have a person + # Admin or Superadmins can have NO person @person = current_user.person breadcrumb end @@ -39,4 +39,4 @@ class Extranet::AccountController < Extranet::ApplicationController super add_breadcrumb t('extranet.account.my'), account_path end -end \ No newline at end of file +end diff --git a/app/views/extranet/account/show.html.erb b/app/views/extranet/account/show.html.erb index d36d78bad..861f8affa 100644 --- a/app/views/extranet/account/show.html.erb +++ b/app/views/extranet/account/show.html.erb @@ -2,16 +2,18 @@ <div class="row"> <div class="col-md-9"> - <% unless @person.biography.blank? %> + <% unless @person&.biography.blank? %> <div class="biography mb-5"> <%= sanitize @person.biography %> </div> <% end %> - <p><%= t('extranet.experiences.title') %></p> - <%= link_to University::Person::Experience.human_attribute_name('new'), - new_experience_path, - class: 'btn btn-sm btn-primary mt-md-n5 float-md-end' %> - <%= render 'extranet/experiences/list', person: @person, edit: true %> + <% if @person %> + <p><%= t('extranet.experiences.title') %></p> + <%= link_to University::Person::Experience.human_attribute_name('new'), + new_experience_path, + class: 'btn btn-sm btn-primary mt-md-n5 float-md-end' %> + <%= render 'extranet/experiences/list', person: @person, edit: true %> + <% end %> </div> <div class="col-md-3"> <%= kamifusen_tag @person.best_picture, width: 400, class: 'img-fluid person__portrait' if @person&.best_picture&.attached? %> -- GitLab