forked from saurabh/orbit4-5
now page will render not give 500 error if controller doesnt send anything back
This commit is contained in:
parent
8c0d4f53b0
commit
6f3e951ba8
|
@ -207,6 +207,7 @@ module ApplicationHelper
|
|||
file.close
|
||||
controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new
|
||||
data = controller.send("#{params[:target_action]}")
|
||||
if !data.nil?
|
||||
wrap_elements = doc.css("*[data-list][data-level='0']")
|
||||
htmls = parsing_repeats_again(wrap_elements,data,1)
|
||||
html = doc.to_s
|
||||
|
@ -228,6 +229,9 @@ module ApplicationHelper
|
|||
html = html.gsub("{{pagination_goes_here}}","");
|
||||
end
|
||||
html.html_safe
|
||||
else
|
||||
""
|
||||
end
|
||||
else
|
||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "#{params[:target_action]}.html.erb")
|
||||
if File.exists?f
|
||||
|
@ -237,7 +241,7 @@ module ApplicationHelper
|
|||
controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new
|
||||
data = controller.send("#{params[:target_action]}")
|
||||
|
||||
if data.blank? || data.empty?
|
||||
if data.blank? || data.empty? || data.nil?
|
||||
file = File.open("#{Rails.root}/public/404.html")
|
||||
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
||||
file.close
|
||||
|
|
|
@ -63,6 +63,7 @@ module PagesHelper
|
|||
controller = "#{controller_name.capitalize.pluralize}_controller".classify.constantize.new
|
||||
OrbitHelper.set_current_widget_module controller_name
|
||||
data = controller.send("#{widget_method}")
|
||||
if !data.nil?
|
||||
wrap_elements = doc.css("*[data-list][data-level='0']")
|
||||
htmls = parsing_repeats_again(wrap_elements,data,1)
|
||||
html = doc.to_s
|
||||
|
@ -76,6 +77,9 @@ module PagesHelper
|
|||
html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s)
|
||||
end
|
||||
html.html_safe
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue