From 8bcbe8606420bd3fd990f490ceaf43e8d740741d Mon Sep 17 00:00:00 2001 From: kikito Date: Thu, 28 Apr 2016 12:46:27 +0200 Subject: [PATCH] Refactor layout flash usage and move to a partial --- app/views/layouts/_flash.html.erb | 10 ++++++++++ app/views/layouts/admin.html.erb | 17 +---------------- app/views/layouts/application.html.erb | 22 +--------------------- app/views/layouts/devise.html.erb | 19 ++----------------- app/views/layouts/management.html.erb | 17 +---------------- 5 files changed, 15 insertions(+), 70 deletions(-) create mode 100644 app/views/layouts/_flash.html.erb diff --git a/app/views/layouts/_flash.html.erb b/app/views/layouts/_flash.html.erb new file mode 100644 index 000000000..d07259c5c --- /dev/null +++ b/app/views/layouts/_flash.html.erb @@ -0,0 +1,10 @@ +<% flash.each do |flash_key, flash_message| %> +
+
+ + <%= flash_message %> +
+
+<% end %> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index d34195915..cc8e0c4a9 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -23,23 +23,8 @@
- <% if notice %> -
- - <%= notice %> -
- <% end %> - <% if alert %> -
- - <%= alert %> -
- <% end %> + <%= render 'layouts/flash' %> <%= yield %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index ea4fcb107..269764328 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -42,27 +42,7 @@ <% end %> - <% if notice %> -
-
- - <%= notice %> -
-
- <% end %> - - <% if alert %> -
-
- - <%= alert %> -
-
- <% end %> + <%= render 'layouts/flash' %> <%= yield %>
diff --git a/app/views/layouts/devise.html.erb b/app/views/layouts/devise.html.erb index 4ef57dc4f..b3599fc0f 100644 --- a/app/views/layouts/devise.html.erb +++ b/app/views/layouts/devise.html.erb @@ -27,23 +27,8 @@
- <% if notice %> -
- - <%= notice %> -
- <% end %> - <% if alert %> -
- - <%= alert %> -
- <% end %> + <%= render 'layouts/flash' %> <%= yield %>
@@ -56,4 +41,4 @@ <%= render 'layouts/footer' %>
- \ No newline at end of file + diff --git a/app/views/layouts/management.html.erb b/app/views/layouts/management.html.erb index b79cb5f41..735175155 100644 --- a/app/views/layouts/management.html.erb +++ b/app/views/layouts/management.html.erb @@ -54,23 +54,8 @@ <%= render "management/account_info" %>
- <% if notice %> -
- - <%= notice %> -
- <% end %> - <% if alert %> -
- - <%= alert %> -
- <% end %> + <%= render 'layouts/flash' %> <%= yield %>