diff --git a/app/models/communication/website/block.rb b/app/models/communication/website/block.rb index 8a32f175936067fb6cafc60fb00d23208cc0a6ca..abf3e5e6e5032e7e53993d73861a0b28cb4c7b3b 100644 --- a/app/models/communication/website/block.rb +++ b/app/models/communication/website/block.rb @@ -60,9 +60,9 @@ class Communication::Website::Block < ApplicationRecord dependencies = [] data['elements'].each do |element| element['persons'].each do |person| - slug = person['slug'] - next if slug.blank? - person = university.people.find_by slug: slug + id = person['id'] + next if id.blank? + person = university.people.find id next if person.nil? dependencies += [person] dependencies += person.active_storage_blobs 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 6e715eeb2351044d1496a6841ce6c319b374d1ea..a7859c93f9e8ec8eacd0f86faa6bb393d7e9fa27 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 @@ -18,15 +18,15 @@ <p>People</p> </div> <div class="col-md-4 text-end"> - <a class="<%= button_classes %>" ng-click="element.persons.push({slug: ''})">Add person</a> + <a class="<%= button_classes %>" ng-click="element.persons.push({id: '', role: ''})">Add person</a> </div> </div> <div ng-repeat="person in element.persons" class="mb-2"> <div class="row"> <div class="col-md-5"> - <select class="form-select select" ng-model="person.slug"> + <select class="form-select select" ng-model="person.id"> <% @website.university.people.ordered.each_with_index do |person, index| %> - <option value="<%= person.slug %>"><%= person %></option> + <option value="<%= person.id %>"><%= person %></option> <% end %> </select> </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 d099275bfaaad537b0fa5868619a632d445475d1..cdee4815fe8d177247ade7796fa5e4472e3edf6d 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 @@ -3,7 +3,7 @@ <div class="row"> <% element['persons'].each do |person| %> <% - p = current_university.people.find_by slug: person['slug'] + p = current_university.people.find person['id'] next if p.nil? %> <div class="col-md-3"> 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 3aa0a781d35a1bedf0bc1bd3ca8e22acc6c3ab60..4829d02c51bf61ae2a95feec95cd37fc7e9b63ff 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 @@ -3,8 +3,11 @@ - title: > <%= element['title'] %> persons: -<% element['persons'].each do |person| %> - - slug: "<%= person['slug'] %>" +<% +element['persons'].each do |person| + p = block.university.people.find person['id'] +%> + - slug: "<%= p.slug %>" role: > <%= person['role'] %> <% end %>