Add list widgets for announcement, news and links with categories and tags

This commit is contained in:
Christophe Vilayphiou committed 2012-05-10 00:25:30 +08:00
1 parent 9a6b66c57d
commit 13587306bc
21 files changed
+199 -180

No files matched your search

@@ -22,17 +22,20 @@ class Admin::PagePartsController < ApplicationController
def edit
@part = PagePart.find(params[:id])
@module_apps = ModuleApp.all(:conditions => {:enable_frontend => true})
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
@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 rescue nil
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
end
end
@@ -69,10 +72,13 @@ class Admin::PagePartsController < ApplicationController
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
end
respond_to do |format|
format.js {}