Module: AdminHelper

Defined in:
lib/generators/admin_interface/templates/helpers/admin_helper.rb

Instance Method Summary collapse

Instance Method Details

#content_for(name, content = nil, &block) ⇒ Object

Following methods are ripped from RedMine but very nice!



5
6
7
8
9
# File 'lib/generators/admin_interface/templates/helpers/admin_helper.rb', line 5

def content_for(name, content = nil, &block)
  @has_content ||= {}
  @has_content[name] = true
  super(name, content, &block)
end

#has_content?(name) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/generators/admin_interface/templates/helpers/admin_helper.rb', line 11

def has_content?(name)
  (@has_content && @has_content[name]) || false
end

#render_flash_messagesObject

Renders flash messages



16
17
18
19
20
21
22
# File 'lib/generators/admin_interface/templates/helpers/admin_helper.rb', line 16

def render_flash_messages
  flash_string = ''
  flash.each do |k,v|
    flash_string << ('div', v, :class => "flash #{k}")
  end
  flash_string.html_safe
end