Skip to content

Commit

Permalink
change authors filters for posts
Browse files Browse the repository at this point in the history
  • Loading branch information
pabois committed Jan 13, 2025
1 parent 4773bd2 commit e4fa8ab
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 81 deletions.
2 changes: 1 addition & 1 deletion app/models/communication/extranet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# created_at :datetime not null
# updated_at :datetime not null
# about_id :uuid indexed => [about_type]
# default_language_id :uuid not null, indexed
# default_language_id :uuid indexed
# university_id :uuid not null, indexed
#
# Indexes
Expand Down
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
2 changes: 1 addition & 1 deletion app/models/communication/website/page/localization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# header_cta :boolean
# header_cta_label :string
# header_cta_url :string
# header_text :text
# header_text :string
# meta_description :string
# migration_identifier :string
# published :boolean
Expand Down
2 changes: 1 addition & 1 deletion app/models/communication/website/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Communication::Website::Post < ApplicationRecord
}

scope :latest_in, -> (language) { published_now_in(language).order("communication_website_post_localizations.published_at DESC").limit(5) }
scope :for_author, -> (author_id, language = nil) { where(author_id: author_id) }
scope :for_authors, -> (author_ids, language = nil) { joins(:authors).where(communication_website_post_authors: { id: author_ids }).distinct }
scope :for_category, -> (category_id, language = nil) { joins(:categories).where(communication_website_post_categories: { id: category_id }).distinct }
scope :for_search_term, -> (term, language) {
joins(:localizations)
Expand Down
2 changes: 1 addition & 1 deletion app/models/university/person/localization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Table name: university_person_localizations
#
# id :uuid not null, primary key
# biography :text
# biography :string
# first_name :string
# last_name :string
# linkedin :string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<%= render_filter f,
:select,
:for_author,
label: t('filters.attributes.element', element: Communication::Website::Post.human_attribute_name(:author).downcase),
label: t('filters.attributes.element', element: t('communication.authors', count: 1).downcase),
collection: osuny_collection(website.authors, localized: true),
multiple: true
%>
Expand Down
78 changes: 3 additions & 75 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e4fa8ab

Please sign in to comment.