mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +00:00
preview is unimplemented
This commit is contained in:
parent
75bd85d66f
commit
c6a388967e
3 changed files with 11 additions and 3 deletions
|
|
@ -80,10 +80,18 @@ class HarpBlog
|
|||
read_post(File.join(year, month), id)
|
||||
end
|
||||
|
||||
def get_post_html(year, month, id)
|
||||
raise 'unimplemented'
|
||||
end
|
||||
|
||||
def get_draft(id)
|
||||
read_post('drafts', id, draft: true)
|
||||
end
|
||||
|
||||
def get_draft_html(id)
|
||||
raise 'unimplemented'
|
||||
end
|
||||
|
||||
def create_post(title, body, url, extra_fields = nil)
|
||||
if !title || title.strip.length == 0
|
||||
title = find_title(url)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
require 'securerandom'
|
||||
|
||||
class HarpBlog
|
||||
|
||||
class Post
|
||||
|
||||
PERSISTENT_FIELDS = %w[id author title date timestamp link url tags].map(&:to_sym)
|
||||
TRANSIENT_FIELDS = %w[time slug body draft].map(&:to_sym)
|
||||
FIELDS = PERSISTENT_FIELDS + TRANSIENT_FIELDS
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ get '/posts/:year/:month/:id' do |year, month, id|
|
|||
elsif request.accept?('text/html')
|
||||
status 200
|
||||
headers 'Content-Type' => 'text/html'
|
||||
blog.render_post(post.fields)
|
||||
blog.get_post_html(year, month, id)
|
||||
else
|
||||
status 400
|
||||
"content not available in an acceptable format: #{request.accept.join(', ')}"
|
||||
|
|
@ -201,7 +201,7 @@ get '/drafts/:id' do |id|
|
|||
elsif request.accept?('text/html')
|
||||
status 200
|
||||
headers 'Content-Type' => 'text/html'
|
||||
blog.render_post(post.fields)
|
||||
blog.get_draft_html(id)
|
||||
else
|
||||
status 400
|
||||
"content not available in an acceptable format: #{request.accept.join(', ')}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue