X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/0c502601ba7d9e9ee0a4d6a543c534edfad9c22e..80fd830bac39b384ba9542541bb9bc605748ee0c:/apps/wiki/views.py?ds=sidebyside diff --git a/apps/wiki/views.py b/apps/wiki/views.py index 2bb168fe..bd9e2c57 100644 --- a/apps/wiki/views.py +++ b/apps/wiki/views.py @@ -16,7 +16,7 @@ from django.views.decorators.http import require_POST, require_GET from django.shortcuts import get_object_or_404, render from django.utils import simplejson -from catalogue.models import Book, Chunk +from catalogue.models import Book, Chunk, Template import nice_diff from wiki import forms from wiki.helpers import (JSONResponse, JSONFormInvalid, JSONServerError, @@ -89,6 +89,9 @@ def editor(request, slug, chunk=None, template_name='wiki/bootstrap.html'): 'history': get_history(chunk), 'version': chunk.revision() }), + 'serialized_templates': simplejson.dumps([ + {'id': t.id, 'name': t.name, 'content': t.content} for t in Template.objects.filter(is_partial=True) + ]), 'forms': { "text_save": save_form, "text_revert": forms.DocumentTextRevertForm(prefix="textrevert") @@ -213,9 +216,9 @@ def revert(request, chunk_id): doc.at_revision(revision).revert(author=author, description=comment) return JSONResponse({ - 'text': doc.materialize() if before != doc.revision() else None, + 'document': doc.materialize() if before != doc.revision() else None, 'meta': {}, - 'revision': doc.revision(), + 'version': doc.revision(), }) else: return JSONFormInvalid(form)