Sha256: 01666f47a02a40e1a2a529a14ccebb2e2ece495d4d6fa11b564fa019ba75975e
Contents?: true
Size: 865 Bytes
Versions: 1
Compression:
Stored size: 865 Bytes
Contents
module Fields class TextController < Volt::ModelController def index # Default to text fields if attrs.respond_to?(:type) @type = attrs.type else @type = 'text' end # Find the parent reactive value that produced the value # (usually just model._field) @model = attrs.value_parent # Get the name of the field by looking at the method scope @field_name = attrs.value_last_method.gsub(/^[_]/, '') end def label return attrs.label || @field_name.titleize end # Find the errors for this field def errors @model.marked_errors[@field_name] end # When a field goes out of focus, then we want to start checking a field def blur @model.mark_field!(@field_name) end def marked @model.marked_fields[@field_name] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
volt-fields-0.0.11 | app/fields/controllers/text_controller.rb |