Skip to content

Commit

Permalink
Catégories de formations : Synchronisation (#2592)
Browse files Browse the repository at this point in the history
* sync program categories

* add worker to procfile.dev

* add permalink mapping

* fix

* clean
  • Loading branch information
SebouChu authored Jan 28, 2025
1 parent fcee3ae commit 750f611
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
web: bin/rails server
worker: bundle exec good_job start
js: yarn build --watch
1 change: 0 additions & 1 deletion app/models/communication/website/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#
# id :uuid not null, primary key
# bodyclass :string
# design_options :jsonb
# full_width :boolean default(FALSE)
# migration_identifier :string
# position :integer default(0), not null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Communication::Website::Permalink::Program::Category < Communication::Website::Permalink
def self.required_in_config?(website)
website.has_programs?
website.has_education_programs?
end

def self.static_config_key
Expand Down
1 change: 1 addition & 0 deletions app/models/communication/website/permalink/with_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module Communication::Website::Permalink::WithMapping
"Communication::Website::Post::Localization" => Communication::Website::Permalink::Post,
"Communication::Website::Post::Category::Localization" => Communication::Website::Permalink::Category,
"Education::Diploma::Localization" => Communication::Website::Permalink::Diploma,
"Education::Program::Category::Localization" => Communication::Website::Permalink::Program::Category,
"Education::Program::Localization" => Communication::Website::Permalink::Program,
"Research::Journal::Paper::Localization" => Communication::Website::Permalink::Paper,
"Research::Journal::Volume::Localization" => Communication::Website::Permalink::Volume,
Expand Down
8 changes: 8 additions & 0 deletions app/models/education/program/category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,12 @@ class Education::Program::Category < ApplicationRecord
include WithUniversity

has_and_belongs_to_many :programs

def dependencies
localizations
end

def references
programs
end
end
4 changes: 3 additions & 1 deletion app/models/education/program/category/localization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class Education::Program::Category::Localization < ApplicationRecord
include AsCategoryLocalization

def git_path(website)
"#{git_path_content_prefix(website)}programs_categories/#{slug}/_index.html"
return unless for_website?(website)
prefix = git_path_content_prefix(website)
"#{prefix}programs_categories/#{slug_with_ancestors_slugs}/_index.html"
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
pages_category: pages_categories
persons_category: persons_categories
posts_category: posts_categories
programs_category: programs_categories
projects_category: projects_categories
researcher: researchers
teacher: teachers
Expand Down

0 comments on commit 750f611

Please sign in to comment.