Sha256: cd08ca56fadc5551b6295211f7570b98baecc8e94b5a6ecc618ba60d520446a7

Contents?: true

Size: 819 Bytes

Versions: 6

Compression:

Stored size: 819 Bytes

Contents

module ExpressTemplates
  module Components
    # Provide hidden fields such as the authenticity token
    # and the utf8 enforcer tag as well as a method tag as
    # would be provided by Rails' form helpers.
    #
    # An optional method may be speficied.  Defaults to 'post'.
    class FormRailsSupport < Base
      include Capabilities::Configurable
      emits -> {
        div(style: 'display:none') {
          utf8_enforcer_tag
          # NOTE: This should be moved into the forms module and made a FormComponent
          #       to have access to the resource_name as this code assumes existence of
          #       a resource method which may not exist
          method_tag(@config[:id] || "{{((resource.persisted? ? :put : :post) rescue :post)}}")
          token_tag
        }
      }
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
express_admin-1.2.1 vendor/gems/express_templates/lib/express_templates/components/form_rails_support.rb
express_admin-1.2.0 vendor/gems/express_templates/lib/express_templates/components/form_rails_support.rb
express_templates-0.5.0 lib/express_templates/components/form_rails_support.rb
express_templates-0.4.2 lib/express_templates/components/form_rails_support.rb
express_templates-0.4.1 lib/express_templates/components/form_rails_support.rb
express_templates-0.4.0 lib/express_templates/components/form_rails_support.rb