diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e5449e8..7d60c8d 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -40,6 +40,9 @@ module ApplicationHelper
temp_title = params[:slug].sub("-#{params[:uid]}","")
temp_title = temp_title.gsub("-"," ")
title = "#{temp_title} | #{title}"
+ elsif params[:target_action] == "index"
+ temp_title = Page.find_by(:page_id => params[:page_id]).name
+ title = "#{temp_title} | #{title}"
end
end
title
@@ -201,6 +204,9 @@ module ApplicationHelper
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "#{params[:layout_type]}.html.erb")
if !File.exists?f
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "index.html.erb")
+ if !File.exists?f
+ return "
Maybe the administrator has changed the theme, please select the index page design again from the page settings.
".html_safe
+ end
end
file = File.open(f)
doc = Nokogiri::HTML(file, nil, "UTF-8")
@@ -214,14 +220,14 @@ module ApplicationHelper
htmls[0].each_with_index do |h,i|
html = html.gsub(h,htmls[1][i])
end
-
- if data["extras"]
- data["extras"].each do |key,value|
- value = value.nil? ? "" : value
- html = html.gsub("{{#{key}}}",value.to_s)
- html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s)
- end
+ extras = data["extras"] || {}
+ extras["page-title"] = Page.find_by(:page_id => params[:page_id]).name rescue "" if !extras["page-title"]
+ extras.each do |key,value|
+ value = value.nil? ? "" : value
+ html = html.gsub("{{#{key}}}",value.to_s)
+ html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s)
end
+
total_pages = data['total_pages'].to_i rescue 1
if total_pages > 1
html = html.gsub("{{pagination_goes_here}}",create_pagination(total_pages))
@@ -230,7 +236,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!! :(
".html_safe
+ 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!! :(
".html_safe
end
else
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "#{params[:target_action]}.html.erb")
@@ -241,7 +247,7 @@ module ApplicationHelper
controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new
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!! :(
".html_safe
+ 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!! :(
".html_safe
end
if data.blank? || data.empty?
@@ -285,17 +291,18 @@ module ApplicationHelper
htmls[0].each_with_index do |h,i|
html = html.gsub(h,htmls[1][i])
end
- if data["#{not_array_key}"]
- data["#{not_array_key}"].each do |key,value|
- next if key.eql? 'impressionist'
- value = value.nil? ? "" : value
- html = html.gsub("{{#{key}}}",value.to_s)
- html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s)
- end
+ extras = data["#{not_array_key}"] || {}
+ extras.each do |key,value|
+ next if key.eql? 'impressionist'
+ value = value.nil? ? "" : value
+ html = html.gsub("{{#{key}}}",value.to_s)
+ html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s)
end
html.html_safe
end
end
+ else
+ return "There is a problem with the design. We will try to fix it as soon as possible. Sorry for the inconvenience!! :(
".html_safe
end
end
end
diff --git a/app/helpers/pages_helper.rb b/app/helpers/pages_helper.rb
index a701c64..7bb3f48 100644
--- a/app/helpers/pages_helper.rb
+++ b/app/helpers/pages_helper.rb
@@ -50,7 +50,12 @@ module PagesHelper
if !File.exists?f
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'widgets', "#{controller_name}", "_#{widget_file}.html.erb");
if !File.exists?f
- f = File.join('../templates', "#{@key}", 'modules', "#{controller_name}", "_widget.html.erb");
+ f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', "#{controller_name}", "_widget.html.erb");
+ if File.exists?f
+ f = File.join('../templates', "#{@key}", 'modules', "#{controller_name}", "_widget.html.erb");
+ else
+ return "Maybe the administrator has changed the theme, please select the widget design again from the page settings.
".html_safe
+ end
else
f = File.join('../templates', "#{@key}", 'widgets', "#{controller_name}", "_#{widget_file}.html.erb");
end
@@ -78,7 +83,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!! :(
".html_safe
+ 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!! :(
".html_safe
end
end