Commit 719f909fad5951fd83261d05fa7ff224b5c583d6
1 parent
5a8294ce
Exists in
master
and in
28 other branches
Improve date facets for articles
Later this will be fixed to use solr facet queries
Showing
1 changed file
with
10 additions
and
3 deletions
Show diff stats
app/models/article.rb
... | ... | @@ -559,10 +559,16 @@ class Article < ActiveRecord::Base |
559 | 559 | |
560 | 560 | private |
561 | 561 | def f_type |
562 | - self.class.to_s | |
562 | + self.class.short_description | |
563 | 563 | end |
564 | 564 | def f_publish_date |
565 | - self.published_at | |
565 | + today = Date.today | |
566 | + range = '' | |
567 | + range = _('Last year') if (today-1.year..today).include?(self.published_at) | |
568 | + range = _('Last month') if (today-1.month..today).include?(self.published_at) | |
569 | + range = _('Last week') if (today-1.week..today).include?(self.published_at) | |
570 | + range = _('Last day') if (today-1.day..today).include?(self.published_at) | |
571 | + range | |
566 | 572 | end |
567 | 573 | def f_profile_type |
568 | 574 | self.profile.class.to_s |
... | ... | @@ -581,7 +587,8 @@ class Article < ActiveRecord::Base |
581 | 587 | |
582 | 588 | acts_as_searchable :additional_fields => [ :comment_data, {:name => {:type => :string, :as => :name_sort, :boost => 5.0}} ] + facets.keys.map{|i| {i => :facet}}, |
583 | 589 | :include => [:profile], |
584 | - :facets => facets.keys | |
590 | + :facets => facets.keys, | |
591 | + :if => proc{|a| ! ['Feed'].include?(a.type)} | |
585 | 592 | |
586 | 593 | private |
587 | 594 | ... | ... |