Sha256: b93410cbe73231e633bd7b632cb9f8fa6097b4590b78733e8183cf9fbeef203a
Contents?: true
Size: 1.45 KB
Versions: 13
Compression:
Stored size: 1.45 KB
Contents
module RulesEngineView module Alerts def re_alert result = '<div id="re_alert">' unless flash[:error].blank? result << '<div class="error"><strong>Error : </strong><span>' result << flash.delete(:error) result << '</span></div>' flash.delete(:success) flash.delete(:notice) end unless flash[:success].blank? result << '<div class="success"><strong>Success : </strong><span>' result << flash.delete(:success) result << '</span></div>' flash.delete(:notice) end unless flash[:notice].blank? result << '<div class="notice"><strong>Warning : </strong><span>' result << flash.delete(:notice) result << '</span></div>' end result << '</div>' return result end def re_alert_js unless flash[:error].blank? flash.delete(:success) flash.delete(:notice) return "$.re_error_message('" + escape_javascript(flash.delete(:error)) + "');" end unless flash[:success].blank? flash.delete(:notice) return "$.re_success_message('" + escape_javascript(flash.delete(:success)) + "');" end unless flash[:notice].blank? return "$.re_notice_message('" + escape_javascript(flash.delete(:notice)) + "');" end end end end ActionView::Base.class_eval do include RulesEngineView::Alerts end
Version data entries
13 entries across 13 versions & 1 rubygems