diff --git a/app/controllers/admin/communication/website/categories_controller.rb b/app/controllers/admin/communication/website/categories_controller.rb index 8e0892e10a63fceb612deaa57e662c3856498882..7e66212489de6011ba33d58b34c8e9b5c27c34e1 100644 --- a/app/controllers/admin/communication/website/categories_controller.rb +++ b/app/controllers/admin/communication/website/categories_controller.rb @@ -37,7 +37,7 @@ class Admin::Communication::Website::CategoriesController < Admin::Communication end def publish - @category.force_publish! + @category.sync_with_git redirect_to admin_communication_website_category_path(@category), notice: t('admin.will_be_published_html', model: @category.to_s) end diff --git a/app/controllers/admin/communication/website/pages_controller.rb b/app/controllers/admin/communication/website/pages_controller.rb index cc708bb2a41f271ecc5bb5b94703e6cbce327b9b..0d8d8f8f3004ebabb2870a823322c501ec12a11c 100644 --- a/app/controllers/admin/communication/website/pages_controller.rb +++ b/app/controllers/admin/communication/website/pages_controller.rb @@ -33,7 +33,7 @@ class Admin::Communication::Website::PagesController < Admin::Communication::Web end def publish - @page.force_publish! + @page.sync_with_git redirect_to admin_communication_website_page_path(@page), notice: t('admin.will_be_published_html', model: @page.to_s) end diff --git a/app/controllers/admin/communication/website/posts_controller.rb b/app/controllers/admin/communication/website/posts_controller.rb index e680a59b7824808682a72b21c95eac2285f85929..d337f5968b90f6a338eb573b67fb3d7d113e8317 100644 --- a/app/controllers/admin/communication/website/posts_controller.rb +++ b/app/controllers/admin/communication/website/posts_controller.rb @@ -11,7 +11,7 @@ class Admin::Communication::Website::PostsController < Admin::Communication::Web end def publish - @post.force_publish! + @post.sync_with_git redirect_to admin_communication_website_post_path(@post), notice: t('admin.will_be_published_html', model: @post.to_s) end diff --git a/app/controllers/admin/communication/websites_controller.rb b/app/controllers/admin/communication/websites_controller.rb index 540b9821d8e7d81dce8dc07f03fcdf1e011ab6ee..54af5d9dfc22bdbab709616ff5c0f291e3c4f21c 100644 --- a/app/controllers/admin/communication/websites_controller.rb +++ b/app/controllers/admin/communication/websites_controller.rb @@ -34,7 +34,7 @@ class Admin::Communication::WebsitesController < Admin::Communication::Applicati end def publish - @website.force_publish! + @website.sync_with_git redirect_to admin_communication_website_path(@website), notice: t('admin.will_be_published_html', model: @website.to_s) end diff --git a/app/models/communication/website/with_batch_publication.rb b/app/models/communication/website/with_batch_publication.rb deleted file mode 100644 index 29149aff77e3c80c08b6ff82efe490cd499577c3..0000000000000000000000000000000000000000 --- a/app/models/communication/website/with_batch_publication.rb +++ /dev/null @@ -1,67 +0,0 @@ -module Communication::Website::WithBatchPublication - extend ActiveSupport::Concern - - included do - def force_publish! - commit_files_in_batch github_files, - "[Website] Batch update from import" - end - handle_asynchronously :force_publish!, queue: 'default' - - def publish_members! - commit_files_in_batch github_files.where(about_type: "Administration::Member"), - "[Member] Batch update from import" - end - - def publish_categories! - commit_files_in_batch github_files.where(about_type: "Communication::Website::Category"), - "[Category] Batch update from import" - end - - def publish_pages! - commit_files_in_batch github_files.where(about_type: "Communication::Website::Page"), - "[Page] Batch update from import" - end - - def publish_posts! - commit_files_in_batch github_files.where(about_type: "Communication::Website::Post"), - "[Post] Batch update from import" - end - - def publish_menus! - commit_files_in_batch github_files.where(about_type: "Communication::Website::Menu"), - "[Menu] Batch update from import" - end - - def publish_school! - commit_files_in_batch github_files.where(about_type: [ - "Education::School", - "Education::Program", - "Administration::Member" - ]), - "[Education School/Program/Teacher] Batch update from import" - end - - def publish_journal! - commit_files_in_batch github_files.where(about_type: [ - "Research::Journal", - "Research::Journal::Article", - "Research::Journal::Volume", - "Administration::Member" - ]), - "[Research Journal/Article/Volume/Researcher] Batch update from import" - end - - protected - - def commit_files_in_batch(files, commit_message) - files.find_each { |file| file.add_to_batch(github) } - if github.commit_batch(commit_message) - files.find_each { |file| - file.update_column :github_path, file.manifest_data[:generated_path].call(file) - } - end - end - end - -end diff --git a/app/models/research/journal/article.rb b/app/models/research/journal/article.rb index 479903a0a3096e27e5c2fc4fec74c7081d4094e9..cc03d5896e40eff7a6bc6dea696e3a4c46981e5e 100644 --- a/app/models/research/journal/article.rb +++ b/app/models/research/journal/article.rb @@ -59,10 +59,4 @@ class Research::Journal::Article < ApplicationRecord def to_s "#{ title }" end - - private - - def update_researchers - researchers.each(&:force_publish!) - end end