Add categories for all the widgets
This commit is contained in:
parent
6a30b0a1e4
commit
18617850e5
|
@ -26,7 +26,12 @@ class Admin::PagePartsController < ApplicationController
|
||||||
@module_app = @part.module_app ? @part.module_app : @module_apps[0]
|
@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
|
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
||||||
@tag_objects = @r_tag.classify.constantize.all
|
@tag_objects = @r_tag.classify.constantize.all
|
||||||
|
case @module_app.key
|
||||||
|
when 'bulletin'
|
||||||
@categories = BulletinCategory.all
|
@categories = BulletinCategory.all
|
||||||
|
when 'web_resource'
|
||||||
|
@categories = WebLinkCategory.all
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
@ -59,6 +64,12 @@ class Admin::PagePartsController < ApplicationController
|
||||||
|
|
||||||
def reload_widgets
|
def reload_widgets
|
||||||
@module_app = ModuleApp.find(params[:id])
|
@module_app = ModuleApp.find(params[:id])
|
||||||
|
case @module_app.key
|
||||||
|
when 'announcement'
|
||||||
|
@categories = BulletinCategory.all
|
||||||
|
when 'web_resource'
|
||||||
|
@categories = WebLinkCategory.all
|
||||||
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js {}
|
format.js {}
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
|
|
||||||
|
|
||||||
<span id="widget_category">
|
<span id="widget_category">
|
||||||
<%= select 'page_part', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @part[:category] %>
|
<%= render 'widget_categories' %>
|
||||||
</span>
|
</span>
|
|
@ -0,0 +1 @@
|
||||||
|
<%= select 'page_part', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => (@part ? @part[:category] : nil) if @categories && @categories.size > 0 %>
|
|
@ -1 +1,2 @@
|
||||||
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|widget| [widget.humanize, widget]}) %>")
|
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|widget| [widget.humanize, widget]}) %>")
|
||||||
|
$('#widget_category').html("<%= j render 'widget_categories' %>")
|
Loading…
Reference in New Issue