Changes into page_part edition.

Can choose between 'text', 'public_r_tag' and 'widget'
This commit is contained in:
Christophe Vilayphiou committed 2012-02-16 13:09:09 +08:00
1 parent 7ea1745f73
commit e0accbecaa
25 files changed
+119 -179

No files matched your search

+11 -12
View File
@@ -22,15 +22,10 @@ class Admin::PagePartsController < ApplicationController
def edit
@part = PagePart.find(params[:id])
case @part.kind
when 'text'
@i18n_variable = @part.i18n_variable
@partial = 'edit_text'
@part_locale = params[:part_locale] || I18n.locale.to_s
when 'module'
@plugins=[{:module=>"Blog",:widgets=>[{:name=>"Blog",:path=>"panel/new_blog/widget_latest_post"},{:name=>"Blog",:path=>"panel/new_blog/widget_index"}]}]
when 'snippet'
end
@module_apps = ModuleApp.all(:conditions => {:enable_frontend => true})
@module_app = @part.module_app ? @part.module_app : @module_apps[0]
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
@tag_objects = @r_tag.classify.constantize.all
end
def create
@@ -41,7 +36,6 @@ class Admin::PagePartsController < ApplicationController
@part = PagePart.find(params[:id])
if @part.update_attributes(params[:page_part])
flash.now[:notice] = t('admin.update_success_content')
@part.build_content(@site_valid_locales)
@part.save
respond_to do |format|
format.html {
@@ -59,9 +53,14 @@ class Admin::PagePartsController < ApplicationController
def destroy
@item = Page.find(params[:id])
@item.destroy
@item.destroy_i18n_variable
redirect_to admin_items_url( :parent_id => @item.parent_id )
end
def reload_widgets
@module_app = ModuleApp.find(params[:id])
respond_to do |format|
format.js {}
end
end
end