Sha256: a9c564a79433b28f4f1ce3de3d9a95c1a9a35e732276d1e612f773088defb50f
Contents?: true
Size: 932 Bytes
Versions: 43
Compression:
Stored size: 932 Bytes
Contents
module Releaf::Builders::FormBuilder::Label def releaf_label(name, attributes, options = {}) label_options = options.fetch(:label, {}) attributes = label_attributes(name, attributes, options) text = label_text(name, label_options) content = label(name, text, attributes) if label_options.fetch(:minimal, false) == true content else content += wrapper(label_options[:description], class: "description") if label_options.fetch(:description, nil).present? wrapper(content, class: "label-wrap") end end def label_text(name, options = {}) if options[:label_text].present? options[:label_text] else if options[:translation_key].present? key = options[:translation_key] else key = name.to_s.sub(/_uid$/, '') end translate_attribute(key) end end def label_attributes(_name, attributes, _options) attributes end end
Version data entries
43 entries across 43 versions & 1 rubygems