);
{% endif %}
- var data = {% autoescape off%}{{serialized_document_data}}{%endautoescape%};
+ {% autoescape off%}
+ var data = {{serialized_document_data}},
+ templates = {{serialized_templates}}
+ {%endautoescape%}
var editor_init = function(Editor) {
Editor.setBootstrappedData('data', data);
+ Editor.setBootstrappedData('documentToolbar', templates);
Editor.start(config);
};
</script>
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,
'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")