Skip to content
Snippets Groups Projects
Commit ec14f4cd authored by alexisben's avatar alexisben
Browse files

Merge branch 'master' of https://github.com/noesya/osuny

parents e3f91f9e 178eb52d
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
......
......@@ -12,11 +12,7 @@
<%= f.input :title %>
<%= f.input :breadcrumb_title %>
<%= f.input :description_short, input_html: { value: page.description_short&.gsub('&amp;', '&') } %>
<%= f.input :header_text,
as: :summernote,
input_html: {
data: { 'summernote-config' => 'mini' }
} %>
<%= f.input :header_text, as: :string %>
<%= f.input :text, as: :summernote if page.text&.to_plain_text.present? %>
<%= f.association :related_category,
collection: collection_tree(@website.categories),
......
......@@ -19,8 +19,8 @@ description: >
<%= prepare_text_for_static @about.description %>
description_short: >
<%= prepare_text_for_static @about.description_short %>
header_text: >
<%= prepare_html_for_static @about.header_text, @website.university %>
header_text: >-
<%= @about.header_text %>
legacy_text: >
<%= prepare_html_for_static @about.text, @about.university %>
<%= render 'admin/communication/blocks/static', about: @about %>
......
<%= 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 %>"
......
......@@ -12,6 +12,11 @@ namespace :app do
person.is_author = person.communication_website_posts.any?
person.save
end
Communication::Website::Page.where("header_text ILIKE ?", "%<p>%").find_each { |page|
clean_header_text = ActionController::Base.helpers.strip_tags(page.header_text)
page.update(header_text: clean_header_text)
}
end
namespace :websites do
......
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