Skip to content
Snippets Groups Projects
Unverified Commit 510ea35d authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

image jekyll program

parent 7342dc7a
No related branches found
No related tags found
No related merge requests found
......@@ -85,6 +85,13 @@ class Education::Program < ApplicationRecord
description.blank? ? parent&.best_description : description
end
def best_featured_image(fallback: true)
return featured_image if featured_image.attached?
best_image = parent&.best_featured_image(fallback: false)
best_image ||= featured_image if fallback
best_image
end
# Override from WithGithubFiles
def github_path_generated
"_programs/#{path}/index.html".gsub(/\/+/, '/')
......
......@@ -7,6 +7,9 @@ continuing: <%= @program.continuing %>
level: <%= @program.level %>
ects: <%= @program.ects %>
position: <%= @program.position %>
<% if @program.best_featured_image.attached? %>
image: "<%= @program.best_featured_image.blob.id %>"
<% end %>
<% if @program.teachers.any? %>
teachers:
<% @program.teachers.each do |teacher| %>
......
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