embeds
This commit is contained in:
parent
1b9a285402
commit
d7694c1ae0
3 changed files with 6 additions and 3 deletions
|
@ -38,7 +38,7 @@ class Text(models.Model):
|
|||
upload_to=lambda i, x: i.path("icon.jpg"))
|
||||
|
||||
text = models.TextField(default="")
|
||||
links = DictField(default={}, editable=True)
|
||||
embeds = TupleField(default=[], editable=True)
|
||||
|
||||
poster_frames = TupleField(default=[], editable=False)
|
||||
subscribed_users = models.ManyToManyField(User, related_name='subscribed_texts')
|
||||
|
@ -142,6 +142,8 @@ class Text(models.Model):
|
|||
self.type = data['type'] == 'pdf' and 'pdf' or 'html'
|
||||
if 'posterFrames' in data:
|
||||
self.poster_frames = tuple(data['posterFrames'])
|
||||
if 'embeds' in data:
|
||||
self.embeds = tuple(data['embeds'])
|
||||
self.save()
|
||||
if 'posterFrames' in data:
|
||||
self.update_icon()
|
||||
|
@ -181,6 +183,7 @@ class Text(models.Model):
|
|||
response[key] = getattr(self, _map.get(key,key))
|
||||
if self.type == 'pdf':
|
||||
response['uploaded'] = True if self.file and not self.uploading else False
|
||||
response['embeds'] = self.embeds
|
||||
return response
|
||||
|
||||
def path(self, name=''):
|
||||
|
|
|
@ -32,7 +32,7 @@ limitations under the License.
|
|||
<script type="text/javascript" src="/static/pdf.js/debugger.js"></script>
|
||||
<script type="text/javascript">
|
||||
var DEFAULT_URL = '{{url}}',
|
||||
links = {{links|safe}},
|
||||
embeds = {{embeds|safe}},
|
||||
editable = {{editable|safe}};
|
||||
</script>
|
||||
<script type="text/javascript" src="/static/pdf.js/links.js"></script>
|
||||
|
|
|
@ -398,7 +398,7 @@ def pdf_viewer(request, id):
|
|||
if text.type == 'pdf' and text.file and not text.uploading:
|
||||
context = RequestContext(request, {
|
||||
'editable': json.dumps(text.editable(request.user)),
|
||||
'links': json.dumps(text.links),
|
||||
'embeds': json.dumps(text.embeds),
|
||||
'settings': settings,
|
||||
'url': text.get_absolute_pdf_url()
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue