Module: Ominous::ApplicationHelper
- Defined in:
- app/helpers/ominous/application_helper.rb
Instance Method Summary collapse
- #ominous_session_store ⇒ Object
- #ominous_warning_to_display ⇒ Object
- #ominous_warnings ⇒ Object
- #ominous_warnings_to_show? ⇒ Boolean
- #process_ominous_warnings ⇒ Object
Instance Method Details
#ominous_session_store ⇒ Object
27 28 29 |
# File 'app/helpers/ominous/application_helper.rb', line 27 def ominous_session_store session[:ominous_warnings] ||= {} end |
#ominous_warning_to_display ⇒ Object
31 32 33 34 35 36 |
# File 'app/helpers/ominous/application_helper.rb', line 31 def ominous_warning_to_display warnings = ominous_session_store.keys.collect do |name| Warning.find_by_name(name) if ominous_session_store[name] == :show end return warnings.compact end |
#ominous_warnings ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/ominous/application_helper.rb', line 3 def ominous_warnings process_ominous_warnings if ominous_warnings_to_show? content_tag( 'div', render( :partial => 'ominous/warnings/list', :locals => {:warnings => ominous_warning_to_display} ), :class => 'ominous_warnings') end end |
#ominous_warnings_to_show? ⇒ Boolean
23 24 25 |
# File 'app/helpers/ominous/application_helper.rb', line 23 def ominous_warnings_to_show? ominous_session_store.values.include? :show end |
#process_ominous_warnings ⇒ Object
16 17 18 19 20 21 |
# File 'app/helpers/ominous/application_helper.rb', line 16 def process_ominous_warnings Warning.requests.each do |request| ominous_session_store[request.to_sym] = :show unless ominous_session_store[request.to_sym] end Warning.clear_requests end |