Sha256: e4209ed2ef8fd6f85f23bfe02489df53a586e8480ace3115fdc94cfc77b830e1
Contents?: true
Size: 928 Bytes
Versions: 10
Compression:
Stored size: 928 Bytes
Contents
# frozen_string_literal: true require "govuk_design_system_formbuilder" module Katalyst module GOVUK module Formbuilder module Elements # Extend Elements::Legend to add support for human_attribute_name as a fallback module Legend extend ActiveSupport::Concern included do def retrieve_text(supplied_text) supplied_text.presence || localised_text(:legend).presence || human_attribute_name.presence || @attribute_name.to_s.humanize.capitalize.presence end end def human_attribute_name return unless @object_name.present? && @attribute_name.present? return unless @builder.object&.class.respond_to?(:human_attribute_name) @builder.object.class.human_attribute_name(@attribute_name) end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems