You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
845 B

# frozen_string_literal: true
class DecisionsController < ApplicationController
include JurisprudenceSearch
load_and_authorize_resource :jurisprudence, class: "Cdao::Jurisprudence"
def index
search = jurisprudence_search(search_params)
@jurisprudences = search.results
start_year = Cdao::Jurisprudence.order(year: :asc).first(10).compact.map(&:year).uniq.first || "1900"
end_year = Cdao::Jurisprudence.order(year: :desc).last(10).compact.map(&:year).uniq.last || Time.zone.today.year
@years = (start_year..end_year).entries.reverse
respond_to do |format|
format.html
end
end
private
def search_params
params.permit(:reference_number, :title, :short_title, :q, :page, :per_page,
:subject_ids, sort_by: %i[search_year reference_number search_doc_date])
end
end