diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -196,4 +196,27 @@ markdown.to_html.html_safe end + + BOOTSTRAP_FLASH_MSG = { + success: 'alert-success', + error: 'alert-danger', + alert: 'alert-block', + notice: 'alert-info' + } + + def bootstrap_class_for(flash_type) + BOOTSTRAP_FLASH_MSG.fetch(flash_type.to_sym, flash_type.to_s) + end + + def flash_messages + puts "flahs size = #{flash.count}" + flash.each do |msg_type, message| + concat(content_tag(:div, message, class: "alert #{bootstrap_class_for(msg_type)} fade in") do + concat content_tag(:button, 'x', class: "close", data: { dismiss: 'alert' }) + concat message + end) + end + nil + end + end