Class: Decidim::Meetings::MeetingsController

Inherits:
ApplicationController show all
Includes:
FilterResource, Paginable
Defined in:
app/controllers/decidim/meetings/meetings_controller.rb

Overview

Exposes the meeting resource so users can view them

Instance Method Summary collapse

Instance Method Details

#indexObject



13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/decidim/meetings/meetings_controller.rb', line 13

def index
  return unless search.results.empty? && params.dig("filter", "date") != "past"

  @past_meetings = search_klass.new(search_params.merge(date: "past"))
  unless @past_meetings.results.empty?
    params[:filter] ||= {}
    params[:filter][:date] = "past"
    @forced_past_meetings = true
    @search = @past_meetings
  end
end

#showObject



25
26
27
28
29
# File 'app/controllers/decidim/meetings/meetings_controller.rb', line 25

def show
  return if meeting.current_user_can_visit_meeting?(current_user)
  flash[:alert] = I18n.t("meeting.not_allowed", scope: "decidim.meetings")
  redirect_to action: "index"
end