deliver app config. fix wrong value cause error for default widget

This commit is contained in:
Fu Matthew 2013-02-18 19:04:04 +08:00
parent 3a13ab4634
commit 96455f31e1
3 changed files with 14 additions and 6 deletions

View File

@ -25,8 +25,15 @@ module Admin::PagePartsHelper
local_item = @part if local_item.nil? && @part local_item = @part if local_item.nil? && @part
local_item = @page if local_item.nil? && @page local_item = @page if local_item.nil? && @page
res = '' res = ''
choosen_value = prefill_value || local_item[:widget_field][i][0]
choosen_value = prefill_value || (local_item[:widget_field][i][0] rescue nil)
if choosen_value
choosen_field_is_link = (@module_app.widget_fields.select{|t| t[0].to_s==choosen_value}.first)[2]==:link choosen_field_is_link = (@module_app.widget_fields.select{|t| t[0].to_s==choosen_value}.first)[2]==:link
else
choosen_field_is_link = false
end
if choosen_field_is_link if choosen_field_is_link
value = case local_item value = case local_item

View File

@ -8,10 +8,10 @@ defaults: &defaults
development: development:
<<: *defaults <<: *defaults
database: demo_site_development database: test_site
test: test:
<<: *defaults <<: *defaults
database: demo_site_test database: test_site
# set these environment variables on your prod server # set these environment variables on your prod server
production: production:

View File

@ -448,14 +448,15 @@ namespace :migrate do
PagePart.all.each do |pp| PagePart.all.each do |pp|
pp[:backup_module_app_key] = (pp.module_app ? pp.module_app.key : nil) pp[:backup_module_app_key] = (pp.module_app ? pp.module_app.key : nil)
puts pp.id
pp.save pp.save
puts pp.inspect # puts pp.inspect
end end
Page.all.each do |page| Page.all.each do |page|
page[:backup_module_app_key] = (page.module_app ? page.module_app.key : nil) page[:backup_module_app_key] = (page.module_app ? page.module_app.key : nil)
page.save page.save
puts page.inspect # puts page.inspect
end end
end end