Sha256: bb38c472e12148e1eec1e299937b3e1bc9d6b5dc15bcddc65548498742d95add
Contents?: true
Size: 1.94 KB
Versions: 1
Compression:
Stored size: 1.94 KB
Contents
# frozen_string_literal: true module Plutonium module UI module Form class Base < Phlexi::Form::Base include Plutonium::UI::Component::Behaviour class Builder < Builder include Plutonium::UI::Form::Options::InferredTypes def easymde_tag(**, &) create_component(Plutonium::UI::Form::Components::Easymde, :easymde, **, &) end alias_method :markdown_tag, :easymde_tag def slim_select_tag(**attributes, &) attributes[:data_controller] = tokens(attributes[:data_controller], "slim-select") select_tag(**attributes, class!: "", &) end def belongs_to_tag(**attributes, &) attributes[:data_controller] = tokens(attributes[:data_controller], "slim-select") # TODO: put this behind a config create_component(Components::BelongsTo, :belongs_to, **attributes, &) end def has_many_tag(**attributes, &) attributes[:data_controller] = tokens(attributes[:data_controller], "slim-select") # TODO: put this behind a config create_component(Components::HasMany, :has_many, **attributes, &) end def flatpickr_tag(**, &) create_component(Plutonium::UI::Form::Components::Flatpickr, :flatpickr, **, &) end end private def render_actions actions_wrapper { render submit_button } end def fields_wrapper(&) div(class: themed(:fields_wrapper, nil)) { yield } end def actions_wrapper(&) div(class: themed(:actions_wrapper, nil)) { yield } end def form_action return @form_action unless object.present? && @form_action != false && helpers.present? @form_action ||= url_for(object, action: object.new_record? ? :create : :update) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
plutonium-0.16.0 | lib/plutonium/ui/form/base.rb |