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



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/zena/use/html_tags.rb', line 177

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

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

  if (type == 'error'  || type == 'both') && (msg = flash[:error ])
    msg = ::ERB::Util.html_escape(msg) unless msg.html_safe?
    error = "<div class='error' onclick='new Effect.Fade(this)'>#{msg}</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

#zafu_flashObject



169
170
171
172
173
174
175
# File 'lib/zena/use/html_tags.rb', line 169

def zafu_flash
  @zafu_flash ||= if flash[:notice] || flash[:error]
    flash.stringify_keys
  else
    {}
  end
end