notification_helper.rb 508 Bytes
Newer Older
1
module NotificationHelper
2
3
  def notification_bubble(text, type)
    tag.div(class: "alert #{type} alert-dismissible", role: 'alert') do
4
      concat notification_close_button
5
      concat raw(text)
6
7
8
9
10
11
12
13
14
15
    end
  end

  def notification_close_button(text = nil)
    tag.button(
      class: 'close', aria: { label: 'Schliessen' }, data: { dismiss: 'alert' }, type: 'button'
    ) do
      if text.present?
        concat text
      else
16
        tag.span('x', aria: { hidden: 'true' })
17
18
19
20
      end
    end
  end
end