diff --git a/app/assets/javascripts/admin/plugins/summernote.js b/app/assets/javascripts/admin/plugins/summernote.js index 916f2f24caeca1d40670dcc69adfdc0127c84bf7..6295ea3027a93948cba4166fc9b81486251a2de8 100644 --- a/app/assets/javascripts/admin/plugins/summernote.js +++ b/app/assets/javascripts/admin/plugins/summernote.js @@ -6,6 +6,7 @@ $(function () { configs['mini'] = { toolbar: [ ['font', ['bold', 'italic']], + ['position', ['superscript', 'subscript']], ['insert', ['link']], ['view', ['codeview']] ] diff --git a/app/controllers/admin/education/programs_controller.rb b/app/controllers/admin/education/programs_controller.rb index d934aee75f0c2f0ec38103e27d18cc6857a8916b..af4c1e463bcab4bdd0da052a704535f0aa795b4b 100644 --- a/app/controllers/admin/education/programs_controller.rb +++ b/app/controllers/admin/education/programs_controller.rb @@ -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]) diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb index 5f9cae573da89c6c0b86ba56391f696dd6c9d383..7702f2fa24a04964af2406699a579c9c496b7f7b 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -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 diff --git a/app/models/education/program.rb b/app/models/education/program.rb index ec001f173341c6854b6033dcdfb165c6ff764bff..a645756376a1e916c14e84cb7d2e89f0af00deae 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -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}" diff --git a/app/services/filters/admin/education/programs.rb b/app/services/filters/admin/education/programs.rb index e6eb599cb12ec41ddc99c510e890020d8c19375f..fc15d2de188c16aafe0d9c692150f15305e752c5 100644 --- a/app/services/filters/admin/education/programs.rb +++ b/app/services/filters/admin/education/programs.rb @@ -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 diff --git a/app/views/admin/communication/blocks/templates/posts/_static.html.erb b/app/views/admin/communication/blocks/templates/posts/_static.html.erb index cf1ad033a4ef79c55eb17ac2f9d977de17536a4d..7523029450a1e5ca3d893481bcf733d8f8c9b293 100644 --- a/app/views/admin/communication/blocks/templates/posts/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/posts/_static.html.erb @@ -3,5 +3,5 @@ <% end %> posts: <% block.template.selected_posts.each do |post| %> - - <%= post.slug %> + - <%= post.static_path %> <% end %> diff --git a/app/views/admin/education/programs/static.html.erb b/app/views/admin/education/programs/static.html.erb index caa4fcc189268ab0a8ff1d1fd086b08b980ce05d..a1bd69293cb9d7bc7fbae27d3dfc605539bd5bfb 100644 --- a/app/views/admin/education/programs/static.html.erb +++ b/app/views/admin/education/programs/static.html.erb @@ -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| %>