From 0cca5ec1b2176fe1d88c790f7abcdcdc182ff22a Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 16 Jul 2014 15:21:04 +0800 Subject: [PATCH] added a msg for module frontend problem --- app/helpers/application_helper.rb | 9 ++++++--- app/helpers/pages_helper.rb | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b2f353f..15c83d9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -230,7 +230,7 @@ module ApplicationHelper end html.html_safe else - "" + return "
It seems we have a problem with the module at this point of time, we will try to fix it as soon as possible, Sorry for the inconvenience!! :(
" end else f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "#{params[:target_action]}.html.erb") @@ -239,9 +239,12 @@ module ApplicationHelper doc = Nokogiri::HTML(file, nil, "UTF-8") file.close controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new - data = controller.send("#{params[:target_action]}") + data = controller.send("#{params[:target_action]}") rescue nil + if data.nil? + return "
It seems we have a problem with the module at this point of time, we will try to fix it as soon as possible, Sorry for the inconvenience!! :(
" + end - if data.blank? || data.empty? || data.nil? + if data.blank? || data.empty? file = File.open("#{Rails.root}/public/404.html") doc = Nokogiri::HTML(file, nil, "UTF-8") file.close diff --git a/app/helpers/pages_helper.rb b/app/helpers/pages_helper.rb index b6658fc..5e318c8 100644 --- a/app/helpers/pages_helper.rb +++ b/app/helpers/pages_helper.rb @@ -78,7 +78,7 @@ module PagesHelper end html.html_safe else - "" + return "
It seems we have a problem with the module at this point of time, we will try to fix it as soon as possible, Sorry for the inconvenience!! :(
" end end