Sha256: 985a149cf14b92e508b454271d578dd387911e54f54e6e35e8988471f1b40966
Contents?: true
Size: 797 Bytes
Versions: 2
Compression:
Stored size: 797 Bytes
Contents
module Fields class TextController < ModelController reactive_accessor :blurred def index # Default to text fields @type ||= 'text' @label ||= nil # Get the reactive manager for the value passed in manager = @value.reactive_manager # Find the parent reactive value that produced the value # (usually just model._field) @model = manager.parents[0].reactive_value # Get the name of the field by looking at the method scope @field_name = manager.scope[0] # Find the errors for this field @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) self.blurred = true end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
volt-fields-0.0.5 | app/fields/controllers/text_controller.rb |
volt-fields-0.0.4 | app/fields/controllers/text_controller.rb |