From d25b6d46863a2c8ff2a18b08b8674d0a0adc0aec Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 3 Jan 2009 14:11:44 +0000 Subject: [PATCH] Moves flash messages rendering to a helper method. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2223 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 9 +++++++++ app/views/layouts/base.rhtml | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a935ce9ec..35d1670ae 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -147,6 +147,15 @@ module ApplicationHelper end content end + + # Renders flash messages + def render_flash_messages + s = '' + flash.each do |k,v| + s << content_tag('div', v, :class => "flash #{k}") + end + s + end # Truncates and returns the string as a single line def truncate_single_line(string, *args) diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml index b146d615e..0de3b0e3d 100644 --- a/app/views/layouts/base.rhtml +++ b/app/views/layouts/base.rhtml @@ -50,8 +50,7 @@
- <%= content_tag('div', flash[:error], :class => 'flash error') if flash[:error] %> - <%= content_tag('div', flash[:notice], :class => 'flash notice') if flash[:notice] %> + <%= render_flash_messages %> <%= yield %>
-- 2.39.5