Add list widgets for announcement, news and links with categories and tags
This commit is contained in:
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 {}
|
||||
|
||||
@@ -6,7 +6,12 @@
|
||||
<%= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %>
|
||||
</span>
|
||||
|
||||
:
|
||||
|
||||
<span id="widget_category">
|
||||
<%= render 'widget_categories' %>
|
||||
</span>
|
||||
or
|
||||
<span id="widget_tag">
|
||||
<%= render 'widget_tags' %>
|
||||
</span>
|
||||
@@ -0,0 +1 @@
|
||||
<%= select 'page_part', 'tag', @tags.collect{|category| [category[I18n.locale], category.id]}, :selected => (@part ? @part[:tag] : nil), :include_blank => true if @tags && @tags.size > 0 %>
|
||||
@@ -1,2 +1,3 @@
|
||||
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|widget| [widget.humanize, widget]}) %>")
|
||||
$('#widget_category').html("<%= j render 'widget_categories' %>")
|
||||
$('#widget_category').html("<%= j render 'widget_categories' %>")
|
||||
$('#widget_tag').html("<%= j render 'widget_tags' %>")
|
||||
Reference in new issue
Block a user