Module: Zena::Use::HtmlTags::ViewMethods

Includes:
RubyLess, FormTags, LinkTags
Included in:
TestController
Defined in:
lib/zena/use/html_tags.rb

Overview

LinkTags

Instance Method Summary collapse

Methods included from LinkTags

#link_to_remote, #link_to_with_state, #protect_against_forgery?, #tag_to_remote

Methods included from FormTags

#check_exists, #form_groups, #form_skins, #readers_for, #select_id, #unique_id

Instance Method Details

#flash_messages(opts = {}) ⇒ Object

TODO: replace ‘flash_messages’ with a FlashHash context or a list of Flash messages.



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/zena/use/html_tags.rb', line 170

def flash_messages(opts={})
  type = opts[:show] || 'both'

  if (type == 'notice' || type == 'both') && flash[:notice]
    notice = "<div class='auto_fade notice' onclick='new Effect.Fade(this)'>#{::ERB::Util.html_escape(flash[:notice])}</div>"
  end

  if (type == 'error'  || type == 'both') && flash[:error ]
    error = "<div class='error' onclick='new Effect.Fade(this)'>#{::ERB::Util.html_escape(flash[:error])}</div>"
  end

  if page = opts[:page]
    page << %q{$$('#flash_messages .auto_fade').each(function(o) {
      o.opacity = 100.0;
      Effect.Fade(o, {duration: 3.0});
    });}
  end
  "<div id='flash_messages'>#{notice}#{error}</div>"
end