From 3785ab5d1c43f6d8946380c5267c099d7019a27c Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Tue, 15 Feb 2022 15:56:54 +0100
Subject: [PATCH] role

---
 .../blocks/templates/organization_chart/_edit.html.erb   | 9 ++++++---
 .../blocks/templates/organization_chart/_show.html.erb   | 2 +-
 .../blocks/templates/organization_chart/_static.html.erb | 4 +++-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/app/views/admin/communication/website/blocks/templates/organization_chart/_edit.html.erb b/app/views/admin/communication/website/blocks/templates/organization_chart/_edit.html.erb
index 0c6c5f581..489a97116 100644
--- a/app/views/admin/communication/website/blocks/templates/organization_chart/_edit.html.erb
+++ b/app/views/admin/communication/website/blocks/templates/organization_chart/_edit.html.erb
@@ -2,7 +2,7 @@
 <div class="card" ng-repeat="element in data.elements">
   <div class="card-body">
     <div class="row">
-      <div class="col-md-5">
+      <div class="col-md-4">
         <div class="row">
           <div class="col-md-11">
             <input class="form-control" type="text" ng-model="element.title">
@@ -12,7 +12,7 @@
           </div>
         </div>
       </div>
-      <div class="offset-md-1 col-md-6">
+      <div class="offset-md-1 col-md-7">
         <div class="row">
           <div class="col-md-8">
             <p>People</p>
@@ -23,13 +23,16 @@
         </div>
         <div ng-repeat="person in element.persons" class="mb-2">
           <div class="row">
-            <div class="col-md-11">
+            <div class="col-md-5">
               <select class="form-select select" ng-model="person.slug">
                 <% @website.university.people.each_with_index do |person, index| %>
                 <option value="<%= person.slug %>"><%= person %></option>
                 <% end %>
               </select>
             </div>
+            <div class="col-md-6">
+              <input class="form-control" type="text" ng-model="person.role" placeholder="Type role here">
+            </div>
             <div class="col-md-1 text-end">
               <a class="btn btn-sm btn-danger mt-1" ng-click="element.persons.splice(element.persons.indexOf(person))"><i class="fas fa-trash"></i></a>
             </div>
diff --git a/app/views/admin/communication/website/blocks/templates/organization_chart/_show.html.erb b/app/views/admin/communication/website/blocks/templates/organization_chart/_show.html.erb
index e9da4c0ee..32092f13f 100644
--- a/app/views/admin/communication/website/blocks/templates/organization_chart/_show.html.erb
+++ b/app/views/admin/communication/website/blocks/templates/organization_chart/_show.html.erb
@@ -1,6 +1,6 @@
 <% @block.data['elements'].each do |element| %>
   <h2><%= element['title'] %></h2>
   <% element['persons'].each do |person| %>
-    <p><%= person['slug'] %></p>
+    <p><b><%= person['slug'] %></b>, <%= person['role'] %></p>
   <% end %>
 <% end %>
diff --git a/app/views/admin/communication/website/blocks/templates/organization_chart/_static.html.erb b/app/views/admin/communication/website/blocks/templates/organization_chart/_static.html.erb
index 8442a6bb1..3aa0a781d 100644
--- a/app/views/admin/communication/website/blocks/templates/organization_chart/_static.html.erb
+++ b/app/views/admin/communication/website/blocks/templates/organization_chart/_static.html.erb
@@ -4,7 +4,9 @@
           <%= element['title'] %>
         persons:
 <% element['persons'].each do |person| %>
-          - "<%= person['slug'] %>"
+          - slug: "<%= person['slug'] %>"
+            role: >
+              <%= person['role'] %>
 <% end %>
 <% end %>
 <% end %>
-- 
GitLab