page can use default widget

This commit is contained in:
Fu Matthew committed 2013-01-21 16:56:37 +08:00
1 parent 9630d0a841
commit 0cc616f988
28 files changed
+305 -154

No files matched your search

@@ -9,32 +9,6 @@ class Admin::ModuleAppsController < ApplicationController
end
def reload_frontend_pages
@categories =[]
@module_app = ModuleApp.find(params[:id])
@frontend_path = @module_app.widgets.keys[0] if ( !@module_app.widgets.blank? && @module_app.widgets[0].blank? )
@frontend_style = @module_app.widgets[@frontend_path] if ( !@frontend_path.blank? )
case @module_app.key
when 'announcement'
@categories = BulletinCategory.all
@tags = AnnouncementTag.all
when 'news'
@categories = NewsBulletinCategory.all
@tags = NewsTag.all
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
when 'archive'
@categories = ArchiveFileCategory.all
@tags = ArchiveTag.all
end
respond_to do |format|
format.js {}
end
end
def module_auth_proc
@module_app = ModuleApp.find(params[:id])
@@ -136,7 +110,6 @@ class Admin::ModuleAppsController < ApplicationController
end
#user is not permited to do that
flash[:notice] = t('app_auth.operation_not_permitted')
render :nothing => true, :status => 403
end
render :nothing => true,:status => 403
end
end
@@ -91,9 +91,9 @@ class Admin::PagePartsController < ApplicationController
end
def reload_widgets
@part = PagePart.find params[:part_id]
@part = PagePart.find params[:id]
@categories =[]
@module_app = ModuleApp.find(params[:id])
@module_app = ModuleApp.find(params[:module_app_id])
@widget_path = @module_app.widgets.keys[0] if ( @module_app.widgets[0].blank? )
@@ -122,9 +122,9 @@ class Admin::PagePartsController < ApplicationController
def reload_widget_styles
@module_app = ModuleApp.find(params[:module_app_id])
@part = PagePart.find params[:part_id]
@user_choose =@widget_path= params[:id]
@widget_style = @module_app.widgets[params[:id]]
@part = PagePart.find params[:id]
@user_choose =@widget_path= params[:frontend]
@widget_style = @module_app.widgets[@widget_path]
respond_to do |format|
format.js {}
+52 -9
View File
@@ -19,15 +19,21 @@ helper Admin::PagePartsHelper
end
def edit
@item = Page.find(params[:id])
@item = @page =Page.find(params[:id])
@user_choose = @item.app_frontend_url
@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
@app_frontend_urls = @item.module_app.app_pages
@app_frontend_urls << 'default_widget' if @item.module_app.has_default_widget?
end
if @item.module_app
@module_app = @item.module_app
@@ -84,13 +90,13 @@ helper Admin::PagePartsHelper
def update
@item = Page.find(params[:id])
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
@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] ) if params[:page][:frontend_field]
params[:page][:frontend_field_type] = nil
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
@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] ) if params[:page][:frontend_field]
params[:page][:frontend_field_type] = nil
if @item.update_attributes(params[:page])
flash[:notice] = t('update.success.page')
respond_to do |format|
@@ -123,7 +129,44 @@ helper Admin::PagePartsHelper
format.js { @item = @item.parent }
end
end
def reload_front_end_setting
@page = Page.find params[:id]
@module_app = ModuleApp.find params[:module_app_id]
@chosen_frontend = @user_choose = params[:frontend]
end
def reload_frontend_pages
@page = Page.find params[:id]
# @categories =[]
@module_app = ModuleApp.find(params[:module_app_id])
@app_frontend_urls = @module_app.app_pages
@app_frontend_urls << 'default_widget' if @module_app.has_default_widget?
case @module_app.key
when 'announcement'
@categories = BulletinCategory.all
@tags = AnnouncementTag.all
when 'news'
@categories = NewsBulletinCategory.all
@tags = NewsTag.all
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
when 'archive'
@categories = ArchiveFileCategory.all
@tags = ArchiveTag.all
else
@categories = []
@tags = []
end
respond_to do |format|
format.js {}
end
end
def reload_themes
@design = Design.find(params[:id])
@themes = @design.themes