From e903bd0c3919ba625ffcec654d6ad58e182c0580 Mon Sep 17 00:00:00 2001 From: Manson Wang Date: Fri, 7 Feb 2014 14:59:39 +0800 Subject: [PATCH] Fix page update issue, frontend faild to load widget after changing module --- app/controllers/admin/pages_controller.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 7f3ecde4..4589f195 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -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 ) end 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' else @error = error_messages_for(@item)