preview is unimplemented

This commit is contained in:
Sami Samhuri 2015-03-29 22:12:56 -07:00
parent 75bd85d66f
commit c6a388967e
3 changed files with 11 additions and 3 deletions

View file

@ -80,10 +80,18 @@ class HarpBlog
read_post(File.join(year, month), id) read_post(File.join(year, month), id)
end end
def get_post_html(year, month, id)
raise 'unimplemented'
end
def get_draft(id) def get_draft(id)
read_post('drafts', id, draft: true) read_post('drafts', id, draft: true)
end end
def get_draft_html(id)
raise 'unimplemented'
end
def create_post(title, body, url, extra_fields = nil) def create_post(title, body, url, extra_fields = nil)
if !title || title.strip.length == 0 if !title || title.strip.length == 0
title = find_title(url) title = find_title(url)

View file

@ -1,8 +1,8 @@
require 'securerandom' require 'securerandom'
class HarpBlog class HarpBlog
class Post class Post
PERSISTENT_FIELDS = %w[id author title date timestamp link url tags].map(&:to_sym) PERSISTENT_FIELDS = %w[id author title date timestamp link url tags].map(&:to_sym)
TRANSIENT_FIELDS = %w[time slug body draft].map(&:to_sym) TRANSIENT_FIELDS = %w[time slug body draft].map(&:to_sym)
FIELDS = PERSISTENT_FIELDS + TRANSIENT_FIELDS FIELDS = PERSISTENT_FIELDS + TRANSIENT_FIELDS

View file

@ -173,7 +173,7 @@ get '/posts/:year/:month/:id' do |year, month, id|
elsif request.accept?('text/html') elsif request.accept?('text/html')
status 200 status 200
headers 'Content-Type' => 'text/html' headers 'Content-Type' => 'text/html'
blog.render_post(post.fields) blog.get_post_html(year, month, id)
else else
status 400 status 400
"content not available in an acceptable format: #{request.accept.join(', ')}" "content not available in an acceptable format: #{request.accept.join(', ')}"
@ -201,7 +201,7 @@ get '/drafts/:id' do |id|
elsif request.accept?('text/html') elsif request.accept?('text/html')
status 200 status 200
headers 'Content-Type' => 'text/html' headers 'Content-Type' => 'text/html'
blog.render_post(post.fields) blog.get_draft_html(id)
else else
status 400 status 400
"content not available in an acceptable format: #{request.accept.join(', ')}" "content not available in an acceptable format: #{request.accept.join(', ')}"