Add sorting order for NCCU request
This commit is contained in:
		
							parent
							
								
									4014f8ee47
								
							
						
					
					
						commit
						4fe92b844e
					
				|  | @ -0,0 +1,12 @@ | |||
| require 'resque_scheduler/tasks' | ||||
| # encoding: utf-8  | ||||
| 
 | ||||
| namespace :data_migration do | ||||
|    | ||||
|   task :add_order_to_announcement_tag_0703 => :environment do | ||||
|    AnnouncementTag.first({conditions:{ key: 'students' }}).update_attributes(:order=>1) | ||||
|    AnnouncementTag.first({conditions:{ key: 'alumni' }}).update_attributes(:order=>2) | ||||
|    AnnouncementTag.first({conditions:{ key: 'employee' }}).update_attributes(:order=>3) | ||||
|    AnnouncementTag.first({conditions:{ key: 'guest' }}).update_attributes(:order=>4) | ||||
|   end | ||||
| end | ||||
|  | @ -27,7 +27,7 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController | |||
|   end | ||||
|    | ||||
|   def bulletins_and_web_links | ||||
|     @tags = AnnouncementTag.any_in(key: ['students', 'alumni', 'employee', 'guest']) | ||||
|     @tags = AnnouncementTag.any_in(key: ['students', 'alumni', 'employee', 'guest']).asc(:order) | ||||
|     @selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0] | ||||
|     @bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil | ||||
|     @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| class AnnouncementTag < Tag | ||||
|    | ||||
|   has_and_belongs_to_many :bulletins | ||||
|    | ||||
|   field :order,:default => 0   | ||||
|    | ||||
|   def get_visible_bulletins(sort = :name) | ||||
|     date_now = Time.now | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue