Fix page update issue, frontend faild to load widget after changing module

This commit is contained in:
Manson Wang 2014-02-07 14:59:39 +08:00
parent f53d0e9c7f
commit 9648568317
1 changed files with 20 additions and 0 deletions

View File

@ -36,6 +36,26 @@ class Admin::PagesController < Admin::ItemsController
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id ) @item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
end end
if @item.update_attributes(params[:page]) if @item.update_attributes(params[:page])
unless params[:page]['frontend_field'].nil?
frontend_class = []
frontend_field_name = []
frontend_sat_to_link = []
params[:page]['frontend_field'].each do |field|
frontend_class << field['class']
frontend_field_name << field['field_name']
frontend_sat_to_link << field['sat_to_link']
end
@item['frontend_class'] = frontend_class
@item['frontend_field_name'] = frontend_field_name
@item['frontend_sat_to_link'] = frontend_sat_to_link
end
@item['tag'] = params[:page]['tag'] == nil ? [] : params[:page]['tag']
@item.save
render 'admin/items/reload_items' render 'admin/items/reload_items'
else else
@error = error_messages_for(@item) @error = error_messages_for(@item)