Skip to content
Snippets Groups Projects
Unverified Commit ada8197c authored by Arnaud Levy's avatar Arnaud Levy Committed by GitHub
Browse files

add logo (#1812)

parent 040b5427
No related branches found
No related tags found
No related merge requests found
......@@ -113,6 +113,7 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro
:meta_description, :summary, :published,
:capacity, :continuing, :initial, :apprenticeship,
:qualiopi_certified, :qualiopi_text,
:logo, :logo_delete,
:featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt, :featured_image_credit,
:prerequisites, :objectives, :presentation, :registration, :pedagogy, :content, :registration_url,
:evaluation, :accessibility, :contacts, :opportunities, :results, :other, :main_information,
......
......@@ -108,11 +108,13 @@ class Education::Program < ApplicationRecord
foreign_key: :parent_id
has_one_attached_deletable :downloadable_summary
has_one_attached_deletable :logo
before_destroy :move_children
validates_presence_of :name
validates :downloadable_summary, size: { less_than: 50.megabytes }
validates :logo, size: { less_than: 5.megabytes }
scope :published, -> { where(published: true) }
scope :ordered_by_name, -> { order(:name) }
......@@ -213,7 +215,11 @@ class Education::Program < ApplicationRecord
end
def explicit_blob_ids
super.concat [featured_image&.blob_id, downloadable_summary&.blob_id]
super.concat [
featured_image&.blob_id,
downloadable_summary&.blob_id,
logo&.blob_id
]
end
def inherited_blob_ids
......
......@@ -172,6 +172,11 @@
label_method: ->(p) { sanitize p[:label] },
value_method: ->(p) { p[:id] } %>
<%= f.input :bodyclass %>
<%= f.input :logo,
as: :single_deletable_file,
hint: images_formats_accepted_hint,
input_html: { accept: default_images_formats_accepted }
%>
<% end %>
<%= render 'admin/application/featured_image/edit', about: program, f: f %>
<%= render 'admin/application/meta_description/form', f: f, about: program %>
......
......@@ -7,6 +7,10 @@
<% end %>
</div>
<div class="offset-lg-1 col-lg-3">
<% if @program.logo.attached? %>
<%= osuny_label Education::Program.human_attribute_name('logo') %>
<%= kamifusen_tag @program.logo, class: 'img-fluid mb-5' %>
<% end %>
<%= render 'admin/application/featured_image/show', about: @program, small: true %>
</div>
</div>
......
......@@ -33,6 +33,10 @@ parent:
url: <%= @about.parent.current_permalink_in_website(@website)&.path %>
<% end %>
<%= render 'admin/application/featured_image/static' %>
<% if @about.logo.attached? %>
logo:
id: "<%= @about.logo.blob.id %>"
<% end %>
related_category: "<%= @website.post_categories.find_by(program_id: @about.id)&.slug_with_ancestors_slugs %>"
diplomas: "<%= @about.diploma&.slug %>"
duration: >
......
......@@ -57,6 +57,7 @@ en:
is_published: Published
is_draft: Draft
locations: Campus
logo: Program logo
main_information: Main information
name: Name
objectives: Objectifs
......
......@@ -57,6 +57,7 @@ fr:
is_published: Publiée
is_draft: Brouillon
locations: Campus
logo: Logo de la formation
main_information: Informations essentielles
name: Nom
objectives: Objectifs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment