Skip to content

Commit

Permalink
Merge pull request #1576 from noesya/photo_credits_for_orgas_and_people
Browse files Browse the repository at this point in the history
Ajout de champs crédits pour les orgas et les personnes
  • Loading branch information
pabois committed Jan 29, 2024
2 parents e628337 + 02454bd commit 2fb756f
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/university/people_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def person_params
: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: []
Expand Down
1 change: 1 addition & 0 deletions app/models/university/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions app/views/admin/university/people/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 5 additions & 0 deletions app/views/admin/university/people/_main_infos.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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? %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/university/people/static.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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) %>
Expand Down
1 change: 1 addition & 0 deletions config/locales/university/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions config/locales/university/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20240129100647_add_photo_credits_to_people.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPhotoCreditsToPeople < ActiveRecord::Migration[7.1]
def change
add_column :university_people, :picture_credit, :text
end
end
3 changes: 2 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2fb756f

Please sign in to comment.