Browse Source

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
tags/0.9.0
Jean-Philippe Lang 15 years ago
parent
commit
d25b6d4686
2 changed files with 10 additions and 2 deletions
  1. 9
    0
      app/helpers/application_helper.rb
  2. 1
    2
      app/views/layouts/base.rhtml

+ 9
- 0
app/helpers/application_helper.rb View File

@@ -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)

+ 1
- 2
app/views/layouts/base.rhtml View File

@@ -50,8 +50,7 @@
</div>
<div id="content">
<%= 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 %>
</div>
</div>

Loading…
Cancel
Save