Sha256: ec680f923a7f223b81af57d14566ce6739aab3f7b28abec09ce0fa28cda3c6e5

Contents?: true

Size: 1022 Bytes

Versions: 7

Compression:

Stored size: 1022 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    # Exposes the meeting resources as an .ics file so users can import them
    # to their favorite calendar app
    class CalendarsController < Decidim::Meetings::ApplicationController
      include FilterResource
      include Filterable
      include ComponentFilterable

      layout false
      helper_method :meetings
      before_action :set_default_request_format
      skip_around_action :use_organization_time_zone

      def show
        render plain: CalendarRenderer.for(current_component, filter_params), content_type: "type/calendar"
      end

      def meeting_calendar
        send_data CalendarRenderer.for(meeting), content_type: "type/calendar", filename: "#{meeting.reference}.ics"
      end

      private

      def meeting
        @meeting ||= Decidim::Meetings::Meeting.where(component: current_component).find(params[:id])
      end

      def set_default_request_format
        request.format = :text
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-meetings-0.27.9 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.27.8 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.27.7 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.27.6 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.27.5 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.27.4 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.27.3 app/controllers/decidim/meetings/calendars_controller.rb