Skip to content

Commit

Permalink
change authors filters for posts (#2577)
Browse files Browse the repository at this point in the history
* change authors filters for posts

* restore files

* adjust

* oopsy
  • Loading branch information
pabois authored Jan 13, 2025
1 parent 4773bd2 commit 6c48716
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/models/communication/website/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ 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_category, -> (category_id, language = nil) { joins(:categories).where(communication_website_post_categories: { id: category_id }).distinct }
scope :for_author, -> (author_ids, language = nil) { joins(:authors).where(university_people: { id: author_ids }).distinct }
scope :for_category, -> (category_ids, language = nil) { joins(:categories).where(communication_website_post_categories: { id: category_ids }).distinct }
scope :for_search_term, -> (term, language) {
joins(:localizations)
.where(communication_website_post_localizations: { language_id: language.id })
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

0 comments on commit 6c48716

Please sign in to comment.