Sha256: e98c5da84b384adffd0471836d59917db80d2c5392c3ce282e50488f2191bf51
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
require 'wiserespond/rails' if defined?(Rails) module Wiserespond module ActionController def respond_with_redirect(options={}) options.reverse_merge!( :flash => nil, :status => :success ) self.wiserespond_setup_flash(options) respond_to do |format| format.html { redirect_to options[:url] } format.js { render :template => 'wiserespond/redirect', :locals => options } end end def respond_with_content(options={}) options.reverse_merge!( :flash => nil, :status => :success, :locals => nil ) self.wiserespond_setup_flash(options) respond_to do |format| format.html { render options[:action] } format.js { render :template => 'wiserespond/content', :locals => options } end end def wiserespond_setup_flash(options) if options[:flash].present? case options[:status] when :success flash[:notice] = options[:flash] else flash[:warning] = options[:flash] end end end protected :wiserespond_setup_flash end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wiserespond-1.0.0 | lib/wiserespond.rb |
wiserespond-0.2.0 | lib/wiserespond.rb |