FEATURE: better top pages

This commit is contained in:
Régis Hanol
2014-01-14 01:02:14 +01:00
parent 069a42cde1
commit 3a6bffa05d
36 changed files with 400 additions and 302 deletions

View File

@@ -1,19 +1,12 @@
class TopListSerializer < ApplicationSerializer
attributes :can_create_topic,
:yearly,
:monthly,
:weekly,
:daily
def can_create_topic
scope.can_create?(Topic)
end
TopTopic.periods.each do |period|
attribute period
define_method(period) do
TopicListSerializer.new(object[period], scope: scope).as_json
TopicListSerializer.new(object[period], scope: scope).as_json if object[period]
end
end
end