Fixed uploading images for articles.

This commit is contained in:
Scott Erickson 2014-02-26 19:30:37 -08:00
parent 4e8c0b65e2
commit ec7028af60
2 changed files with 5 additions and 3 deletions

View file

@ -38,12 +38,13 @@ class LiveEditingMarkup extends TreemaNode.nodeMap.ace
url: InkBlob.url
filename: InkBlob.filename
mimetype: InkBlob.mimetype
description: ''
createdFor: []
path: @settings.filePath
@uploadingPath = [@settings.filePath, InkBlob.filename].join('/')
$.ajax('/file', { type: 'POST', data: body, success: @onFileUploaded })
onFileUploaded: (e) =>
@editor.insert "![#{e.metadata.name}](/file/#{e._id})"
@editor.insert "![#{e.metadata.name}](/file/#{@uploadingPath})"
onEditorChange: =>
@saveChanges()

View file

@ -35,6 +35,7 @@ module.exports = class ArticleEditView extends View
data = $.extend(true, {}, @article.attributes)
options =
data: data
filePath: "db/thang.type/#{@article.get('original')}"
schema: Article.schema.attributes
callbacks:
change: @pushChangesToPreview