Skip to content
Snippets Groups Projects
Commit 70136e11 authored by pabois's avatar pabois
Browse files

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

parents 59d0d996 47e3ba8a
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ $(function () {
configs['mini'] = {
toolbar: [
['font', ['bold', 'italic']],
['position', ['superscript', 'subscript']],
['insert', ['link']],
['view', ['codeview']]
]
......
......@@ -7,6 +7,7 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro
has_scope :for_search_term
has_scope :for_diploma
has_scope :for_school
def index
@programs = apply_scopes(@programs).ordered_by_name.page(params[:page])
......
......@@ -84,13 +84,18 @@ class Communication::Website::Post < ApplicationRecord
", term: "%#{sanitize_sql_like(term)}%")
}
# Is it used?
def path
# used in menu_item#static_target
"/#{published_at.strftime "%Y/%m/%d"}/#{slug}"
end
def git_path(website)
"content/posts/#{published_at.year}/#{published_at.strftime "%Y-%m-%d"}-#{slug}.html" if published && published_at
"content/posts/#{static_path}.html" if published && published_at
end
def static_path
"#{published_at.year}/#{published_at.strftime "%Y-%m-%d"}-#{slug}"
end
def template_static
......
......@@ -184,6 +184,11 @@ class Education::Program < ApplicationRecord
", term: "%#{sanitize_sql_like(term)}%")
}
scope :for_diploma, -> (diploma_id) { where(diploma_id: diploma_id) }
scope :for_school, -> (school_id) {
joins(:schools)
.where(education_schools: { id: school_id })
.distinct
}
def to_s
"#{name}"
......
......@@ -9,6 +9,12 @@ module Filters
'filters.attributes.element',
element: Education::Diploma.model_name.human.downcase
)
add :for_school,
user.university.education_schools,
I18n.t(
'filters.attributes.element',
element: Education::School.model_name.human.downcase
)
end
end
end
......@@ -3,5 +3,5 @@
<% end %>
posts:
<% block.template.selected_posts.each do |post| %>
- <%= post.slug %>
- <%= post.static_path %>
<% end %>
......@@ -3,12 +3,12 @@
<% administrator_involvements = @about.involvements_through_roles.includes(:person).ordered_by_name %>
title: >
<%= @about.name %>
url: <%= @website.special_page(:education_programs).path %><%= @about.path %>/
url: <%= @website.special_page(:education_programs).path %><%= @about.path %>
description: >
<%= prepare_text_for_static @about.description %>
position: <%= @about.position %>
<%= render 'admin/communication/unsplash/static' %>
category: "<%= @website.categories.find_by(program_id: @about.id)&.path %>/"
category: "<%= @website.categories.find_by(program_id: @about.id)&.path %>"
diploma: "<%= @about.diploma&.slug %>"
teachers:
<% teacher_involvements.each do |involvement| %>
......
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