Fix page part kind being removed

This commit is contained in:
chris 2013-01-29 22:17:00 +08:00
parent 774599a9f2
commit e9f2983176
1 changed files with 5 additions and 7 deletions

View File

@ -56,14 +56,12 @@ class Admin::PagePartsController < ApplicationController
def update
@part = PagePart.find(params[:id])
params[:page_part][:widget_field] = params[:page_part][:widget_field].zip( params[:page_part][:widget_field_type] ) if params[:page_part][:widget_field]
params[:page_part][:widget_field_type] = nil
if params[:page_part][:module_app].blank?
params[:page_part][:module_app] = nil
params[:page_part][:kind] = nil
end
params[:page_part][:widget_field] = params[:page_part][:widget_field].zip( params[:page_part][:widget_field_type] ) if params[:page_part][:widget_field]
params[:page_part][:widget_field_type] = nil
if params[:page_part][:module_app].blank?
params[:page_part][:module_app] = nil
end
if @part.update_attributes(params[:page_part])
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
flash.now[:notice] = t('update.success.content')