fix document creation

This commit is contained in:
j 2017-01-27 12:26:55 +00:00
parent 385bf61084
commit 620c8a7d96
3 changed files with 3 additions and 3 deletions

View file

@ -600,7 +600,7 @@ class Document(models.Model):
def update_linked_documents(self): def update_linked_documents(self):
if self.extension == 'html': if self.extension == 'html':
old = [d.id for id in self.linked_documents.all()] old = [d.id for id in self.linked_documents.all()]
current = utils.get_documents(self.data['text']) current = utils.get_documents(self.data.get('text', ''))
removed = list(set(old) - set(current)) removed = list(set(old) - set(current))
added = list(set(current) - set(old)) added = list(set(current) - set(old))
if removed: if removed:

View file

@ -18,7 +18,7 @@ pandora.ui.embedDocumentDialog = function(id, position) {
marginTop: '8px' marginTop: '8px'
}) })
.val( .val(
'<a href="/documents/' + id '<a href="/document/' + id
+ (position ? '/' + position : '') + (position ? '/' + position : '')
+ '"><img src="/documents/' + id + '/256p' + '"><img src="/documents/' + id + '/256p'
+ (position || '') + '.jpg"></a>' + (position || '') + '.jpg"></a>'

View file

@ -386,7 +386,7 @@ pandora.ui.textHTML = function(text) {
? pandora.user.ui.documents[pandora.user.ui.part.document] ? pandora.user.ui.documents[pandora.user.ui.part.document]
: pandora.user.ui.section == 'documents' : pandora.user.ui.section == 'documents'
? pandora.user.ui.documents[pandora.user.ui.document] ? pandora.user.ui.documents[pandora.user.ui.document]
: {}), : {}) || {},
position = settings.position || 0, position = settings.position || 0,
element, element,
scrollTop; scrollTop;