Sha256: d5123fa58b80bccdf5c5b364b432170551686165b2a6e6f76f4452a71681f1ff
Contents?: true
Size: 586 Bytes
Versions: 25
Compression:
Stored size: 586 Bytes
Contents
# frozen_string_literal: true module Decidim # # Decorator to format validation errors of a form in html format # class ValidationErrorsPresenter < SimpleDelegator include Decidim::SanitizeHelper attr_reader :error, :form def initialize(error, form) @error = error @form = form end def message "<p>#{error}</p>#{validation_errors_list}" end def validation_errors_list return "" if form.valid? content_tag(:ul, decidim_sanitize(form.errors.full_messages.map { |err| content_tag(:li, err) }.join)) end end end
Version data entries
25 entries across 25 versions & 1 rubygems