Initial commit
This commit is contained in:
19
app/views/bookmarks/index.rb
Normal file
19
app/views/bookmarks/index.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
module Bookmarks
|
||||
class Index < Adamantium::View
|
||||
include Deps["repos.post_repo"]
|
||||
|
||||
expose :bookmarks do |query:|
|
||||
post_repo.bookmark_listing(query: query).map do |bookmark|
|
||||
Decorators::Bookmarks::Decorator.new bookmark
|
||||
end
|
||||
end
|
||||
|
||||
expose :q do |query:|
|
||||
query
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
13
app/views/bookmarks/show.rb
Normal file
13
app/views/bookmarks/show.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
module Bookmarks
|
||||
class Show < Adamantium::View
|
||||
include Deps["repos.post_repo"]
|
||||
|
||||
expose :bookmark do |slug:|
|
||||
Decorators::Bookmarks::Decorator.new(post_repo.fetch!(slug))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
23
app/views/feeds/rss.rb
Normal file
23
app/views/feeds/rss.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
require "builder"
|
||||
|
||||
module Adamantium
|
||||
module Views
|
||||
module Feeds
|
||||
class Rss < Adamantium::View
|
||||
include Deps["repos.post_repo"]
|
||||
|
||||
expose :posts do
|
||||
post_repo.for_rss.map do |post|
|
||||
Decorators::Posts::Decorator.new post
|
||||
end
|
||||
end
|
||||
|
||||
expose :xml, decorate: false, layout: true
|
||||
|
||||
def xml
|
||||
Builder::XmlMarkup.new(indent: 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
6
app/views/not_found.rb
Normal file
6
app/views/not_found.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
class NotFound < View
|
||||
end
|
||||
end
|
||||
end
|
17
app/views/pages/show.rb
Normal file
17
app/views/pages/show.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
module Pages
|
||||
class Show < Adamantium::View
|
||||
include Deps[renderer: "renderers.markdown"]
|
||||
|
||||
expose :page_content do |slug:|
|
||||
markdown_content = File.read("app/content/pages/#{slug}.md")
|
||||
|
||||
renderer.call(content: markdown_content)
|
||||
rescue Errno::ENOENT
|
||||
renderer.call(content: "## Page not found")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
15
app/views/posts/index.rb
Normal file
15
app/views/posts/index.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
module Posts
|
||||
class Index < Adamantium::View
|
||||
include Deps["repos.post_repo"]
|
||||
|
||||
expose :posts do
|
||||
post_repo.post_listing.map do |post|
|
||||
Decorators::Posts::Decorator.new(post)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
13
app/views/posts/show.rb
Normal file
13
app/views/posts/show.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
module Posts
|
||||
class Show < Adamantium::View
|
||||
include Deps["repos.post_repo"]
|
||||
|
||||
expose :post do |slug:|
|
||||
Decorators::Posts::Decorator.new(post_repo.fetch!(slug))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
21
app/views/site/home.rb
Normal file
21
app/views/site/home.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
module Site
|
||||
class Home < Adamantium::View
|
||||
include Deps["repos.post_repo", renderer: "renderers.markdown"]
|
||||
|
||||
expose :home_content do
|
||||
markdown_content = File.read("app/content/home.md")
|
||||
|
||||
renderer.call(content: markdown_content)
|
||||
end
|
||||
|
||||
expose :posts do
|
||||
post_repo.post_listing(limit: 10).map do |post|
|
||||
Decorators::Posts::Decorator.new(post)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
22
app/views/tags/show.rb
Normal file
22
app/views/tags/show.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
module Tags
|
||||
class Show < Adamantium::View
|
||||
include Deps[
|
||||
"repos.post_tag_repo",
|
||||
"repos.tag_repo"
|
||||
]
|
||||
|
||||
expose :posts do |slug:|
|
||||
post_tag_repo.posts_tagged(tag: slug).map do |post|
|
||||
Decorators::Posts::Decorator.new(post)
|
||||
end
|
||||
end
|
||||
|
||||
expose :tag do |slug:|
|
||||
tag_repo.fetch!(slug)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user