Sha256: 3860fe5672c79dd9c64d9f0dbeed8d0a7c591d41866bc205ff1f373cbdadbf3c
Contents?: true
Size: 1.29 KB
Versions: 15
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true require "active_support/concern" module Decidim module FlashHelperExtensions extend ActiveSupport::Concern included do private # Private: Foundation alert box. # # Overrides the foundation alert box helper for adding accessibility tags. # # value - The flash message. # alert_class - The foundation class of the alert message. # closable - A boolean indicating whether the close icon is added. # # Returns a HTML string. def alert_box(value, alert_class, closable) options = { class: "flash callout #{alert_class}" } options[:data] = { closable: "" } if closable options[:role] = "alert" content_tag(:div, options) do concat value concat close_link if closable end end # Private: Foudation alert box close link. # # Overrides the foundation alert box close link helper for the aria-label # translations. def close_link button_tag( class: "close-button", type: "button", data: { close: "" }, aria: { label: I18n.t("decidim.alert.dismiss") } ) do content_tag(:span, "×".html_safe, aria: { hidden: true }) end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems