diff --git a/app/views/admin/communication/blocks/_preview.html.erb b/app/views/admin/communication/blocks/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..72d57e3ae7ad6244f32e791ac6204ec3af38cd3a --- /dev/null +++ b/app/views/admin/communication/blocks/_preview.html.erb @@ -0,0 +1,6 @@ +<h2 class="h4 mt-5"><%= block.title %></h2> +<% +@block = block +@preview = true +%> +<%= render "admin/communication/blocks/templates/#{@block.template_kind}/show" %> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb index db8501c429ddb80d89d16d221a164b7d57c0e136..74caee4a0f55716c0f7d1eb925d5abbd42cbc358 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb @@ -1,6 +1,5 @@ -<div class="row"> +<div class="row mb-5"> <div class="col-xxl-4 col-md-6"> - <h3>Contenu</h3> <label class="form-label" for="text"> <%= t '.text_label' %> @@ -12,88 +11,86 @@ data-summernote-config="mini" placeholder="<%= t '.text_placeholder' %>"></textarea> </div> - <h3 class="mt-4"><%= t '.image_title' %></h3> - <div class="row"> - <div class="col-md-6"> - <div v-if="!data.image"> - <%# TODO : create a uploader vue3 component %> - <label class="form-label" - for="image"> - <%= t '.image_label' %> - </label> - <input class="form-control mb-2" - type="file" - accept="image/*" - @change="onFileImageChange( $event, data, 'image' )" - id="image"> - </div> - <div v-if="data.image"> - <img :src="getImageUrl(data.image)" - class="img-fluid" - style="max-height: 80px" - /> - <br> - <a class="btn btn-sm btn-danger mt-2" - v-on:click="data.image=null"> - <i class="fas fa-times"></i> - <%= t '.remove_image' %> - </a> - </div> - </div> - <div class="col-md-6"> - <label class="form-label" - for="image_alt"> - <%= t '.image_alt_label' %> - </label> - <input id="image_alt" - type="text" - class="form-control" - v-model="data.image_alt" - placeholder="<%= t '.image_alt_placeholder' %>" /> - </div> - </div> </div> <div class="col-xxl-4 col-md-6"> - <h3>Bouton principal</h3> + <div v-if="!data.image"> + <%# TODO : create a uploader vue3 component %> + <label class="form-label" + for="image"> + <%= t '.image_title' %> + </label> + <input class="form-control mb-2" + type="file" + accept="image/*" + @change="onFileImageChange( $event, data, 'image' )" + id="image"> + </div> + <div v-if="data.image"> + <img :src="getImageUrl(data.image)" + class="img-fluid" + style="max-height: 80px" + /> + <br> + <a class="btn btn-sm btn-danger mt-2" + v-on:click="data.image=null"> + <i class="fas fa-times"></i> + <%= t '.remove_image' %> + </a> + </div> <label class="form-label" - for="url"> - <%= t '.url_label' %> + for="image_alt"> + <%= t '.image_alt_label' %> </label> - <input id="url" - type="url" + <input id="image_alt" + type="text" class="form-control" - v-model="data.url" - placeholder="<%= t '.url_placeholder' %>" /> + v-model="data.image_alt" + placeholder="<%= t '.image_alt_placeholder' %>" /> + </div> +</div> +<h2><%= t '.buttons' %></h2> +<div class="row"> + <div class="col-xxl-4 col-md-6"> + <h3 class="h4"><%= t '.button_1' %></h3> - <label class="form-label mt-3" - for="button"> + <label class="form-label" for="button"> <%= t '.button_label' %> </label> - <input id="button" + <input id="button" type="text" class="form-control" v-model="data.button" placeholder="<%= t '.button_placeholder' %>" /> - <h3 class="mt-4">Bouton secondaire</h3> - <label class="form-label" - for="url_secondary"> + <label class="form-label mt-3" for="url"> <%= t '.url_label' %> </label> - <input id="url_secondary" + <input id="url" type="url" class="form-control" - v-model="data.url_secondary" + v-model="data.url" placeholder="<%= t '.url_placeholder' %>" /> - <label class="form-label mt-3" - for="button"> + + </div> + <div class="col-xxl-4 col-md-6"> + <h3 class="h4"><%= t '.button_2' %></h3> + + <label class="form-label" for="button"> <%= t '.button_label' %> </label> - <input id="button_secondary" + <input id="button_secondary" type="text" class="form-control" v-model="data.button_secondary" placeholder="<%= t '.button_placeholder' %>" /> + <label class="form-label mt-3" for="url_secondary"> + <%= t '.url_label' %> + </label> + <input id="url_secondary" + type="url" + class="form-control" + v-model="data.url_secondary" + placeholder="<%= t '.url_placeholder' %>" /> </div> -</div> \ No newline at end of file +</div> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_show.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_show.html.erb index 6acdd62e330833956c01b7b1109f75ea3f4ed947..bb36af7503343bb9e10a3630df0e96522018e057 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_show.html.erb @@ -1,23 +1,35 @@ -<div class="col-md-8 col-xl-6"> - <div class="card"> - <div class="card-body"> - <% if @block.template.image %> - <div style= "max-width: 200px;" class="me-3"> - <%= kamifusen_tag @block.template.image.blob, - width: 200, - alt: @block.template.image.alt, - class: 'img-fluid' %> - <caption><%= @block.template.image.alt %></caption> - </div> - <% end %> - <hr> - <%= @block.template.text.html_safe %> - <a href="<%= @block.template.url %>" class="btn btn-primary" target="_blank" rel="noopener"> - <%= @block.template.button %> - </a> - <a href="<%= @block.template.url_secondary %>" class="btn btn-secondary" target="_blank" rel="noopener"> - <%= @block.template.button_secondary %> - </a> +<div class="<%= 'row' unless @preview %>"> + <div class="<%= 'col-md-8 col-xl-6' unless @preview %>"> + <div class="card"> + <div class="card-body"> + <% if @block.template.image %> + <div style= "max-width: 200px;" class="me-3"> + <%= kamifusen_tag @block.template.image.blob, + width: 200, + alt: @block.template.image.alt, + class: 'img-fluid' %> + <caption><%= @block.template.image.alt %></caption> + </div> + <hr> + <% end %> + <%= @block.template.text.html_safe %> + <% unless @block.template.url.blank? %> + <a href="<%= @block.template.url %>" + class="btn btn-primary" + target="_blank" + rel="noopener"> + <%= @block.template.button %> + </a> + <% end %> + <% unless @block.template.url_secondary.blank? %> + <a href="<%= @block.template.url_secondary %>" + class="btn btn-secondary" + target="_blank" + rel="noopener"> + <%= @block.template.button_secondary %> + </a> + <% end %> + </div> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb b/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb index 0f570a940377bc1cb0e1c86608d893742bdc86f7..f9af3e9f1f779e9f5545b946b570b0abc9d331da 100644 --- a/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb @@ -1,5 +1,5 @@ -<div class="row"> - <div class="col-xxl-4 col-md-6"> +<div class="row mb-4"> + <div class="col-md-6"> <label class="form-label" for="text"> <%= t '.text_label' %> @@ -14,7 +14,7 @@ </div> </div> <div class="row"> - <div class="col-xxl-4 col-md-6"> + <div class="col-md-6"> <label class="form-label" for="notes"> <%= t '.notes_label' %> diff --git a/app/views/admin/communication/blocks/templates/gallery/_show.html.erb b/app/views/admin/communication/blocks/templates/gallery/_show.html.erb index 0317b5ab85c4ec3ae2e2434148c27e6d5fb6164e..85b3ef064ef15f41b44eeade08097b24746e3299 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_show.html.erb @@ -1,6 +1,6 @@ -<div class="row"> +<div class="<%= 'row' unless @preview %>"> <% @block.template.images_with_alt.each do |image| %> - <div class="col-xxl-2 col-xl-3 col-6"> + <div class="<%= 'col-xxl-2 col-xl-3 col-6' unless @preview %>"> <article class="card"> <% if image.blob %> <%= kamifusen_tag image.blob, width: 500, class: 'img-fluid mb-2' %> diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb b/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb index d3b94cf8375e02c1c775c1d7deace62577bb91a6..f0181c8f801110e335636fdf6937065c9b3c0b5c 100644 --- a/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb @@ -1,7 +1,7 @@ -<div class="row"> +<div class="<%= 'row' unless @preview %>"> <% @block.template.persons_with_role.each do |person_with_role| person = person_with_role.person %> - <div class="col-md-3"> + <div class="<%= 'col-md-3' unless @preview %>"> <article class="card"> <div class="card-body"> <% if person.best_picture.attached? %> diff --git a/app/views/admin/communication/blocks/templates/pages/_show.html.erb b/app/views/admin/communication/blocks/templates/pages/_show.html.erb index 4ea468c6f75c783707c3d7db3edb64c6ce2ac8b8..2175cc87a7b1a018eda00daa0059ecf2c3d2a79f 100644 --- a/app/views/admin/communication/blocks/templates/pages/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_show.html.erb @@ -3,9 +3,9 @@ <h2 class="mb-4"><%= @block.template.main_page.slug %></h2> <% end %> <% if @block.template.selected_pages.any? %> - <div class="row"> + <div class="<%= 'row' unless @preview %>"> <% @block.template.selected_pages.each do |element| %> - <div class="col-md-4"> + <div class="<%= 'col-md-4' unless @preview %>"> <div class="card"> <div class="card-header"> <h3 class="card-title h5"><%= element.page %></h3> diff --git a/app/views/admin/communication/blocks/templates/partners/_show.html.erb b/app/views/admin/communication/blocks/templates/partners/_show.html.erb index 5417072ca991d5276224c96957e1acd61ae51039..6c9a10ff598b736478c2963eee42186f3c0a2194 100644 --- a/app/views/admin/communication/blocks/templates/partners/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_show.html.erb @@ -1,6 +1,6 @@ -<div class="row"> +<div class="<%= 'row' unless @preview %>"> <% @block.template.partners.each do |partner| %> - <div class="col-md-2"> + <div class="<%= 'col-md-2' unless @preview %>"> <article class="card"> <%= kamifusen_tag partner.blob, width: 300, diff --git a/app/views/admin/communication/blocks/templates/posts/_show.html.erb b/app/views/admin/communication/blocks/templates/posts/_show.html.erb index 06a38ef4d9c3781774271dd075a20b6fa58ad964..7f6d68cf166042ca1dddb307bacb87b7910d598e 100644 --- a/app/views/admin/communication/blocks/templates/posts/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/posts/_show.html.erb @@ -3,9 +3,9 @@ <h2 class="mb-4"><%= @block.template.category %></h2> <% end %> <% if @block.template.selected_posts.any? %> - <div class="row"> + <div class="<%= 'row' unless @preview %>"> <% @block.template.selected_posts.each do |post| %> - <div class="col-md-4"> + <div class="<%= 'col-md-4' unless @preview %>"> <div class="card"> <div class="card-header"> <h3 class="card-title h5"><%= post %></h3> diff --git a/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb index 6d8007f766d71ce160ad4534ad0882239456c845..1237e4918d078c790a58ec14957646e7a873242d 100644 --- a/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb @@ -1,6 +1,6 @@ -<div class="row"> +<div class="<%= 'row' unless @preview %>"> <% @block.template.testimonials.each do |testimonial| %> - <div class="col-xxl-4 col-xl-6"> + <div class="<%= 'col-xxl-4 col-xl-6' unless @preview %>"> <article class="card"> <div class="card-body"> <p class="lead"> diff --git a/app/views/admin/communication/blocks/templates/timeline/_show.html.erb b/app/views/admin/communication/blocks/templates/timeline/_show.html.erb index 461a8243f8eaabd4a1e9dc28fdc4d4718fe1c337..0bbdf7c177564249e2b38b7bf99ccb84bce72848 100644 --- a/app/views/admin/communication/blocks/templates/timeline/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/timeline/_show.html.erb @@ -1,7 +1,7 @@ <p><%= @block.template.description %></p> -<div class="row"> +<div class="<%= 'row' unless @preview %>"> <% @block.template.events.each do |event| %> - <div class="col-xxl-4 col-xl-6"> + <div class="<%= 'col-xxl-4 col-xl-6' unless @preview %>"> <article class="card"> <div class="card-body"> <p class="lead"><%= event.title %></p> diff --git a/app/views/admin/communication/website/pages/show.html.erb b/app/views/admin/communication/website/pages/show.html.erb index c21247fd9894e5bd6375e7431b857d2a463e67d0..0b2f141b9b4d9fcf8fa8706b8dac10510e802cf8 100644 --- a/app/views/admin/communication/website/pages/show.html.erb +++ b/app/views/admin/communication/website/pages/show.html.erb @@ -127,6 +127,9 @@ <% content_for :preview do %> <%= @page.text.to_s %> + <% @page.blocks.ordered.each do |block| %> + <%= render 'admin/communication/blocks/preview', block: block %> + <% end %> <% end %> <% content_for :action_bar_left do %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 22b74a1f11458031f17f16d7a46bd3f5a2175128..b765057ff1cc7561381642e1cfdbc5a39c8280db 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -187,12 +187,15 @@ en: text_placeholder: Enter text here call_to_action: edit: - text_label: Texte - text_placeholder: Entrer le texte ici + text_label: Text + text_placeholder: Enter text here url_label: Lien - url_placeholder: Entrer le lien ici avec "https://..." - button_label: Bouton - button_placeholder: Entrer le texte du bouton ici + url_placeholder: Enter the URL with "https://..." + buttons: Action buttons + button_1: Primary button + button_2: Secondary button + button_label: Text + button_placeholder: Enter the button text here image_title: Image image_label: Fichier remove_image: Supprimer l'image diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 0fce32c9e07ef3652c8a2a1f5ccccd8ae127f402..37bf9f61782e04c7696cc994084d0c972d41c932 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -193,7 +193,10 @@ fr: text_placeholder: Entrer le texte ici url_label: Lien url_placeholder: Entrer le lien ici avec "https://..." - button_label: Bouton + buttons: Boutons d'action + button_1: Bouton principal + button_2: Bouton secondaire + button_label: Texte button_placeholder: Entrer le texte du bouton ici image_title: Image image_label: Fichier diff --git a/db/schema.rb b/db/schema.rb index eddfbeb5196552a36c62182a3bd46a45fb5fd958..4c5f75e298ca6a282c02fd174577cd38ba7d4d40 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -121,6 +121,7 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.string "path" t.string "featured_image_alt" t.text "text" + t.text "featured_image_credit" t.index ["communication_website_id"], name: "idx_communication_website_post_cats_on_communication_website_id" t.index ["parent_id"], name: "index_communication_website_categories_on_parent_id" t.index ["program_id"], name: "index_communication_website_categories_on_program_id" @@ -308,6 +309,7 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.integer "kind" t.string "bodyclass" t.uuid "language_id" + t.text "featured_image_credit" t.index ["communication_website_id"], name: "index_communication_website_pages_on_communication_website_id" t.index ["language_id"], name: "index_communication_website_pages_on_language_id" t.index ["parent_id"], name: "index_communication_website_pages_on_parent_id" @@ -332,6 +334,7 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.text "text" t.text "description_short" t.uuid "language_id" + t.text "featured_image_credit" t.index ["author_id"], name: "index_communication_website_posts_on_author_id" t.index ["communication_website_id"], name: "index_communication_website_posts_on_communication_website_id" t.index ["language_id"], name: "index_communication_website_posts_on_language_id" @@ -447,6 +450,7 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.text "results" t.text "presentation" t.text "main_information" + t.text "featured_image_credit" t.index ["parent_id"], name: "index_education_programs_on_parent_id" t.index ["university_id"], name: "index_education_programs_on_university_id" end @@ -486,6 +490,23 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.index ["university_id"], name: "index_education_schools_on_university_id" end + create_table "external_organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.string "title" + t.text "description" + t.string "address" + t.string "zipcode" + t.string "city" + t.string "country" + t.string "website" + t.string "phone" + t.string "mail" + t.boolean "active" + t.string "sirene" + t.integer "kind" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + create_table "languages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.string "iso_code" @@ -537,6 +558,7 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.string "featured_image_alt" t.boolean "published", default: false t.text "text" + t.text "featured_image_credit" t.index ["research_journal_id"], name: "index_research_journal_volumes_on_research_journal_id" t.index ["university_id"], name: "index_research_journal_volumes_on_university_id" end @@ -675,8 +697,8 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.string "linkedin" t.boolean "is_alumnus", default: false t.text "description_short" - t.boolean "is_author" t.string "name" + t.boolean "is_author" t.index ["university_id"], name: "index_university_people_on_university_id" t.index ["user_id"], name: "index_university_people_on_user_id" end