"""
id = forms.CharField(widget=forms.HiddenInput)
- parent_revision = forms.IntegerField(widget=forms.HiddenInput)
+ parent_commit = forms.IntegerField(widget=forms.HiddenInput)
text = forms.CharField(widget=forms.HiddenInput)
author_name = forms.CharField(
form = DocumentTextSaveForm(request.POST, prefix="textsave")
if form.is_valid():
document = get_object_or_404(ImageDocument, slug=slug)
- revision = form.cleaned_data['parent_revision']
+ commit = form.cleaned_data['parent_commit']
comment = form.cleaned_data['comment']
user = None
document.doc.commit(
- parent=revision,
+ parent=commit,
text=form.cleaned_data['text'],
author=user,
description=comment
else:
return JSONFormInvalid(form)
else:
- doc = get_object_or_404(ImageDocument, slug=slug)
+ doc = get_object_or_404(ImageDocument, slug=slug).doc
return JSONResponse({
- 'text': doc.doc.materialize(),
- 'revision': doc.doc.change_set.count()
+ 'text': doc.materialize(),
+ 'revision': doc.change_set.count(),
+ 'commit': doc.head.id,
})
this.$form = $('form', element);
$("input[name='textsave-id']", this.$form).val(CurrentDocument.id);
- $("input[name='textsave-parent_revision']", this.$form).val(CurrentDocument.revision);
+ $("input[name='textsave-parent_commit']", this.$form).val(CurrentDocument.commit);
$.wiki.cls.GenericDialog.call(this, element);
};
this.id = meta.attr('data-document-name');
this.revision = $("*[data-key='revision']", meta).text();
+ this.commit = $("*[data-key='commit']", meta).text();
this.readonly = !!$("*[data-key='readonly']", meta).text();
this.galleryLink = $("*[data-key='gallery']", meta).text();
$.ajax({
method: "GET",
url: reverse("ajax_document_text", self.id),
- data: {"revision": self.revision},
+ data: {"commit": self.commit},
dataType: 'json',
success: function(data) {
var changed = false;
- if (self.text === null || self.revision !== data.revision) {
+ if (self.text === null || self.commit !== data.commit) {
self.text = data.text;
if (self.text === '') {
self.text = '<obraz></obraz>';
}
self.revision = data.revision;
+ self.commit = data.commit;
changed = true;
self.triggerDocumentChanged();
};
if (data.text) {
self.text = data.text;
self.revision = data.revision;
+ self.commit = data.commit;
changed = true;
self.triggerDocumentChanged();
};