Sha256: fe46a7a4514b288a5b2cd4b446cdb6e827215dfd57ac81b8a4ab7a062dce20b6

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Decidim
  module Calendar
    class CalendarController < Decidim::Calendar::ApplicationController
      helper Decidim::Calendar::CalendarHelper
      include ParticipatorySpaceContext
      layout "calendar"
      def index
        @events = Event.all(current_organization)
        @resources = %w(consultation debate external_event meeting participatory_step)
      end

      def gantt
        @events = Decidim::ParticipatoryProcessStep.all.order(decidim_participatory_process_id: :asc, position: :asc, start_date: :asc).map do |p|
          Decidim::Calendar::EventPresenter.new(p) if p.organization == current_organization
        end
      end

      def ical
        filename = "#{current_organization.name.parameterize}-calendar"
        response.headers['Content-Disposition'] = 'attachment; filename="' + filename + '.ical"'
        render plain: GeneralCalendar.for(current_organization), content_type: "text/calendar"
      end

      private

      def current_participatory_space_manifest
        @current_participatory_space_manifest ||= Decidim.find_participatory_space_manifest(:calendar)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-calendar-0.13.1.3 app/controllers/decidim/calendar/calendar_controller.rb