Add “more” page
This commit is contained in:
@@ -53,6 +53,16 @@ module Adamantium
|
||||
posts.post_tags.where(post_id: post_id, tag_id: tag[:id]).changeset(:delete).commit if tag
|
||||
end
|
||||
|
||||
def by_year(year:)
|
||||
posts
|
||||
.where(post_type: "post", location: nil)
|
||||
.exclude(name: nil)
|
||||
.published
|
||||
.where { Sequel.&(Sequel.extract(:year, :published_at) =~ year) }
|
||||
.combine(:tags)
|
||||
.to_a
|
||||
end
|
||||
|
||||
def post_listing(limit: nil)
|
||||
posts
|
||||
.where(post_type: "post", location: nil)
|
||||
@@ -198,6 +208,17 @@ module Adamantium
|
||||
delete_post = posts.where(slug: slug).command(:update)
|
||||
delete_post.call(published_at: Time.now)
|
||||
end
|
||||
|
||||
def post_years
|
||||
posts
|
||||
.where(post_type: "post", location: nil)
|
||||
.exclude(name: nil)
|
||||
.published
|
||||
.dataset
|
||||
.group_and_count(Sequel.extract(:year, :published_at).as(:year))
|
||||
.order(:year)
|
||||
.to_a
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -4,6 +4,12 @@ module Adamantium
|
||||
def fetch!(slug)
|
||||
tags.where(slug: slug).one!
|
||||
end
|
||||
|
||||
def list
|
||||
tags
|
||||
.order(Sequel.function(:lower, :label))
|
||||
.to_a
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user