Skip to content
Snippets Groups Projects
Commit eb2f2ca6 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

Wip #385

parent e8fe2980
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,17 @@ class Education::Diploma < ApplicationRecord
doctor: 800
}
def websites
@websites ||= university.websites.reject { |website|
!for_website?(website)
}
end
# We need to send the diplomas only to the websites that need them
def for_website?(website)
website.education_programs.published.where(diploma: self).any?
end
def git_path(website)
"content/diplomas/#{slug}/_index.html"
end
......
<%= simple_form_for [:admin, diploma] do |f| %>
<%= f.error_notification %>
<%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
<div class="row">
<div class="col-lg-6">
<%= f.input :name %>
</div>
<div class="col-lg-3">
<%= f.input :short_name %>
</div>
<div class="col-lg-3">
<%= f.input :level, include_blank: false %>
<div class="col-lg-8">
<div class="card flex-fill w-100">
<div class="card-header">
<h5 class="card-title mb-0"><%= t('metadata') %></h5>
</div>
<div class="card-body">
<%= f.input :name %>
<div class="row">
<div class="col-lg-6">
<%= f.input :short_name %>
</div>
<div class="col-lg-6">
<%= f.input :level, include_blank: false %>
</div>
</div>
</div>
</div>
</div>
</div>
<% content_for :action_bar_right do %>
<%= submit f %>
<% end %>
......
......@@ -3,31 +3,7 @@
<%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
<div class="row">
<div class="col-md-3">
<%= render 'admin/education/programs/forms/part', part: :technical do %>
<%= f.input :published %>
<%= f.input :slug,
as: :string,
input_html: program.persisted? ? {} : {
class: 'js-slug-input',
data: { source: '#education_program_name' }
} %>
<%= f.association :parent,
collection: collection_tree(current_university.education_programs, program),
label_method: ->(p) { sanitize p[:label] },
value_method: ->(p) { p[:id] } %>
<% end %>
<%= render 'admin/application/featured_image/edit', about: program, f: f %>
<div class="card flex-fill w-100">
<div class="card-header">
<h5 class="card-title mb-0"><%= t('seo') %></h5>
</div>
<div class="card-body">
<%= f.input :description %>
</div>
</div>
</div>
<div class="col-md-9">
<div class="col-lg-8 col-xxl-9">
<%= render 'admin/education/programs/forms/part', part: :essential do %>
<div class="row">
<div class="col-lg-9">
......@@ -150,6 +126,30 @@
</div>
<% end %>
</div>
<div class="col-lg-4 col-xxl-3">
<%= render 'admin/education/programs/forms/part', part: :technical do %>
<%= f.input :published %>
<%= f.input :slug,
as: :string,
input_html: program.persisted? ? {} : {
class: 'js-slug-input',
data: { source: '#education_program_name' }
} %>
<%= f.association :parent,
collection: collection_tree(current_university.education_programs, program),
label_method: ->(p) { sanitize p[:label] },
value_method: ->(p) { p[:id] } %>
<% end %>
<%= render 'admin/application/featured_image/edit', about: program, f: f %>
<div class="card flex-fill w-100">
<div class="card-header">
<h5 class="card-title mb-0"><%= t('seo') %></h5>
</div>
<div class="card-body">
<%= f.input :description %>
</div>
</div>
</div>
</div>
<% content_for :action_bar_right do %>
......
......@@ -9,6 +9,7 @@ description: >
position: <%= @about.position %>
<%= render 'admin/communication/unsplash/static' %>
category: "<%= @website.categories.find_by(program_id: @about.id)&.path %>/"
diploma: "<%= @about.diploma&.slug %>"
teachers:
<% teacher_involvements.each do |involvement| %>
- "<%= involvement.person.slug %>"
......
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