Class: RecentNewsPortlet
- Inherits:
-
Cms::Portlet
- Object
- Cms::Portlet
- RecentNewsPortlet
- Defined in:
- app/portlets/recent_news_portlet.rb
Instance Method Summary collapse
-
#articles ⇒ Object
For testing.
-
#attributes ⇒ Object
For testing.
- #category ⇒ Object
- #render ⇒ Object
Instance Method Details
#articles ⇒ Object
For testing
26 27 28 |
# File 'app/portlets/recent_news_portlet.rb', line 26 def articles @articles end |
#attributes ⇒ Object
For testing
31 32 33 |
# File 'app/portlets/recent_news_portlet.rb', line 31 def attributes @portlet end |
#category ⇒ Object
21 22 23 |
# File 'app/portlets/recent_news_portlet.rb', line 21 def category @category end |
#render ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/portlets/recent_news_portlet.rb', line 6 def render order = "release_date DESC" if !attributes.sort_by.blank? and !attributes.sort_order.blank? order = "#{attributes.sort_by} #{attributes.sort_order}" end if attributes.category_id.blank? @articles = BcmsNews::NewsArticle.released.all(:order => order, :limit => attributes.limit) else @category = Cms::Category.find(attributes.category_id) @articles = BcmsNews::NewsArticle.released.all(:conditions => ["category_id = ?", @category.id], :order => order, :limit => attributes.limit) end end |