app/controllers/decidim/meetings/meetings_controller.rb in decidim-meetings-0.0.1 vs app/controllers/decidim/meetings/meetings_controller.rb in decidim-meetings-0.0.2
- old
+ new
@@ -1,24 +1,48 @@
# frozen_string_literal: true
module Decidim
module Meetings
- # This controller is the abstract class from which all other controllers of
- # this engine inherit.
- #
- # Note that it inherits from `Decidim::Features::BaseController`, which
- # override its layout and provide all kinds of useful methods.
+ # Exposes the meeting resource so users can view them
class MeetingsController < Decidim::Meetings::ApplicationController
+ include FilterResource
+
helper_method :meetings, :meeting
+ def index; end
+
private
def meetings
- @meetings ||= Meeting.where(decidim_feature_id: current_feature.id).order(start_time: :asc)
+ @meetings ||= search.results
end
def meeting
@meeting ||= meetings.find(params[:id])
+ end
+
+ def search_klass
+ MeetingSearch
+ end
+
+ def default_search_params
+ {
+ page: params[:page],
+ per_page: 12
+ }
+ end
+
+ def default_filter_params
+ {
+ order_start_time: "asc",
+ search_text: "",
+ scope_id: "",
+ category_id: ""
+ }
+ end
+
+ def context_params
+ { feature: current_feature, organization: current_organization }
end
end
end
end