Module: RenderHelper
- Included in:
- Kuppayam::BaseController
- Defined in:
- app/helpers/render_helper.rb
Instance Method Summary collapse
-
#handle_invalid_authenticity_token ⇒ Object
TODO - This is still not fixed.
- #render_404 ⇒ Object
- #render_accordingly ⇒ Object
- #render_or_redirect(error, redirect_url, action, notice = nil) ⇒ Object
- #render_row ⇒ Object
- #render_show ⇒ Object
Instance Method Details
#handle_invalid_authenticity_token ⇒ Object
TODO - This is still not fixed. May be it will work on Ajax Request and show sign in pop up. This is not working for HTTP direct requests
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/render_helper.rb', line 13 def handle_invalid_authenticity_token heading = I18n.t("status.invalid_token.heading") = I18n.t("status.invalid_token.message") = " showMessageModal('\#{heading}','\#{message}');\n notifyError('\#{heading}','\#{message}');\n eos\n respond_to do |format|\n format.html { \n #redirect_to root_path\n render template: '/kuppayam/404', layout: 'kuppayam/blank', :status => 404\n }\n format.js { render text: js_message }\n end\nend\n" |
#render_404 ⇒ Object
3 4 5 6 7 8 |
# File 'app/helpers/render_helper.rb', line 3 def render_404 respond_to do |format| format.html { render :file => "#{Rails.root}/public/404", :layout => true, :status => :not_found } format.any { head :not_found } end end |
#render_accordingly ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/helpers/render_helper.rb', line 45 def render_accordingly respond_to do |format| format.html { if params[:action].to_sym == :show render :show else get_collections render :index end } format.js { view_path = && [:view_path] ? "#{@resource_options[:js_view_path]}/#{params[:action]}" : params[:action].to_sym render view_path } end end |
#render_or_redirect(error, redirect_url, action, notice = nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/helpers/render_helper.rb', line 29 def render_or_redirect(error, redirect_url, action, notice=nil) respond_to do |format| format.html { if error render action: action else redirect_to redirect_url, notice: notice end } format.js { view_path = && [:view_path] ? "#{@resource_options[:js_view_path]}/#{params[:action]}" : params[:action].to_s render view_path } end end |
#render_row ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'app/helpers/render_helper.rb', line 71 def render_row respond_to do |format| format.html {} format.js { js_view_path = && [:js_view_path] ? "#{@resource_options[:js_view_path]}/row" : :row render js_view_path } end end |
#render_show ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'app/helpers/render_helper.rb', line 62 def render_show respond_to do |format| format.js { js_view_path = && [:view_path] ? "#{@resource_options[:js_view_path]}/show" : :show render js_view_path } end end |