Add category for announcement widget
This commit is contained in:
		
							parent
							
								
									7f9a7edc98
								
							
						
					
					
						commit
						fdf4cfad2d
					
				| 
						 | 
				
			
			@ -26,6 +26,7 @@ class Admin::PagePartsController < ApplicationController
 | 
			
		|||
    @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
 | 
			
		||||
    @categories =  BulletinCategory.all
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def create
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,4 +4,9 @@
 | 
			
		|||
 | 
			
		||||
<span id='widget_list'>
 | 
			
		||||
	<%= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %>
 | 
			
		||||
</span>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<span id="widget_category">
 | 
			
		||||
	<%= select 'page_part', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @part[:category] %>
 | 
			
		||||
</span>
 | 
			
		||||
| 
						 | 
				
			
			@ -26,8 +26,8 @@
 | 
			
		|||
<p>
 | 
			
		||||
	<%= t('admin.module_app') %>
 | 
			
		||||
	<%= render :partial => "admin/module_apps/app_selector", :locals => { :f => f } %>
 | 
			
		||||
	<span id="app_page_url"><%= select('page','app_frontend_url', @app_frontend_urls ) rescue ''%> </span>
 | 
			
		||||
	<span id="app_page_category"><%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]} ) rescue ''%> </span>
 | 
			
		||||
	<span id="app_page_url"><%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%> </span>
 | 
			
		||||
	<span id="app_page_category"><%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category] ) rescue ''%> </span>
 | 
			
		||||
</p>
 | 
			
		||||
<p>
 | 
			
		||||
<%= f.label :is_published, "#{t('admin.is_published')} ?" %>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -111,7 +111,11 @@ module ParserBackEnd
 | 
			
		|||
            when 'text'
 | 
			
		||||
              ret << part.i18n_variable[I18n.locale] rescue ''
 | 
			
		||||
            when 'module_widget'
 | 
			
		||||
              ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}'></div>"
 | 
			
		||||
              if part[:category]
 | 
			
		||||
                ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?category_id=#{part[:category]}'></div>"
 | 
			
		||||
              else
 | 
			
		||||
                ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}'></div>"
 | 
			
		||||
              end
 | 
			
		||||
            when 'public_r_tag'
 | 
			
		||||
              ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>"
 | 
			
		||||
            else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -134,7 +134,11 @@ module ParserFrontEnd
 | 
			
		|||
          when 'text'
 | 
			
		||||
            ret << part.i18n_variable[I18n.locale] rescue ''
 | 
			
		||||
          when 'module_widget'
 | 
			
		||||
            ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>"
 | 
			
		||||
            if part[:category]
 | 
			
		||||
              ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&category_id=#{part[:category]}'></div>"
 | 
			
		||||
            else
 | 
			
		||||
              ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>"
 | 
			
		||||
            end
 | 
			
		||||
          when 'public_r_tag'
 | 
			
		||||
            ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>"
 | 
			
		||||
          else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,11 @@ class Panel::Announcement::Widget::BulletinsController < ObitWidgetController
 | 
			
		|||
	# deadline
 | 
			
		||||
	# @bulletin_categorys = BulletinCategory.first;
 | 
			
		||||
    # @bulletins = Bulletin.widget_datas(@bulletin_categorys.id).limit(9)
 | 
			
		||||
    @bulletins = Bulletin.widget_datas.limit(9)
 | 
			
		||||
    if params[:category_id]
 | 
			
		||||
      @bulletins = Bulletin.where(:bulletin_category_id => params[:category_id]).widget_datas.limit(9)
 | 
			
		||||
    else
 | 
			
		||||
      @bulletins = Bulletin.widget_datas.limit(9)
 | 
			
		||||
    end
 | 
			
		||||
	
 | 
			
		||||
	get_categorys
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue