changed widget title.. now from database

This commit is contained in:
Harry Bomrah 2014-07-01 14:36:15 +08:00
parent 823aafd819
commit d70b64299d
3 changed files with 12 additions and 1 deletions

View File

@ -228,6 +228,7 @@ class PagesController < ApplicationController
OrbitHelper.set_widget_categories subpart.categories OrbitHelper.set_widget_categories subpart.categories
OrbitHelper.set_widget_module_app subpart.module OrbitHelper.set_widget_module_app subpart.module
OrbitHelper.set_widget_item_url subpart OrbitHelper.set_widget_item_url subpart
OrbitHelper.set_widget_title subpart.title
custom_value = subpart.custom_string_field || subpart.custom_array_field rescue nil custom_value = subpart.custom_string_field || subpart.custom_array_field rescue nil
if !custom_value.nil? if !custom_value.nil?
OrbitHelper.set_widget_custom_value custom_value OrbitHelper.set_widget_custom_value custom_value

View File

@ -54,6 +54,14 @@ module OrbitHelper
@widget_module_app = ModuleApp.where(:key=>module_app).first @widget_module_app = ModuleApp.where(:key=>module_app).first
end end
def self.set_widget_title(title)
@widget_title = title
end
def self.widget_title
@widget_title
end
def self.params def self.params
@params @params
end end

View File

@ -71,7 +71,9 @@ module PagesHelper
html = html.gsub(h,htmls[1][i]) html = html.gsub(h,htmls[1][i])
end end
if keys[1] if keys[1]
(data[keys[1]].kind_of?(Array) ? data[keys[0]] : data[keys[1]]).each do |key,value| extras = (data[keys[1]].kind_of?(Array) ? data[keys[0]] : data[keys[1]])
extras["widget-title"] = OrbitHelper.widget_title
extras.each do |key,value|
html = html.gsub("{{#{key}}}",value.to_s.html_safe) html = html.gsub("{{#{key}}}",value.to_s.html_safe)
html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s) html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s)
end end