more work on paginators

This commit is contained in:
albert
2011-06-21 14:32:07 -04:00
parent fab37bc0d3
commit 2f1fdcb459
16 changed files with 89 additions and 20 deletions

View File

@@ -0,0 +1,37 @@
module PostSets
class Base
def has_wiki?
false
end
def wiki_page
nil
end
def presenter
@presenter ||= PostSetPresenter.new(self)
end
def is_single_tag?
false
end
def tag
tag_string
end
def arbitrary_sql_order_clause(ids, table_name)
if ids.empty?
return "#{table_name}.id desc"
end
conditions = []
ids.each_with_index do |x, n|
conditions << "when #{x} then #{n}"
end
"case #{table_name}.id " + conditions.join(" ") + " end"
end
end
end