diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index 32f1ca6cefe59f0c8f5e05cc7508c741af6aec49..8f02e7ae6941dcbd33113ed6ef03a6e7e90825a2 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -23,6 +23,10 @@ # fk_rails_... (university_id => universities.id) # class Communication::Website < ApplicationRecord + include Communication::Website::WithBatchPublication + include Communication::Website::WithCategories + include Communication::Website::WithPublishableObjects + belongs_to :university belongs_to :about, polymorphic: true, optional: true has_one :home, @@ -52,7 +56,7 @@ class Communication::Website < ApplicationRecord dependent: :destroy after_create :create_home - after_save :send_infos_to_github + after_save :publish_about_object, if: :saved_change_to_about_id? after_save_commit :set_programs_categories!, if: -> (website) { website.about_type == 'Education::School' } def self.about_types @@ -64,11 +68,7 @@ class Communication::Website < ApplicationRecord end def domain_url - "https://#{domain}" - end - - def uploads_url - "#{domain_url}/wp-content/uploads" + @domain_url ||= "https://#{domain}" end def import! @@ -93,96 +93,13 @@ class Communication::Website < ApplicationRecord all_pages end - def force_publish! - publish_authors! - publish_categories! - publish_pages! - publish_posts! - end - handle_asynchronously :force_publish!, queue: 'default' - - def publish_authors! - publish_objects(Communication::Website::Author, authors) - end - - def publish_categories! - publish_objects(Communication::Website::Category, categories) - end - - def publish_pages! - publish_objects_with_blobs(Communication::Website::Page, pages) - end - - def publish_posts! - publish_objects_with_blobs(Communication::Website::Post, posts) - end - - def set_programs_categories! - programs_root_category = categories.where(is_programs_root: true).first_or_create( - name: 'Offre de formation', - slug: 'offre-de-formation', - is_programs_root: true, - university_id: university.id - ) - create_programs_categories_level(programs_root_category, about.programs.root.ordered) - end - - def send_infos_to_github - if self.about_type == "Education::School" - github = Github.with_site self - return unless github.valid? - github.publish path: "_data/school.yml", - data: about.to_yml, - commit: "[School infos] Save" - end - end - protected - def publish_objects(model, objects) - begin - had_callback = model.__callbacks[:save].find { |c| c.matches?(:after, :publish_to_github) } - model.skip_callback(:save, :after, :publish_to_github) if had_callback - github = Github.with_site self - return unless github.valid? - objects.each do |object| - github.add_to_batch path: object.github_path_generated, - previous_path: object.github_path, - data: object.to_jekyll - yield(github, object) if block_given? - end - github.commit_batch "[#{model.name.demodulize}] Batch update from import" - ensure - model.set_callback(:save, :after, :publish_to_github) if had_callback - end - end - - def publish_objects_with_blobs(model, objects) - publish_objects(model, objects) { |github, object| - object.active_storage_blobs.each do |blob| - blob.analyze unless blob.analyzed? - github.add_to_batch path: object.blob_github_path_generated(blob), - data: object.blob_to_jekyll(blob) - end - } - end - - def create_programs_categories_level(parent_category, programs) - programs.each_with_index do |program, index| - program_category = categories.where(program_id: program.id).first_or_initialize( - name: program.name, - slug: program.name.parameterize, - university_id: university.id - ) - program_category.parent = parent_category - program_category.position = index + 1 - program_category.save - program_children = about.programs.where(parent_id: program.id).ordered - create_programs_categories_level(program_category, program_children) - end - end - def create_home build_home(university_id: university_id).save end + + def github + @github ||= Github.with_site self + end end diff --git a/app/models/communication/website/author.rb b/app/models/communication/website/author.rb index b381e4d1cc6bfc9b8b9fbda0923ddada8f7b2b20..6a7dd39502b41d2af9d2e49d46180340d10c5255 100644 --- a/app/models/communication/website/author.rb +++ b/app/models/communication/website/author.rb @@ -27,6 +27,7 @@ # class Communication::Website::Author < ApplicationRecord include WithGithub + include WithJekyll include WithSlug has_rich_text :biography @@ -51,14 +52,6 @@ class Communication::Website::Author < ApplicationRecord "_authors/#{slug}.html" end - def to_jekyll - ApplicationController.render( - template: 'admin/communication/website/authors/jekyll', - layout: false, - assigns: { author: self } - ) - end - protected def slug_unavailable?(slug) diff --git a/app/models/communication/website/category.rb b/app/models/communication/website/category.rb index 9c36c188945b361ca40f81db8e6bd9b54c677855..00d25b2b4795e17575df83e0de07fc92c648bda4 100644 --- a/app/models/communication/website/category.rb +++ b/app/models/communication/website/category.rb @@ -32,6 +32,7 @@ # class Communication::Website::Category < ApplicationRecord include WithGithub + include WithJekyll include WithSlug include WithTree @@ -81,14 +82,6 @@ class Communication::Website::Category < ApplicationRecord "_categories/#{slug}.html" end - def to_jekyll - ApplicationController.render( - template: 'admin/communication/website/categories/jekyll', - layout: false, - assigns: { category: self } - ) - end - protected def set_position diff --git a/app/models/communication/website/home.rb b/app/models/communication/website/home.rb index bc7ba4b93486e3d4b4fdde1586e83f5c5cb3f37a..61a8a09e137b8e024c1a0491e425b8f05d2121c8 100644 --- a/app/models/communication/website/home.rb +++ b/app/models/communication/website/home.rb @@ -20,8 +20,9 @@ # fk_rails_... (university_id => universities.id) # class Communication::Website::Home < ApplicationRecord - include WithGithub include Communication::Website::WithMedia + include WithGithub + include WithJekyll belongs_to :university belongs_to :website, foreign_key: :communication_website_id @@ -29,21 +30,12 @@ class Communication::Website::Home < ApplicationRecord has_rich_text :text has_one_attached_deletable :featured_image - def github_path_generated - '_pages/index.html' - end - def to_s '' end - def to_jekyll - ApplicationController.render( - template: 'admin/communication/website/home/jekyll', - layout: false, - assigns: { home: self } - ) + def github_path_generated + '_pages/index.html' end - end diff --git a/app/models/communication/website/imported/website.rb b/app/models/communication/website/imported/website.rb index e79457205c213118f12ee2e260fc8ff534ab8831..fa9da9b80b4528c985072624e8da39ca26e0af62 100644 --- a/app/models/communication/website/imported/website.rb +++ b/app/models/communication/website/imported/website.rb @@ -48,6 +48,10 @@ class Communication::Website::Imported::Website < ApplicationRecord end handle_asynchronously :run!, queue: 'default' + def uploads_url + @uploads_url ||= "#{website.domain_url}/wp-content/uploads" + end + protected def wordpress diff --git a/app/models/communication/website/imported/with_rich_text.rb b/app/models/communication/website/imported/with_rich_text.rb index e7fdcf6bf436f6acc7f56829aecac32e593ea880..904e486907b5ae869a09dbf2d94a0ffc7053cf72 100644 --- a/app/models/communication/website/imported/with_rich_text.rb +++ b/app/models/communication/website/imported/with_rich_text.rb @@ -11,7 +11,7 @@ module Communication::Website::Imported::WithRichText end def replace_tags_with_attachments(fragment, tag_name, attribute_name) - nodes = fragment.css("#{tag_name}[#{attribute_name}*=\"#{website.website.uploads_url}\"]") + nodes = fragment.css("#{tag_name}[#{attribute_name}*=\"#{website.uploads_url}\"]") nodes.each do |node| begin url = node.attr(attribute_name) diff --git a/app/models/communication/website/menu.rb b/app/models/communication/website/menu.rb index 4cd25c8f6d78f0309f856551e3c29e2c8dccb2f7..92217efe7f33fff64d6ec0528b3013eea2ac0066 100644 --- a/app/models/communication/website/menu.rb +++ b/app/models/communication/website/menu.rb @@ -23,6 +23,7 @@ # class Communication::Website::Menu < ApplicationRecord include WithGithub + # no WithJekyll include as this model has a custom jekyll belongs_to :university belongs_to :website, foreign_key: :communication_website_id @@ -31,8 +32,6 @@ class Communication::Website::Menu < ApplicationRecord validates :title, :identifier, presence: true validates :identifier, uniqueness: { scope: :communication_website_id } - after_touch :publish_to_github - scope :ordered, -> { order(created_at: :asc) } def to_s diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index cc521d5c68bc251792b84b2e3add8d819bd85ab8..db511df47068c75c9c0f88abeb60378b4e85a3bf 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -37,8 +37,9 @@ # class Communication::Website::Page < ApplicationRecord - include WithGithub include Communication::Website::WithMedia + include WithGithub + include WithJekyll include WithSlug include WithTree @@ -75,14 +76,6 @@ class Communication::Website::Page < ApplicationRecord "_pages/#{path}/index.html".gsub('///', '/').gsub('//', '/') end - def to_jekyll - ApplicationController.render( - template: 'admin/communication/website/pages/jekyll', - layout: false, - assigns: { page: self } - ) - end - def list_of_other_pages website.list_of_pages.reject! { |p| p[:id] == id } end diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb index 532d310b0900c527c817201736dbd98e9941db57..645301943bbc1cc4f9c903305592b3165bb5882b 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -30,8 +30,9 @@ # fk_rails_... (university_id => universities.id) # class Communication::Website::Post < ApplicationRecord - include WithGithub include Communication::Website::WithMedia + include WithGithub + include WithJekyll include WithSlug has_rich_text :text @@ -59,14 +60,6 @@ class Communication::Website::Post < ApplicationRecord "_posts/#{published_at.year}/#{published_at.strftime "%Y-%m-%d"}-#{slug}.html" end - def to_jekyll - ApplicationController.render( - template: 'admin/communication/website/posts/jekyll', - layout: false, - assigns: { post: self } - ) - end - def to_s "#{title}" end diff --git a/app/models/communication/website/with_batch_publication.rb b/app/models/communication/website/with_batch_publication.rb new file mode 100644 index 0000000000000000000000000000000000000000..ee02ca4cb54052b16ef8f8583ff2b14e7ef67af1 --- /dev/null +++ b/app/models/communication/website/with_batch_publication.rb @@ -0,0 +1,64 @@ +module Communication::Website::WithBatchPublication + extend ActiveSupport::Concern + + included do + def force_publish! + publish_authors! + publish_categories! + publish_pages! + publish_posts! + end + handle_asynchronously :force_publish!, queue: 'default' + + def publish_authors! + publish_objects(Communication::Website::Author, authors) + end + + def publish_categories! + publish_objects(Communication::Website::Category, categories) + end + + def publish_pages! + publish_objects_with_blobs(Communication::Website::Page, pages) + end + + def publish_posts! + publish_objects_with_blobs(Communication::Website::Post, posts) + end + + protected + + def publish_objects(model, objects) + begin + had_callback = model.__callbacks[:save].find { |c| c.matches?(:after, :publish_to_github) } + model.skip_callback(:save, :after, :publish_to_github) if had_callback + return unless github.valid? + objects.each do |object| + github.add_to_batch path: object.github_path_generated, + previous_path: object.github_path, + data: object.to_jekyll + yield(github, object) if block_given? + end + github.commit_batch "[#{model.name.demodulize}] Batch update from import" + ensure + model.set_callback(:save, :after, :publish_to_github) if had_callback + end + end + + def publish_objects_with_blobs(model, objects) + publish_objects(model, objects) { |github, object| + object.active_storage_blobs.each do |blob| + blob.analyze unless blob.analyzed? + github_path = "_data/media/#{blob.id[0..1]}/#{blob.id}.yml" + data = ApplicationController.render( + template: 'active_storage/blobs/jekyll', + layout: false, + assigns: { blob: blob } + ) + github.add_to_batch(path: github_path, data: data) + end + } + end + end + +end diff --git a/app/models/communication/website/with_categories.rb b/app/models/communication/website/with_categories.rb new file mode 100644 index 0000000000000000000000000000000000000000..81e54190199d3a94ec34d6b8e5bdc2d97fa20500 --- /dev/null +++ b/app/models/communication/website/with_categories.rb @@ -0,0 +1,34 @@ +module Communication::Website::WithCategories + extend ActiveSupport::Concern + + included do + + def set_programs_categories! + programs_root_category = categories.where(is_programs_root: true).first_or_create( + name: 'Offre de formation', + slug: 'offre-de-formation', + is_programs_root: true, + university_id: university.id + ) + create_programs_categories_level(programs_root_category, about.programs.root.ordered) + end + + protected + + def create_programs_categories_level(parent_category, programs) + programs.each_with_index do |program, index| + program_category = categories.where(program_id: program.id).first_or_initialize( + name: program.name, + slug: program.name.parameterize, + university_id: university.id + ) + program_category.parent = parent_category + program_category.position = index + 1 + program_category.save + program_children = about.programs.where(parent_id: program.id).ordered + create_programs_categories_level(program_category, program_children) + end + end + + end +end diff --git a/app/models/communication/website/with_media.rb b/app/models/communication/website/with_media.rb index 5b7203e9a9e8325198b21d4d2732af85edc905ff..808ec780ae996b47d32fbb8d02ca3c16633f1fd1 100644 --- a/app/models/communication/website/with_media.rb +++ b/app/models/communication/website/with_media.rb @@ -10,27 +10,9 @@ module Communication::Website::WithMedia university.active_storage_blobs.where(id: blob_ids) end - def blob_github_path_generated(blob) - "_data/media/#{blob.id[0..1]}/#{blob.id}.yml" - end - - def blob_to_jekyll(blob) - ApplicationController.render( - template: 'active_storage/blobs/jekyll', - layout: false, - assigns: { blob: blob } - ) - end - protected def publish_media_to_github - active_storage_blobs.each do |blob| - blob.analyze unless blob.analyzed? - github.publish(path: blob_github_path_generated(blob), - commit: "[Medium] Save ##{blob.id}", - data: blob_to_jekyll(blob)) - end + active_storage_blobs.each { |blob| website.publish_blob(blob) } end - handle_asynchronously :publish_media_to_github, queue: 'default' end diff --git a/app/models/communication/website/with_publishable_objects.rb b/app/models/communication/website/with_publishable_objects.rb new file mode 100644 index 0000000000000000000000000000000000000000..52347ce3a209ff2608f647e2a57e8908eb957d12 --- /dev/null +++ b/app/models/communication/website/with_publishable_objects.rb @@ -0,0 +1,42 @@ +module Communication::Website::WithPublishableObjects + extend ActiveSupport::Concern + + included do + + def publish_about_object + # TODO: Handle Research::Journal then use the commented version. + # publish_object(about) unless about.nil? + publish_object(about) if about.is_a?(Education::School) + end + + def publish_object(object) + # "object" can be an Education::Program, ... + return unless github.valid? + object_model_name = object.class.name.demodulize + if object.respond_to?(:github_path) + github_path = object.github_path + else + root_folder = "_#{object_model_name.pluralize.underscore}" + github_path = "#{root_folder}/#{object.id}.md" + end + github_commit_message = "[#{object_model_name}] Save #{object.to_s}" + github.publish(path: github_path, commit: github_commit_message, data: object.to_jekyll) + end + handle_asynchronously :publish_object, queue: 'default' + + def publish_blob(blob) + return unless github.valid? + blob.analyze unless blob.analyzed? + github_path = "_data/media/#{blob.id[0..1]}/#{blob.id}.yml" + github_commit_message = "[Medium] Save ##{blob.id}" + data = ApplicationController.render( + template: 'active_storage/blobs/jekyll', + layout: false, + assigns: { blob: blob } + ) + github.publish(path: github_path, commit: github_commit_message, data: data) + end + handle_asynchronously :publish_blob, queue: 'default' + + end +end diff --git a/app/models/concerns/with_github.rb b/app/models/concerns/with_github.rb index d3d0f0a36603267a0a191006b69e92853ff3ae37..cc67a3b6db94ef6e545b20ded7e8357166053f47 100644 --- a/app/models/concerns/with_github.rb +++ b/app/models/concerns/with_github.rb @@ -3,24 +3,24 @@ module WithGithub included do after_save_commit :publish_to_github + after_touch :publish_to_github end def force_publish! publish_to_github end - def github_content - @content ||= github.read_file_at github_path - end - def github_frontmatter - @frontmatter ||= FrontMatterParser::Parser.new(:md).call(github_content) - rescue - FrontMatterParser::Parser.new(:md).call('') + @github_frontmatter ||= begin + github_content = github.read_file_at(github_path) + FrontMatterParser::Parser.new(:md).call(github_content) + rescue + FrontMatterParser::Parser.new(:md).call('') + end end def github_path_generated - '' # Needs override + raise NotImplementedError end protected diff --git a/app/models/concerns/with_jekyll.rb b/app/models/concerns/with_jekyll.rb new file mode 100644 index 0000000000000000000000000000000000000000..722f28cfc3a173fef51e1a78756814d292c6dd10 --- /dev/null +++ b/app/models/concerns/with_jekyll.rb @@ -0,0 +1,14 @@ +module WithJekyll + extend ActiveSupport::Concern + + included do + def to_jekyll + ApplicationController.render( + template: "admin/#{self.class.name.underscore.pluralize}/jekyll", + layout: false, + assigns: { self.class.name.demodulize.underscore => self } + ) + end + end + +end diff --git a/app/models/concerns/with_publication_to_websites.rb b/app/models/concerns/with_publication_to_websites.rb index 75d957038bd35e22e0d679d57b5cd9ef936a7494..f58d2d652924c6700185c572d5065400a5aa9254 100644 --- a/app/models/concerns/with_publication_to_websites.rb +++ b/app/models/concerns/with_publication_to_websites.rb @@ -2,51 +2,16 @@ module WithPublicationToWebsites extend ActiveSupport::Concern included do - after_save_commit :publish_to_github - end - - def publish_to_website(website) - github = Github.new website.access_token, website.repository - return unless github.valid? - github.publish path: "_#{path_root}/#{ id }.md", - data: to_jekyll, - commit: "[#{element_name}] Save #{to_s}" - end - - def github_frontmatter - @frontmatter ||= FrontMatterParser::Parser.new(:md).call(github_content) - rescue - FrontMatterParser::Parser.new(:md).call('') + after_save_commit :publish_to_every_websites end protected - def to_jekyll - ApplicationController.render( - template: "admin/#{path_relative}/jekyll", - layout: false, - assigns: { object: self } - ) - end - - def publish_to_github - websites.each { |website| publish_to_website(website) } - end - - # return "Program" - def element_name - self.class.name.demodulize - end - - # return "programs" - def path_root - element_name.pluralize.downcase - end - - # return "education/programs" - def path_relative - self.class.name.underscore.pluralize + def publish_to_every_websites + websites.each { |website| website.publish_object(self) } end + # You can define a `github_path` method to re-define where to save the object markdown. + # Check Communication::Website#publish_object for the default value. end diff --git a/app/models/education/program.rb b/app/models/education/program.rb index 102cf96b2b4fcdfaefa549aeb40a9efab851dfcc..9aeed4c772d73f434c804c971e00a6e78d9a312b 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -25,6 +25,7 @@ # fk_rails_... (university_id => universities.id) # class Education::Program < ApplicationRecord + include WithJekyll include WithPublicationToWebsites include WithTree diff --git a/app/models/education/school.rb b/app/models/education/school.rb index 394b8f47f85ad501e2fd8799abb13b8c45153ded..2496faa721b6510a8bbbddd5d910acf387b045c5 100644 --- a/app/models/education/school.rb +++ b/app/models/education/school.rb @@ -24,6 +24,8 @@ # fk_rails_... (university_id => universities.id) # class Education::School < ApplicationRecord + include WithPublicationToWebsites + belongs_to :university has_many :websites, class_name: 'Communication::Website', as: :about has_and_belongs_to_many :programs, @@ -36,13 +38,15 @@ class Education::School < ApplicationRecord scope :ordered, -> { order(:name) } - after_save_commit :publish_to_github - def to_s "#{name}" end - def to_yml + def github_path + "_data/school.yml" + end + + def to_jekyll { name: name, address: address, @@ -53,9 +57,4 @@ class Education::School < ApplicationRecord }.deep_stringify_keys.to_yaml.lines[1..-1].join end - private - - def publish_to_github - websites.each(&:send_infos_to_github) - end end diff --git a/app/models/education/teacher.rb b/app/models/education/teacher.rb index 970d4a4784f55e50c9d7de33a9a8901a3267ffd3..58510a60d65f128cc2d5e7e9116036357e4e1736 100644 --- a/app/models/education/teacher.rb +++ b/app/models/education/teacher.rb @@ -22,6 +22,7 @@ # fk_rails_... (user_id => users.id) # class Education::Teacher < ApplicationRecord + include WithJekyll include WithPublicationToWebsites include WithSlug diff --git a/app/models/research/researcher.rb b/app/models/research/researcher.rb index dacee4ec3aa95ded174bd6e08ffff5ba37b78426..a5ae0ab5423fab634c6d61d2a13e25fad2107907 100644 --- a/app/models/research/researcher.rb +++ b/app/models/research/researcher.rb @@ -38,11 +38,7 @@ class Research::Researcher < ApplicationRecord "#{ first_name } #{ last_name }" end - protected - - # overwrite from WithPublicationToWebsites - def path_root - 'authors' + def github_path + "_authors/#{self.id}.md" end - end diff --git a/app/models/university/with_users.rb b/app/models/university/with_users.rb index d66e08afe304f35c253fbd7061a7bdb604d9551e..ccc0ea64e00c21c0d6681eb767195c99e089e027 100644 --- a/app/models/university/with_users.rb +++ b/app/models/university/with_users.rb @@ -11,7 +11,7 @@ module University::WithUsers def synchronize_server_admin_users User.synchronize_server_admin_users(id) end - handle_asynchronously :synchronize_server_admin_users + handle_asynchronously :synchronize_server_admin_users, queue: 'default' end end diff --git a/app/views/admin/education/programs/jekyll.html.erb b/app/views/admin/education/programs/jekyll.html.erb index e833906bfa8c1cc3c326fbfb5d86fa2b2256e6f4..ef39a9092fa957d9fbd5866850fa67a0abad0710 100644 --- a/app/views/admin/education/programs/jekyll.html.erb +++ b/app/views/admin/education/programs/jekyll.html.erb @@ -1,32 +1,31 @@ --- -title: "<%= @object.name %>" -identifier: "<%= @object.id %>" -parent: "<%= @object.parent_id %>" -continuing: <%= @object.continuing %> -level: <%= @object.level %> -ects: <%= @object.ects %> -position: <%= @object.position %> +title: "<%= @program.name %>" +identifier: "<%= @program.id %>" +parent: "<%= @program.parent_id %>" +continuing: <%= @program.continuing %> +level: <%= @program.level %> +ects: <%= @program.ects %> +position: <%= @program.position %> accessibility: > - <%= prepare_for_github @object.accessibility, @object.university %> + <%= prepare_for_github @program.accessibility, @program.university %> contacts: > - <%= prepare_for_github @object.contacts, @object.university %> + <%= prepare_for_github @program.contacts, @program.university %> duration: > - <%= prepare_for_github @object.duration, @object.university %> + <%= prepare_for_github @program.duration, @program.university %> evaluation: > - <%= prepare_for_github @object.evaluation, @object.university %> + <%= prepare_for_github @program.evaluation, @program.university %> objectives: > - <%= prepare_for_github @object.objectives, @object.university %> + <%= prepare_for_github @program.objectives, @program.university %> opportunities: > - <%= prepare_for_github @object.opportunities, @object.university %> + <%= prepare_for_github @program.opportunities, @program.university %> other: > - <%= prepare_for_github @object.other, @object.university %> + <%= prepare_for_github @program.other, @program.university %> pedagogy: > - <%= prepare_for_github @object.pedagogy, @object.university %> + <%= prepare_for_github @program.pedagogy, @program.university %> prerequisites: > - <%= prepare_for_github @object.prerequisites, @object.university %> + <%= prepare_for_github @program.prerequisites, @program.university %> pricing: > - <%= prepare_for_github @object.pricing, @object.university %> + <%= prepare_for_github @program.pricing, @program.university %> registration: > - <%= prepare_for_github @object.registration, @object.university %> + <%= prepare_for_github @program.registration, @program.university %> --- -<%= @object.github_frontmatter.content.html_safe %> diff --git a/app/views/admin/education/teachers/jekyll.html.erb b/app/views/admin/education/teachers/jekyll.html.erb index f26e8d52633e9ff63cc003ef7bc70f9d888a3bb8..788dee4b2efb19a1af3b47f9de5aae12fe520956 100644 --- a/app/views/admin/education/teachers/jekyll.html.erb +++ b/app/views/admin/education/teachers/jekyll.html.erb @@ -1,10 +1,9 @@ --- -title: "<%= @object.to_s %>" -identifier: "<%= @object.id %>" -first_name: "<%= @object.first_name %>" -last_name: "<%= @object.last_name %>" -slug: "<%= @object.slug %>" +title: "<%= @teacher.to_s %>" +identifier: "<%= @teacher.id %>" +first_name: "<%= @teacher.first_name %>" +last_name: "<%= @teacher.last_name %>" +slug: "<%= @teacher.slug %>" biography: > - <%= prepare_for_github @object.biography, @object.university %> + <%= prepare_for_github @teacher.biography, @teacher.university %> --- -<%= @object.github_frontmatter.content.html_safe %>