From 96485683173ad638c0855cc3ab414d4d990e8843 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 7f3ecde..4589f19 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)