Sha256: e99053c7ae9029dd05d17b9a020e9aed283b6f5215ea29ab4a84f2119c2e8957
Contents?: true
Size: 934 Bytes
Versions: 1
Compression:
Stored size: 934 Bytes
Contents
# frozen_string_literal: true class Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::ExtendedApplicationForm properties :title, :description, :field_type, :options, :position, :list_field association :event def initialize(object) super(object).tap do form_properties event: :association, title: :string, description: :string, field_type: :default, options: :text, list_field: :boolean, position: :numeric end end def submit(params) super(params).tap do model.options&.merge! list_field: (params[:list_field] == '1').to_s model.save end end def list_field model.options&.dig('list_field') == 'true' end def options model.options&.to_json end def options=(value) super value == '' ? value : JSON.parse(value) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tramway-event-1.9.27 | app/forms/tramway/event/participant_form_field_form.rb |