diff --git a/app/controllers/server/websites_controller.rb b/app/controllers/server/websites_controller.rb index a318cc32a881ca74c0241bf73b81e6160e97ef5c..4bb90fbb83a6f4037dd13b5edb3d319c14af27b3 100644 --- a/app/controllers/server/websites_controller.rb +++ b/app/controllers/server/websites_controller.rb @@ -1,6 +1,7 @@ class Server::WebsitesController < Server::ApplicationController has_scope :for_theme_version + has_scope :for_production has_scope :for_search_term def index diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index d89c35c410d20b468bf9a5bd1a9bc3b44191bb64..be1dea930f4fd74ca200f261ac669a6d443cacd2 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -62,6 +62,7 @@ class Communication::Website < ApplicationRecord scope :ordered, -> { order(:name) } scope :in_production, -> { where(in_production: true) } + scope :for_production, -> (production) { where(in_production: production) } scope :for_theme_version, -> (version) { where(theme_version: version) } scope :for_search_term, -> (term) { where(" diff --git a/app/services/filters/server/websites.rb b/app/services/filters/server/websites.rb index 120ed5e58546f251e463ab8e823da91c00b669ad..67e33bff2a4bea872c73e451bc413bbce050eea4 100644 --- a/app/services/filters/server/websites.rb +++ b/app/services/filters/server/websites.rb @@ -6,6 +6,9 @@ module Filters add :for_theme_version, ::Communication::Website.all.pluck(:theme_version).uniq.sort, 'Filtrer par version du thème' + add :for_production, + [{ to_s: I18n.t('true'), id: 'true' }, { to_s: I18n.t('false'), id: 'false' }], + 'Filtrer par état de production' end end end