Page MenuHomeGRNET

No OneTemporary

File Metadata

Created
Fri, Aug 29, 3:35 PM
diff --git a/app/helpers/flash_helper.rb b/app/helpers/flash_helper.rb
new file mode 100644
index 0000000..9868beb
--- /dev/null
+++ b/app/helpers/flash_helper.rb
@@ -0,0 +1,24 @@
+module FlashHelper
+
+ def bootstrap_class_for flash_type
+ {
+ success: 'alert-success',
+ error: 'alert-danger',
+ alert: 'alert-warning',
+ notice: 'alert-info'
+ }.fetch(flash_type.to_sym, flash_type.to_s)
+ end
+
+ def flash_messages
+ 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
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 3327a9e..3fdd9a6 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -1,29 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Base</title>
<%= stylesheet_link_tag 'application', media: 'all' %>
<!--[if lt IE 9]>
<%= javascript_include_tag 'html5shiv.min' %>
<![endif]-->
<%= javascript_include_tag 'application' %>
<%= csrf_meta_tags %>
</head>
<body>
<%= render "shared/nav" %>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
-
- <%= yield %>
+ <%= flash_messages %>
+ <%= yield %>
</div> <!-- /layout-col -->
</div> <!-- /layout-row -->
</div> <!-- /container -->
</body>
</html>

Event Timeline