Module: Plugins::CamaContactForm::MainHelper

Includes:
Recaptcha::Adapters::ViewMethods
Included in:
AdminFormsController, CamaContactForm, FrontController
Defined in:
app/helpers/plugins/cama_contact_form/main_helper.rb

Overview

View helpers that render a form's fields to Bootstrap markup for the [forms] shortcode.

Constant Summary collapse

CF_PLACEHOLDER =

Substitute every placeholder in ONE pass, so no replacement is ever scanned for the next placeholder. Substituting in sequence meant [label ci] was searched for in the field markup [ci] had just produced -- so a visitor typing the literal [label ci] into a message had the author's label spliced into the middle of the textarea that was echoing it back.

[ci] and [descr ci] keep first-occurrence semantics and [label ci] all-occurrence, which is what the three separate sub/sub/gsub calls did.

The block form of #gsub is used throughout: a String replacement would treat \1 or \\ in the value as a backreference and silently mangle it.

/\[(?:ci|label ci|descr ci)\]/
CF_REPEATABLE_PLACEHOLDERS =
['[label ci]'].freeze
RADIO_CHECKBOX_CONTROL_TYPES =

Field control types rendered as a group of tags rather than a