Skip to content
Snippets Groups Projects
Unverified Commit 864b1757 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

wip website clean

parent 42b518bd
No related branches found
No related tags found
No related merge requests found
......@@ -5,25 +5,10 @@ module Communication::Website::WithPublishableObjects
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)
# about.force_publish! unless about.nil?
about.force_publish! 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?
......@@ -38,18 +23,6 @@ module Communication::Website::WithPublishableObjects
end
handle_asynchronously :publish_blob, queue: 'default'
def remove_object(object)
return unless github.valid?
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}] Remove #{object.to_s}"
github.remove(github_path, github_commit_message)
end
def remove_blob(blob)
return unless github.valid?
github_path = "_data/media/#{blob.id[0..1]}/#{blob.id}.yml"
......
......@@ -63,9 +63,6 @@ class Research::Journal::Article < ApplicationRecord
private
def update_researchers
return unless websites.any?
researchers.each do |researcher|
websites.each { |website| website.publish_object(researcher) }
end
researchers.each(&:force_publish!)
end
end
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