diff --git a/app/assets/images/communication/blocks/templates/partners.jpg b/app/assets/images/communication/blocks/templates/organizations.jpg similarity index 100% rename from app/assets/images/communication/blocks/templates/partners.jpg rename to app/assets/images/communication/blocks/templates/organizations.jpg diff --git a/app/assets/images/communication/blocks/templates/partners/grid.png b/app/assets/images/communication/blocks/templates/organizations/grid.png similarity index 100% rename from app/assets/images/communication/blocks/templates/partners/grid.png rename to app/assets/images/communication/blocks/templates/organizations/grid.png diff --git a/app/assets/images/communication/blocks/templates/partners/map.png b/app/assets/images/communication/blocks/templates/organizations/map.png similarity index 100% rename from app/assets/images/communication/blocks/templates/partners/map.png rename to app/assets/images/communication/blocks/templates/organizations/map.png diff --git a/app/assets/images/communication/blocks/templates/organization_chart.jpg b/app/assets/images/communication/blocks/templates/people.jpg similarity index 100% rename from app/assets/images/communication/blocks/templates/organization_chart.jpg rename to app/assets/images/communication/blocks/templates/people.jpg diff --git a/app/assets/stylesheets/admin/commons/content-editor.sass b/app/assets/stylesheets/admin/commons/content-editor.sass index a9cc2e2f3..4953b7320 100644 --- a/app/assets/stylesheets/admin/commons/content-editor.sass +++ b/app/assets/stylesheets/admin/commons/content-editor.sass @@ -28,7 +28,7 @@ iframe height: 90px width: 160px - &--partners + &--organizations display: flex div align-items: center diff --git a/app/models/communication/block.rb b/app/models/communication/block.rb index f71d4fe69..2c68be3b5 100644 --- a/app/models/communication/block.rb +++ b/app/models/communication/block.rb @@ -75,9 +75,9 @@ class Communication::Block < ApplicationRecord image: 51, key_figures: 56, license: 4040, - organization_chart: 100, + organizations: 200, pages: 600, - partners: 200, + people: 100, posts: 500, programs: 58, sound: 1005, @@ -89,7 +89,7 @@ class Communication::Block < ApplicationRecord CATEGORIES = { basic: [:chapter, :image, :video, :sound, :datatable], storytelling: [:key_figures, :features, :gallery, :call_to_action, :testimonials, :timeline], - references: [:pages, :posts, :organization_chart, :partners, :agenda, :programs], + references: [:pages, :posts, :people, :organizations, :agenda, :programs], utilities: [:files, :definitions, :contact, :license, :embed] } diff --git a/app/models/communication/block/template/partner.rb b/app/models/communication/block/template/organization.rb similarity index 82% rename from app/models/communication/block/template/partner.rb rename to app/models/communication/block/template/organization.rb index 916c05e0e..536f24452 100644 --- a/app/models/communication/block/template/partner.rb +++ b/app/models/communication/block/template/organization.rb @@ -1,4 +1,4 @@ -class Communication::Block::Template::Partner < Communication::Block::Template::Base +class Communication::Block::Template::Organization < Communication::Block::Template::Base has_elements has_layouts [:grid, :map] diff --git a/app/models/communication/block/template/partner/element.rb b/app/models/communication/block/template/organization/element.rb similarity index 80% rename from app/models/communication/block/template/partner/element.rb rename to app/models/communication/block/template/organization/element.rb index 1c9b6009a..527a6bf18 100644 --- a/app/models/communication/block/template/partner/element.rb +++ b/app/models/communication/block/template/organization/element.rb @@ -1,4 +1,4 @@ -class Communication::Block::Template::Partner::Element < Communication::Block::Template::Base +class Communication::Block::Template::Organization::Element < Communication::Block::Template::Base has_component :id, :organization has_component :name, :string diff --git a/app/models/communication/block/template/organization_chart.rb b/app/models/communication/block/template/person.rb similarity index 78% rename from app/models/communication/block/template/organization_chart.rb rename to app/models/communication/block/template/person.rb index 0b1239215..adada3cb3 100644 --- a/app/models/communication/block/template/organization_chart.rb +++ b/app/models/communication/block/template/person.rb @@ -1,4 +1,4 @@ -class Communication::Block::Template::OrganizationChart < Communication::Block::Template::Base +class Communication::Block::Template::Person < Communication::Block::Template::Base has_elements has_component :description, :rich_text diff --git a/app/models/communication/block/template/organization_chart/element.rb b/app/models/communication/block/template/person/element.rb similarity index 51% rename from app/models/communication/block/template/organization_chart/element.rb rename to app/models/communication/block/template/person/element.rb index 962ce80e4..066d4c85b 100644 --- a/app/models/communication/block/template/organization_chart/element.rb +++ b/app/models/communication/block/template/person/element.rb @@ -1,4 +1,4 @@ -class Communication::Block::Template::OrganizationChart::Element < Communication::Block::Template::Base +class Communication::Block::Template::Person::Element < Communication::Block::Template::Base has_component :id, :person has_component :role, :string diff --git a/app/views/admin/communication/blocks/templates/partners/_edit.html.erb b/app/views/admin/communication/blocks/templates/organizations/_edit.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/partners/_edit.html.erb rename to app/views/admin/communication/blocks/templates/organizations/_edit.html.erb diff --git a/app/views/admin/communication/blocks/templates/partners/_show.html.erb b/app/views/admin/communication/blocks/templates/organizations/_show.html.erb similarity index 93% rename from app/views/admin/communication/blocks/templates/partners/_show.html.erb rename to app/views/admin/communication/blocks/templates/organizations/_show.html.erb index a7c24b134..5e3ea877b 100644 --- a/app/views/admin/communication/blocks/templates/partners/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/organizations/_show.html.erb @@ -1,9 +1,9 @@ <% - class_name = "block block-partners" + class_name = "block block-organizations" unless block.title.blank? class_name += " block-with-title" end - class_name += " block-partners--" + block.template.layout + class_name += " block-organizations--" + block.template.layout %>
@@ -26,7 +26,7 @@
<% else # Map %>
- diff --git a/app/views/admin/communication/blocks/templates/partners/_snippet.html.erb b/app/views/admin/communication/blocks/templates/organizations/_snippet.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/partners/_snippet.html.erb rename to app/views/admin/communication/blocks/templates/organizations/_snippet.html.erb diff --git a/app/views/admin/communication/blocks/templates/partners/_static.html.erb b/app/views/admin/communication/blocks/templates/organizations/_static.html.erb similarity index 93% rename from app/views/admin/communication/blocks/templates/partners/_static.html.erb rename to app/views/admin/communication/blocks/templates/organizations/_static.html.erb index 61dff7dc4..5713921b7 100644 --- a/app/views/admin/communication/blocks/templates/partners/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/organizations/_static.html.erb @@ -1,7 +1,7 @@ layout: <%= block.template.layout %> <%= block_component_static block, :description %> <%= block_component_static block, :with_link %> - partners: + organizations: <% block.template.elements.each do |element| %> <% next if element.best_name.blank? %> <% if element.organization %> @@ -22,18 +22,18 @@ url: "<%= element.organization.current_permalink_in_website(@website)&.path %>" logo: <% if element.organization.logo.attached? %> - light_background: + light_background: id: "<%= element.organization.logo.blob.id %>" <% end %> <% if element.organization.logo_on_dark_background.attached? %> - dark_background: + dark_background: id: "<%= element.organization.logo_on_dark_background.blob.id %>" <% end %> <% else %> kind: "external" url: "<%= element.url %>" <% if element.logo_component.blob %> - logo: + logo: id: "<%= element.logo_component.blob&.id %>" <% end %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/partners/_static.json.jbuilder b/app/views/admin/communication/blocks/templates/organizations/_static.json.jbuilder similarity index 76% rename from app/views/admin/communication/blocks/templates/partners/_static.json.jbuilder rename to app/views/admin/communication/blocks/templates/organizations/_static.json.jbuilder index aad86355a..0357fa95d 100644 --- a/app/views/admin/communication/blocks/templates/partners/_static.json.jbuilder +++ b/app/views/admin/communication/blocks/templates/organizations/_static.json.jbuilder @@ -1,7 +1,7 @@ json.layout block.template.layout json.description block.template.description json.with_link block.template.with_link -json.partners block.template.elements do |element| +json.organizations block.template.elements do |element| if element.organization json.slug element.organization.slug end diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_edit.html.erb b/app/views/admin/communication/blocks/templates/people/_edit.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/organization_chart/_edit.html.erb rename to app/views/admin/communication/blocks/templates/people/_edit.html.erb diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb b/app/views/admin/communication/blocks/templates/people/_show.html.erb similarity index 93% rename from app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb rename to app/views/admin/communication/blocks/templates/people/_show.html.erb index 5d657bb35..2f936778f 100644 --- a/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/people/_show.html.erb @@ -1,5 +1,5 @@ <% -class_name = "block block-organization_chart" +class_name = "block block-people" unless block.title.blank? class_name += " block-with-title" end @@ -29,7 +29,7 @@ end

<% if block.template.with_link %> - <%= link_to person, [:admin, person] %> + <%= link_to person, [:admin, person] %> <% else %> <%= element.person %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_snippet.html.erb b/app/views/admin/communication/blocks/templates/people/_snippet.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/organization_chart/_snippet.html.erb rename to app/views/admin/communication/blocks/templates/people/_snippet.html.erb diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_static.html.erb b/app/views/admin/communication/blocks/templates/people/_static.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/organization_chart/_static.html.erb rename to app/views/admin/communication/blocks/templates/people/_static.html.erb diff --git a/config/locales/communication/contents/en.yml b/config/locales/communication/contents/en.yml index 535f66091..0eafd2fd0 100644 --- a/config/locales/communication/contents/en.yml +++ b/config/locales/communication/contents/en.yml @@ -51,7 +51,7 @@ en: headings: add: Add a title templates: - agenda: + agenda: description: A list of upcoming events. edit: events_quantity: @@ -288,27 +288,38 @@ en: false: No. Others must use the same CC license if they adapt my work. description: label: Description - organization_chart: - description: People and their jobs. + organizations: + description: A list of organizations with logo, name and website. + layouts: + grid: + label: Grid + description: Square logos and a simple text below. + map: + label: Map + description: A geographic map, with a pin for every organization with a known location. edit: - add_person: Add person - drag_title: Drag and drop to organize persons - delete_title: Remove person + add_partner: Add organization alphabetical: label: Alphabetical order description: label: Description - with_link: - label: With clickable link to each person's page? - with_photo: - label: With a portrait for each person? element: - person: - label: Person - placeholder: Select the person - role: - label: Role - placeholder: Enter person's role + id: + label: Organization + placeholder: Choose organization + unregistered: Unregistered organization + name: + label: Nom + placeholder: Enter organization's name + url: + label: Website + placeholder: https:// + logo: + label: Logo + remove_logo: Remove logo + remove_partner: Remove organization + with_link: + label: With clickable link to each organization's page? pages: description: A highlight of some pages, with multiple layout options. layouts: @@ -350,38 +361,27 @@ en: title: Selected pages display: title: Layout options - partners: - description: A list of organizations with logo, name and website. - layouts: - grid: - label: Grid - description: Square logos and a simple text below. - map: - label: Map - description: A geographic map, with a pin for every organization with a known location. + people: + description: People and their jobs. edit: - add_partner: Add organization + add_person: Add person + drag_title: Drag and drop to organize persons + delete_title: Remove person alphabetical: label: Alphabetical order description: label: Description - element: - id: - label: Organization - placeholder: Choose organization - unregistered: Unregistered organization - name: - label: Nom - placeholder: Enter organization's name - url: - label: Website - placeholder: https:// - logo: - label: Logo - remove_logo: Remove logo - remove_partner: Remove organization with_link: - label: With clickable link to each organization's page? + label: With clickable link to each person's page? + with_photo: + label: With a portrait for each person? + element: + person: + label: Person + placeholder: Select the person + role: + label: Role + placeholder: Enter person's role posts: description: A list of highlighted news. layouts: @@ -419,12 +419,12 @@ en: description: A selection of programs. edit: add: Add a program - sound: + sound: description: An audio recording with a text transcription for a proper accessibility. edit: file: label: Audio file encoded for the Web (.mp3, .m4a...) - title: + title: label: Recording title placeholder: Enter the title testimonials: @@ -511,9 +511,9 @@ en: image: Image key_figures: Key figures license: License - organization_chart: People + organizations: Organizations pages: Pages - partners: Organizations + people: People posts: Posts programs: Programs sound: Sound diff --git a/config/locales/communication/contents/fr.yml b/config/locales/communication/contents/fr.yml index 9bc799292..1d4966d86 100644 --- a/config/locales/communication/contents/fr.yml +++ b/config/locales/communication/contents/fr.yml @@ -51,7 +51,7 @@ fr: headings: add: Ajouter un titre templates: - agenda: + agenda: description: Une liste d'événements à venir. edit: events_quantity: @@ -288,27 +288,38 @@ fr: false: Non. Les autres doivent utiliser la même licence CC s'ils adaptent mon œuvre. description: label: Description - organization_chart: - description: Une liste de personnes, avec photo, fonction et lien vers la page de la personne. + organizations: + description: Une liste d'organisations, avec leur logo, leur site et leur nom. + layouts: + grid: + label: Grille + description: Une série de logos carrés, avec le nom de chaque organisation. + map: + label: Carte + description: Une carte géographique avec un repère pour chaque organisation dont l'adresse est connue. edit: - add_person: Ajouter une personne - drag_title: Glisser-déposer pour organiser les personnes - delete_title: Enlever la personne + add_partner: Ajouter une organisation alphabetical: label: Ordre alphabétique - with_link: - label: Avec des liens cliquables vers les pages des personnes ? - with_photo: - label: Avec un portrait de chaque personne ? description: label: Description element: id: - label: Personne - placeholder: Choisir la personne - role: - label: Rôle - placeholder: Indiquer le rôle de la personne + label: Organisation + placeholder: Choisir l'organisation + unregistered: Organisation non enregistrée + name: + label: Nom + placeholder: Entrer le nom du partenaire + url: + label: Site Web + placeholder: https:// + logo: + label: Logo + remove_logo: Enlever le logo + remove_partner: Enlever le partenaire + with_link: + label: Avec des liens cliquables vers les pages des organisations? pages: description: Une mise en avant d'une sélection de pages, avec plusieurs options d'affichage. layouts: @@ -350,38 +361,27 @@ fr: title: Pages sélectionnées display: title: Options d'affichage - partners: - description: Une liste d'organisations, avec leur logo, leur site et leur nom. - layouts: - grid: - label: Grille - description: Une série de logos carrés, avec le nom de chaque organisation. - map: - label: Carte - description: Une carte géographique avec un repère pour chaque organisation dont l'adresse est connue. + people: + description: Une liste de personnes, avec photo, fonction et lien vers la page de la personne. edit: - add_partner: Ajouter une organisation + add_person: Ajouter une personne + drag_title: Glisser-déposer pour organiser les personnes + delete_title: Enlever la personne alphabetical: label: Ordre alphabétique + with_link: + label: Avec des liens cliquables vers les pages des personnes ? + with_photo: + label: Avec un portrait de chaque personne ? description: label: Description element: id: - label: Organisation - placeholder: Choisir l'organisation - unregistered: Organisation non enregistrée - name: - label: Nom - placeholder: Entrer le nom du partenaire - url: - label: Site Web - placeholder: https:// - logo: - label: Logo - remove_logo: Enlever le logo - remove_partner: Enlever le partenaire - with_link: - label: Avec des liens cliquables vers les pages des organisations? + label: Personne + placeholder: Choisir la personne + role: + label: Rôle + placeholder: Indiquer le rôle de la personne posts: description: Une liste d'actualités mises en avant. layouts: @@ -419,12 +419,12 @@ fr: description: Une sélection de formations. edit: add: Ajouter une formation - sound: + sound: description: Un enregistrement audio, avec sa transcription pour l'accessibilité. edit: file: label: Fichier audio pour diffusion Web (.mp3, .m4a...) - title: + title: label: Titre de l'enregistrement placeholder: Entrer le titre testimonials: @@ -511,9 +511,9 @@ fr: image: Image key_figures: Chiffres-clés license: Licence - organization_chart: Personnes + organizations: Organisations pages: Pages - partners: Organisations + people: Personnes posts: Actualités programs: Formations sound: Son diff --git a/test/fixtures/communication/blocks.yml b/test/fixtures/communication/blocks.yml index 58b330720..b8eefcfaa 100644 --- a/test/fixtures/communication/blocks.yml +++ b/test/fixtures/communication/blocks.yml @@ -36,5 +36,5 @@ olivia_in_noesya: about: noesya (University::Organization) data: { "elements": [ { "id": "53cbac40-e430-585a-965c-a7412a92f35a" } ] } position: 1 - template_kind: :organization_chart + template_kind: :people published: true diff --git a/test/models/communication/website/connection_test.rb b/test/models/communication/website/connection_test.rb index 2ffb98bd3..43ee9cba4 100644 --- a/test/models/communication/website/connection_test.rb +++ b/test/models/communication/website/connection_test.rb @@ -74,7 +74,7 @@ def test_deleting_indirect_with_a_dependency_having_two_sources # On ajoute noesya à PA via un block "Organisations" assert_difference -> { Communication::Website::Connection.count } => 1 do - block = pa.blocks.create(position: 1, published: true, template_kind: :partners) + block = pa.blocks.create(position: 1, published: true, template_kind: :organizations) block.data = "{ \"elements\": [ { \"id\": \"#{noesya.id}\" } ] }" block.save end @@ -102,7 +102,7 @@ def test_deleting_direct_with_indirect_dependency_having_two_sources setup_page_connections(page) second_page = communication_website_pages(:page_test) - block = second_page.blocks.create(position: 1, published: true, template_kind: :partners) + block = second_page.blocks.create(position: 1, published: true, template_kind: :organizations) block.data = "{ \"elements\": [ { \"id\": \"#{noesya.id}\" } ] }" block.save @@ -154,28 +154,28 @@ def setup_page_connections(page) # On connecte PA via un block "Personnes" : +2 assert_difference -> { Communication::Website::Connection.count } => 2 do - block = page.blocks.create(position: 2, published: true, template_kind: :organization_chart) + block = page.blocks.create(position: 2, published: true, template_kind: :people) block.data = "{ \"elements\": [ { \"id\": \"#{pa.id}\" } ] }" block.save end # On ajoute noesya via un block "Organisations" : +4 parce que noesya a un block "Personnes" avec Olivia assert_difference -> { Communication::Website::Connection.count } => 4 do - block = page.blocks.create(position: 3, published: true, template_kind: :partners) + block = page.blocks.create(position: 3, published: true, template_kind: :organizations) block.data = "{ \"elements\": [ { \"id\": \"#{noesya.id}\" } ] }" block.save end # On ajoute Arnaud à noesya via un block "Personnes" : +2 assert_difference -> { Communication::Website::Connection.count } => 2 do - block = noesya.blocks.create(position: 2, published: true, template_kind: :organization_chart) + block = noesya.blocks.create(position: 2, published: true, template_kind: :people) block.data = "{ \"elements\": [ { \"id\": \"#{arnaud.id}\" } ] }" block.save end # On tente la boucle infine en ajoutant noesya à Olivia : +1 (le block ajouté à Olivia) assert_difference -> { Communication::Website::Connection.count } => 1 do - block = olivia.blocks.create(position: 1, published: true, template_kind: :partners) + block = olivia.blocks.create(position: 1, published: true, template_kind: :organizations) block.data = "{ \"elements\": [ { \"id\": \"#{noesya.id}\" } ] }" block.save end diff --git a/test/models/communication/website/dependency_test.rb b/test/models/communication/website/dependency_test.rb index 5d3b4c37c..dbff01842 100644 --- a/test/models/communication/website/dependency_test.rb +++ b/test/models/communication/website/dependency_test.rb @@ -20,7 +20,7 @@ def test_change_block_dependencies # - 4 composants du template du block + 1 élément (5) # - 2 composants de l'élément du template (2) # - la personne en dépendance du composant Person (1) - block = page.blocks.create(position: 1, published: true, template_kind: :organization_chart) + block = page.blocks.create(position: 1, published: true, template_kind: :people) block.data = "{ \"elements\": [ { \"id\": \"#{arnaud.id}\" } ] }" block.save