diff --git a/app/assets/stylesheets/commons/_summernote.sass b/app/assets/stylesheets/commons/_summernote.sass index 0018e401ec1b29d547203852007272c47d4690e5..a18ae77033305ecdc3b41647250af2223dc2a553 100644 --- a/app/assets/stylesheets/commons/_summernote.sass +++ b/app/assets/stylesheets/commons/_summernote.sass @@ -17,4 +17,14 @@ .note-editable > h2:first-of-type margin-top: 0 .note-editing-area - background: white \ No newline at end of file + background: white + .sn-checkbox-open-in-new-window + label + padding: 0 + input + margin-right: 10px + vertical-align: text-top + .sn-checkbox-use-protocol + display: none + .note-modal-footer + height: 52px diff --git a/app/models/communication/block/template/call_to_action.rb b/app/models/communication/block/template/call_to_action.rb index 5f8c6fe1cd4b09b0e96d7b3fbde136b244304e75..0bbdb6071d59135e6c50bc7cd6bb51e16cb378ce 100644 --- a/app/models/communication/block/template/call_to_action.rb +++ b/app/models/communication/block/template/call_to_action.rb @@ -2,12 +2,15 @@ class Communication::Block::Template::CallToAction < Communication::Block::Templ def sanitized_data { "text" => Osuny::Sanitizer.sanitize(text), - "url" => url, "button" => Osuny::Sanitizer.sanitize(button, 'string'), - "url_secondary" => url_secondary, "button_secondary" => Osuny::Sanitizer.sanitize(button_secondary, 'string'), - "url_tertiary" => url_tertiary, "button_tertiary" => Osuny::Sanitizer.sanitize(button_tertiary, 'string'), + "url" => url, + "url_secondary" => url_secondary, + "url_tertiary" => url_tertiary, + "target_blank" => target_blank, + "target_blank_secondary" => target_blank_secondary, + "target_blank_tertiary" => target_blank_tertiary, "image" => data['image'], "image_alt" => Osuny::Sanitizer.sanitize(data['image_alt'], 'string'), "image_credit" => Osuny::Sanitizer.sanitize(data['image_credit'], 'string') @@ -30,6 +33,10 @@ class Communication::Block::Template::CallToAction < Communication::Block::Templ "#{data['button']}" end + def target_blank + data['target_blank'] == true + end + def url_secondary "#{data['url_secondary']}" end @@ -38,10 +45,18 @@ class Communication::Block::Template::CallToAction < Communication::Block::Templ "#{data['button_secondary']}" end + def target_blank_secondary + data['target_blank_secondary'] == true + end + def url_tertiary "#{data['url_tertiary']}" end + def target_blank_tertiary + data['target_blank_tertiary'] == true + end + def button_tertiary "#{data['button_tertiary']}" end 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 209a0b71b7bf1cfa67961af5288c54097be6b24d..7928bd7b92afbb70081cdf7cc137fb1e4ccc622d 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 @@ -57,43 +57,56 @@ placeholder="<%= t '.image_credit_placeholder' %>" /> </div> </div> -<h2><%= t '.buttons' %></h2> -<div class="row"> - <div class="col-xxl-4 col-md-6 mb-4"> - <h3 class="h4"><%= t '.button_1' %></h3> - +<h3 class="h4"><%= t '.button_1' %></h3> +<div class="row mb-5"> + <div class="col-lg-3"> <label class="form-label" for="button"> <%= t '.button_label' %> </label> <input id="button" type="text" - class="form-control" + class="form-control mb-3" v-model="data.button" placeholder="<%= t '.button_placeholder' %>" /> - - <label class="form-label mt-3" for="url"> + </div> + <div class="col-lg-5"> + <label class="form-label" for="url"> <%= t '.url_label' %> </label> - <input id="url" + <input id="url" type="url" class="form-control" v-model="data.url" placeholder="<%= t '.url_placeholder' %>" /> - </div> - <div class="col-xxl-4 col-md-6 mb-4"> - <h3 class="h4"><%= t '.button_2' %></h3> + <div class="col-lg-4"> + <label class="form-label"> </label> + <div class="form-check"> + <input id="target_blank" + type="checkbox" + class="form-check-input boolean optional" + v-model="data.target_blank"> + <label class="form-label" for="target_blank"> + <%= t 'admin.communication.blocks.components.link.target_blank' %> + </label> + </div> + </div> +</div> +<h3 class="h4"><%= t '.button_2' %></h3> +<div class="row mb-5"> + <div class="col-lg-3"> <label class="form-label" for="button_secondary"> <%= t '.button_label' %> </label> <input id="button_secondary" type="text" - class="form-control" + class="form-control mb-3" v-model="data.button_secondary" placeholder="<%= t '.button_placeholder' %>" /> - - <label class="form-label mt-3" for="url_secondary"> + </div> + <div class="col-lg-5"> + <label class="form-label" for="url_secondary"> <%= t '.url_label' %> </label> <input id="url_secondary" @@ -102,19 +115,35 @@ v-model="data.url_secondary" placeholder="<%= t '.url_placeholder' %>" /> </div> - <div class="col-xxl-4 col-md-6 mb-4"> - <h3 class="h4"><%= t '.button_3' %></h3> + <div class="col-lg-4"> + <label class="form-label"> </label> + <div class="form-check"> + <input id="target_blank_secondary" + type="checkbox" + class="form-check-input boolean optional" + v-model="data.target_blank_secondary"> + <label class="form-label" for="target_blank_secondary"> + <%= t 'admin.communication.blocks.components.link.target_blank' %> + </label> + </div> + </div> +</div> + +<h3 class="h4"><%= t '.button_3' %></h3> +<div class="row mb-5"> + <div class="col-lg-3"> <label class="form-label" for="button_tertiary"> <%= t '.button_label' %> </label> <input id="button_tertiary" type="text" - class="form-control" + class="form-control mb-3" v-model="data.button_tertiary" placeholder="<%= t '.button_placeholder' %>" /> - - <label class="form-label mt-3" for="url_tertiary"> + </div> + <div class="col-lg-5"> + <label class="form-label" for="url_tertiary"> <%= t '.url_label' %> </label> <input id="url_tertiary" @@ -123,4 +152,16 @@ v-model="data.url_tertiary" placeholder="<%= t '.url_placeholder' %>" /> </div> + <div class="col-lg-4"> + <label class="form-label"> </label> + <div class="form-check"> + <input id="target_blank_tertiary" + type="checkbox" + class="form-check-input boolean optional" + v-model="data.target_blank_tertiary"> + <label class="form-label" for="target_blank_tertiary"> + <%= t 'admin.communication.blocks.components.link.target_blank' %> + </label> + </div> + </div> </div> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb index c2c514ca009cbb50c034c1ecaddcd88584190d0d..cbc779dcec1065b5351677e4eedcca6cebee80f3 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb @@ -12,13 +12,16 @@ <%= prepare_text_for_static block.template.button, 5 %> url: >- <%= prepare_text_for_static block.template.url, 5 %> + target_blank: <%= block.template.target_blank %> button_secondary: text: >- <%= prepare_text_for_static block.template.button_secondary, 5 %> url: >- <%= prepare_text_for_static block.template.url_secondary, 5 %> + target_blank: <%= block.template.target_blank_secondary %> button_tertiary: text: >- <%= prepare_text_for_static block.template.button_tertiary, 5 %> url: >- <%= prepare_text_for_static block.template.url_tertiary, 5 %> + target_blank: <%= block.template.target_blank_tertiary %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index ff37343833bfc9a1a5205221dee0c99744d7e481..cd6b7dba1818fa50c32c0aee7086652725a5f7bf 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -138,12 +138,15 @@ en: label: Credit placeholder: Enter credit file: - not_linked: Pas de fichier lié + not_linked: No linked file + link: + target_blank: Open in new window template_kinds: call_to_action: edit: button_1: Primary button button_2: Secondary button + button_3: Tertiary button button_label: Text button_placeholder: Enter the button text here buttons: Action buttons diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 61518c6a4da67b012d4333cf5140740d37508cd3..838825281a4c80cbd5ae665e2b8a039cb4846064 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -139,12 +139,15 @@ fr: placeholder: Entrer le crédit file: not_linked: Pas de fichier lié + link: + target_blank: Ouvrir dans une nouvelle fenêtre templates: call_to_action: edit: button_1: Bouton principal button_2: Bouton secondaire + button_3: Bouton tertiaire button_label: Texte button_placeholder: Entrer le texte du bouton ici buttons: Boutons d'action diff --git a/db/schema.rb b/db/schema.rb index 5d00fa8ee7a9a0cc54c84b41962d496d999c5313..eaaa424e178e80a70dbee61b7e0e1237a1d21d6c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -502,6 +502,23 @@ ActiveRecord::Schema.define(version: 2022_05_23_172753) 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 "imports", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.integer "number_of_lines" t.jsonb "processing_errors" @@ -696,8 +713,8 @@ ActiveRecord::Schema.define(version: 2022_05_23_172753) 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