diff --git a/app/controllers/admin/university/people_controller.rb b/app/controllers/admin/university/people_controller.rb index d67706aa5df03b24ebcfca286d45778b29609162..da83493acbb45a2c3f44a318548f7a9cd5ed4f20 100644 --- a/app/controllers/admin/university/people_controller.rb +++ b/app/controllers/admin/university/people_controller.rb @@ -109,7 +109,7 @@ class Admin::University::PeopleController < Admin::University::ApplicationContro :phone_mobile, :phone_professional, :phone_personal, :address, :zipcode, :city, :country, :meta_description, :summary, - :biography, :picture, :picture_delete, :picture_infos, + :biography, :picture, :picture_delete, :picture_infos, :picture_credit, :habilitation, :tenure, :url, :linkedin, :twitter, :mastodon, :is_researcher, :is_teacher, :is_administration, :is_alumnus, :user_id, research_laboratory_ids: [], category_ids: [] diff --git a/app/models/university/person.rb b/app/models/university/person.rb index 8f7e1823e9eb277c60dde5972d576a8231dbc321..97b12794f2ad25ca0514c8cfe21e4d55d696cef1 100644 --- a/app/models/university/person.rb +++ b/app/models/university/person.rb @@ -25,6 +25,7 @@ # phone_mobile :string # phone_personal :string # phone_professional :string +# picture_credit :text # slug :string indexed # summary :text # tenure :boolean default(FALSE) diff --git a/app/views/admin/university/people/_form.html.erb b/app/views/admin/university/people/_form.html.erb index 157cb8266a211c722151f6ed187ab1db6b4560b6..2ca25b424da18b91072ba08561930ca9cb524bbe 100644 --- a/app/views/admin/university/people/_form.html.erb +++ b/app/views/admin/university/people/_form.html.erb @@ -118,6 +118,15 @@ preview: 200, resize: 1, direct_upload: true %> + <%= f.input :picture_credit, + as: :summernote, + hint: t('featured_image.credit.hint'), + input_html: { + data: { + translatable: true, + 'summernote-config' => 'link' + } + } %> <% end %> <%= render 'admin/application/meta_description/form', f: f, about: person %> </div> diff --git a/app/views/admin/university/people/_main_infos.html.erb b/app/views/admin/university/people/_main_infos.html.erb index 475f57b97554f534d1c9cb99521b2e7d6a7a6ff2..71de767a454452eb8dd32e14ad0ddd46c3f4e874 100644 --- a/app/views/admin/university/people/_main_infos.html.erb +++ b/app/views/admin/university/people/_main_infos.html.erb @@ -10,6 +10,11 @@ </span> </p> <% end %> + <% if person.picture_credit.present? %> + <div class="small mb-0"> + <%= sanitize person.picture_credit %> + </div> + <% end %> <% end if person.best_picture.attached? %> <% if person.categories.any? %> diff --git a/app/views/admin/university/people/static.html.erb b/app/views/admin/university/people/static.html.erb index f7f169bed8a5e228140beb007c2107f57a088236..74085ceb6cf5a9eab311c45c862f1cd3e34da15b 100644 --- a/app/views/admin/university/people/static.html.erb +++ b/app/views/admin/university/people/static.html.erb @@ -40,6 +40,8 @@ contact_details: <%= render 'admin/application/static/contact_detail', variable: :email, data: @about.email, kind: ContactDetails::Email %> <% if @about.best_picture.attached? %> image: "<%= @about.best_picture.blob.id %>" +credit: >- + <%= prepare_html_for_static @about.picture_credit, @about.university %> <% end %> roles: <% if @about.author.for_website?(@website) %> diff --git a/config/locales/university/en.yml b/config/locales/university/en.yml index 032c07762af0f890387037d009e578937d84030c..eb9bb65e3164d34a019aa3f5513ffdbc6dbbb370 100644 --- a/config/locales/university/en.yml +++ b/config/locales/university/en.yml @@ -92,6 +92,7 @@ en: phone_personal: Personal phone phone_professional: Professional phone picture: Profile picture + picture_credit: Credit research_journal_papers: Papiers research_laboratories: Research laboratories researcher: Researcher diff --git a/config/locales/university/fr.yml b/config/locales/university/fr.yml index 407e8a7b09e502717a3d35fbb023a220ee4beb56..b070cac54414cbd8e085e85330315a0f500090be 100644 --- a/config/locales/university/fr.yml +++ b/config/locales/university/fr.yml @@ -92,6 +92,7 @@ fr: phone_personal: Téléphone personnel phone_professional: Téléphone professionnel picture: Photo de profil + picture_credit: Crédit research_journal_papers: Papiers research_laboratories: Laboratoires de recherche researcher: Chercheur·e diff --git a/db/migrate/20240129100647_add_photo_credits_to_people.rb b/db/migrate/20240129100647_add_photo_credits_to_people.rb new file mode 100644 index 0000000000000000000000000000000000000000..72fd5f44f36fe18ab102dcc480bac7d698df35d5 --- /dev/null +++ b/db/migrate/20240129100647_add_photo_credits_to_people.rb @@ -0,0 +1,5 @@ +class AddPhotoCreditsToPeople < ActiveRecord::Migration[7.1] + def change + add_column :university_people, :picture_credit, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index 5c1856bba5ba926a1821758fb9aa06f774542b60..f6ea6ac594ca9c363ac720e1b2d557a3cbb08df0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_01_17_145932) do +ActiveRecord::Schema[7.1].define(version: 2024_01_29_100647) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -1015,6 +1015,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_17_145932) do t.string "mastodon" t.uuid "language_id", null: false t.uuid "original_id" + t.text "picture_credit" t.index ["language_id"], name: "index_university_people_on_language_id" t.index ["original_id"], name: "index_university_people_on_original_id" t.index ["slug"], name: "index_university_people_on_slug"