Refactor app in to its own slice
This commit is contained in:
15
slices/main/actions/blogroll/index.rb
Normal file
15
slices/main/actions/blogroll/index.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require "time_math"
|
||||
|
||||
module Main
|
||||
module Actions
|
||||
module Blogroll
|
||||
class Index < Action
|
||||
include Deps["views.blogroll.index"]
|
||||
|
||||
def handle(req, res)
|
||||
res.render index
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
15
slices/main/actions/blogroll/list.rb
Normal file
15
slices/main/actions/blogroll/list.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require "time_math"
|
||||
|
||||
module Main
|
||||
module Actions
|
||||
module Blogroll
|
||||
class List < Action
|
||||
include Deps["views.blogroll.list"]
|
||||
|
||||
def handle(req, res)
|
||||
res.body = cache(key: "blogroll", content_proc: -> { list.call.to_str }, expiry: TimeMath.min.advance(Time.now, +60))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
16
slices/main/actions/blogroll/opml.rb
Normal file
16
slices/main/actions/blogroll/opml.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
require "time_math"
|
||||
|
||||
module Main
|
||||
module Actions
|
||||
module Blogroll
|
||||
class Opml < Action
|
||||
include Deps["views.blogroll.opml"]
|
||||
|
||||
def handle(req, res)
|
||||
res.content_type = "text/xml; charset=utf-8"
|
||||
res.render opml, format: :xml
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user