Sha256: c5bb468b09ce300b314e620dce2897a6a2371870460741747ac0df8be4220212

Contents?: true

Size: 918 Bytes

Versions: 19

Compression:

Stored size: 918 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
      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), 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

19 entries across 19 versions & 1 rubygems

Version Path
decidim-meetings-0.26.10 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.26.9 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.26.8 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.26.7 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.26.5 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.26.4 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.26.3 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.26.2 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.26.1 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.26.0 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.26.0.rc2 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.26.0.rc1 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.25.2 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.25.1 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.25.0 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.25.0.rc4 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.25.0.rc3 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.25.0.rc2 app/controllers/decidim/meetings/calendars_controller.rb
decidim-meetings-0.25.0.rc1 app/controllers/decidim/meetings/calendars_controller.rb