Sha256: 0180e0ccffed6d28238404c50aad12af0d5336471276e5cbcabc37d607f2f30d

Contents?: true

Size: 555 Bytes

Versions: 1

Compression:

Stored size: 555 Bytes

Contents

module Plutonium::Ui
  class FormComponent < Plutonium::Ui::Base
    option :form
    option :preferred_action_after_submit, default: proc { "show" }

    private

    def supported_actions_after_submit
      %w[show edit new index]
    end

    def action_after_submit_label(action)
      {
        "show" => "and view details",
        "edit" => "and continue editing",
        "new" => "and add another",
        "index" => "and view all"
      }[action]
    end
  end
end

Plutonium::ComponentRegistry.register :form, to: Plutonium::Ui::FormComponent

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
plutonium-0.8.0 app/views/components/form/form_component.rb