diff --git a/app/models/communication/block/partner.rb b/app/models/communication/block/partner.rb index c54cfbe067336ca7edf53727ceb3ac778f85f19b..0f8afff5e21725c61edbf75729554d2c20d192f9 100644 --- a/app/models/communication/block/partner.rb +++ b/app/models/communication/block/partner.rb @@ -3,6 +3,14 @@ class Communication::Block::Partner < Communication::Block::Abstract elements.each do |partner| blob = find_blob partner, 'logo' add_dependency blob unless blob.nil? + + # TODO : add organization dependency + # id = partner['id'] + # next if id.blank? + # organization = university.organizations.find id + # next if organization.nil? + # add_dependency organization + # add_dependency organization.active_storage_blobs end end end diff --git a/app/views/admin/communication/blocks/templates/partners/_static.html.erb b/app/views/admin/communication/blocks/templates/partners/_static.html.erb index 373e914d5191cca4d2a7fe39c9db3c185af6f290..3807e25ed791ebc98b6641740ebc5eec839f33c2 100644 --- a/app/views/admin/communication/blocks/templates/partners/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_static.html.erb @@ -1,20 +1,10 @@ <% if block.data.has_key?('elements') %> <% block.data['elements'].each do |partner| id = partner['id'] - if id != '' - unless id.nil? - unless id.empty? - organization = block.university.organizations.find id %> + unless id.blank? + organization = block.university.organizations.find id %> - id: "<%= id %>" - name: > - <%= prepare_text_for_static organization.name %> - url: <%= prepare_text_for_static organization.url %> - <% if organization.logo.attached? %> - logo: "<%= organization.logo.blob.id %>" - <% end %> - <% end - end - else %> + <% else %> - name: > <%= prepare_text_for_static partner['name'] %> url: >-