widget & frontend field

This commit is contained in:
unknown committed 2012-08-09 15:25:30 +08:00
1 parent c0cac812c5
commit d5c55c9697
19 files changed
+604 -100

No files matched your search

+13
View File
@@ -28,10 +28,19 @@ class Admin::PagesController < ApplicationController
def edit
@item = Page.find(params[:id])
@apps = ModuleApp.excludes(app_pages: nil).entries
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
@designs = Design.all.entries
@design = @item.design ? @item.design : @designs.first
@app_frontend_urls = @item.module_app.app_pages if @item.module_app
if @item.module_app
@module_app = @item.module_app
@frontend_path = @item.app_frontend_url ? @item.app_frontend_url : @module_app.widgets.keys[0]
@frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank?
case @item.module_app.key
when 'announcement'
@categories = BulletinCategory.all
@@ -45,6 +54,7 @@ class Admin::PagesController < ApplicationController
end
else
@categories = nil
@module_app = @module_apps[0]
end
end
@@ -79,6 +89,9 @@ class Admin::PagesController < ApplicationController
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
end
params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type] )
params[:page][:frontend_field_type] = nil
if @item.update_attributes(params[:page])
flash[:notice] = t('admin.update_success_page')
respond_to do |format|