From cd19d8c66ad0f11fa19b0038507f094587e9c56d Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Fri, 10 Mar 2017 13:38:05 +0100 Subject: [PATCH] update document summary on save/revert --- apps/wiki/static/wiki/editor | 2 +- apps/wiki/views.py | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/wiki/static/wiki/editor b/apps/wiki/static/wiki/editor index 091b7b51..ab1445ae 160000 --- a/apps/wiki/static/wiki/editor +++ b/apps/wiki/static/wiki/editor @@ -1 +1 @@ -Subproject commit 091b7b516be2b5c2053e2a9103f8a910efbad68a +Subproject commit ab1445aee3c066a08d0602dd8b2e6996646d986f diff --git a/apps/wiki/views.py b/apps/wiki/views.py index e32d9755..461f1109 100644 --- a/apps/wiki/views.py +++ b/apps/wiki/views.py @@ -70,7 +70,7 @@ def editor(request, pk, template_name='wiki/bootstrap.html'): 'revision': revision.pk, 'stage': doc.stage, 'stage_name': doc.stage_name(), - 'assignment': str(doc.assigned_to), + 'assignment': doc.assigned_to.username if doc.assigned_to else None, }), 'serialized_templates': json.dumps([ {'id': t.id, 'name': t.name, 'content': t.content} for t in Template.objects.filter(is_partial=True) @@ -121,10 +121,9 @@ def text(request, doc_id): from traceback import print_exc print_exc() raise - # revision = doc.revision() return JSONResponse({ 'text': None, # doc.materialize() if parent_revision != revision else None, - # 'version': revision, + 'version': len(get_history(doc)), 'stage': doc.stage, 'stage_name': doc.stage_name(), 'assignment': doc.assigned_to.username if doc.assigned_to else None @@ -179,8 +178,11 @@ def revert(request, doc_id): ) return JSONResponse({ - # 'document': None, #doc.materialize() if before != doc.revision else None, - # 'version': doc.revision(), + 'document': doc.materialize(), + 'version': len(get_history(doc)), + 'stage': doc.stage, + 'stage_name': doc.stage_name(), + 'assignment': doc.assigned_to.username if doc.assigned_to else None, }) else: return JSONFormInvalid(form) -- 2.20.1