Sha256: add1302fac2784f73ce63fc7c82045e3fcd74ae99fc829894031fcba7e7ce985

Contents?: true

Size: 748 Bytes

Versions: 2

Compression:

Stored size: 748 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Calendar
    module Admin
      class ExternalEventForm < Decidim::Form
        include TranslatableAttributes

        translatable_attribute :title, String
        attribute :start_at, Decidim::Attributes::TimeWithZone
        attribute :end_at, Decidim::Attributes::TimeWithZone
        attribute :url, String

        validates :title, translatable_presence: true
        validates :title, :start_at, :end_at, :url, presence: true
        validates :start_at, date: { before: :end_at, allow_blank: false, if: proc { |obj| obj.end_at.present? } }
        validates :end_at, date: { after: :start_at, allow_blank: true, if: proc { |obj| obj.start_at.present? } }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-calendar-0.19.0 app/forms/decidim/calendar/admin/external_event_form.rb
decidim-calendar-0.13.1.3 app/forms/decidim/calendar/admin/external_event_form.rb