Sha256: 4091dddd16913cf1f0ae8f800d299979ed44e69b2f1c30b4824066604db50910
Contents?: true
Size: 591 Bytes
Versions: 7
Compression:
Stored size: 591 Bytes
Contents
# frozen_string_literal: true # Add errors for a specific form field, only works inside a form # # == Basic usage: # {%field_error name%} # class FieldErrorTag < LiquidumTag attr_accessor :field_type def render(context) super error_messages = lookup(context, "form.errors.messages.#{argv1}") if error_messages.present? result = %[<span>] + attr_str(:class, arg(:class), input(:class, argv1)) + (error_messages || []).join(', ') + %[</span>] end result end end Liquid::Template.register_tag('field_error', FieldErrorTag)
Version data entries
7 entries across 7 versions & 1 rubygems