From c143e08dccc02cb0b21a739517bb0d71defe1d5e Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Wed, 27 Jul 2022 12:16:08 +0200 Subject: [PATCH] wip #494 --- .../admin/university/people_controller.rb | 6 ++++ .../admin/university/people/show.html.erb | 4 +++ .../admin/university/people/static.html.erb | 28 +++++++++++++++---- config/routes/admin/university.rb | 7 ++++- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/university/people_controller.rb b/app/controllers/admin/university/people_controller.rb index 4eda4fadb..63e11047b 100644 --- a/app/controllers/admin/university/people_controller.rb +++ b/app/controllers/admin/university/people_controller.rb @@ -18,6 +18,12 @@ class Admin::University::PeopleController < Admin::University::ApplicationContro breadcrumb end + def static + @about = @person + @website = @person.websites&.first + render layout: false + end + def new breadcrumb end diff --git a/app/views/admin/university/people/show.html.erb b/app/views/admin/university/people/show.html.erb index 9b7983e69..026ee04e5 100644 --- a/app/views/admin/university/people/show.html.erb +++ b/app/views/admin/university/people/show.html.erb @@ -23,6 +23,10 @@ <% content_for :action_bar_left do %> <%= destroy_link @person %> + <%= link_to t('static'), + static_admin_university_person_path(@person), + target: :_blank, + class: button_classes('btn-light') if current_user.server_admin? %> <% end %> <% content_for :action_bar_right do %> diff --git a/app/views/admin/university/people/static.html.erb b/app/views/admin/university/people/static.html.erb index ea4e21c13..a4f84fc04 100644 --- a/app/views/admin/university/people/static.html.erb +++ b/app/views/admin/university/people/static.html.erb @@ -2,11 +2,16 @@ title: > <%= @about.to_s %> slug: "<%= @about.slug %>" -first_name: "<%= @about.first_name %>" -last_name: "<%= @about.last_name %>" -phone: "<%= @about.phone_mobile %>" -email: "<%= @about.email %>" -twitter: "<%= @about.twitter %>" +first_name: > + <%= @about.first_name %> +last_name: > + <%= @about.last_name %> +phone: > + <%= @about.phone_mobile %> +email: > + <%= @about.email %> +twitter: > + <%= @about.twitter %> linkedin: >- <%= @about.linkedin %> website: >- @@ -31,5 +36,18 @@ roles: <% if @about.administrator.for_website?(@website) %> - administrator <% end %> +<% if @about.roles_as_administrator.any? %> +involvements_as_administrator: +<% @about.roles_as_administrator.each do |role| + target = role.target %> + - title: > + <%= role.to_s %> + target: + title: > + <%= target.to_s %> + path: > + <%= target.path_in_website(@website) if target.respond_to? :path_in_website %> +<% end %> +<% end %> --- <%= prepare_html_for_static @about.biography, @about.university %> diff --git a/config/routes/admin/university.rb b/config/routes/admin/university.rb index 0f453c7e5..ce33420c9 100644 --- a/config/routes/admin/university.rb +++ b/config/routes/admin/university.rb @@ -19,5 +19,10 @@ namespace :university do patch 'experiences' => 'alumni/experiences#update' end end - resources :people, :organizations + resources :people do + member do + get :static + end + end + resources :organizations end -- GitLab