fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0768990
)
use proper commit id
author
Radek Czajka
<radoslaw.czajka@nowoczesnapolska.org.pl>
Fri, 28 Jan 2011 12:15:29 +0000
(13:15 +0100)
committer
Radek Czajka
<radoslaw.czajka@nowoczesnapolska.org.pl>
Fri, 28 Jan 2011 12:15:29 +0000
(13:15 +0100)
apps/wiki_img/forms.py
patch
|
blob
|
history
apps/wiki_img/views.py
patch
|
blob
|
history
redakcja/static/js/wiki_img/dialog_save.js
patch
|
blob
|
history
redakcja/static/js/wiki_img/wikiapi.js
patch
|
blob
|
history
diff --git
a/apps/wiki_img/forms.py
b/apps/wiki_img/forms.py
index
25f9413
..
bc9e2d6
100644
(file)
--- a/
apps/wiki_img/forms.py
+++ b/
apps/wiki_img/forms.py
@@
-74,7
+74,7
@@
class DocumentTextSaveForm(forms.Form):
"""
id = forms.CharField(widget=forms.HiddenInput)
"""
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(
text = forms.CharField(widget=forms.HiddenInput)
author_name = forms.CharField(
diff --git
a/apps/wiki_img/views.py
b/apps/wiki_img/views.py
index
c11549a
..
c4d32b7
100644
(file)
--- a/
apps/wiki_img/views.py
+++ b/
apps/wiki_img/views.py
@@
-38,7
+38,7
@@
def text(request, slug):
form = DocumentTextSaveForm(request.POST, prefix="textsave")
if form.is_valid():
document = get_object_or_404(ImageDocument, slug=slug)
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']
comment = form.cleaned_data['comment']
@@
-48,7
+48,7
@@
def text(request, slug):
user = None
document.doc.commit(
user = None
document.doc.commit(
- parent=
revision
,
+ parent=
commit
,
text=form.cleaned_data['text'],
author=user,
description=comment
text=form.cleaned_data['text'],
author=user,
description=comment
@@
-61,9
+61,10
@@
def text(request, slug):
else:
return JSONFormInvalid(form)
else:
else:
return JSONFormInvalid(form)
else:
- doc = get_object_or_404(ImageDocument, slug=slug)
+ doc = get_object_or_404(ImageDocument, slug=slug)
.doc
return JSONResponse({
return JSONResponse({
- 'text': doc.doc.materialize(),
- 'revision': doc.doc.change_set.count()
+ 'text': doc.materialize(),
+ 'revision': doc.change_set.count(),
+ 'commit': doc.head.id,
})
})
diff --git
a/redakcja/static/js/wiki_img/dialog_save.js
b/redakcja/static/js/wiki_img/dialog_save.js
index
aa9258d
..
84f012c
100644
(file)
--- a/
redakcja/static/js/wiki_img/dialog_save.js
+++ b/
redakcja/static/js/wiki_img/dialog_save.js
@@
-12,7
+12,7
@@
this.$form = $('form', element);
$("input[name='textsave-id']", this.$form).val(CurrentDocument.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);
};
$.wiki.cls.GenericDialog.call(this, element);
};
diff --git
a/redakcja/static/js/wiki_img/wikiapi.js
b/redakcja/static/js/wiki_img/wikiapi.js
index
2e4682c
..
0990e60
100644
(file)
--- a/
redakcja/static/js/wiki_img/wikiapi.js
+++ b/
redakcja/static/js/wiki_img/wikiapi.js
@@
-60,6
+60,7
@@
this.id = meta.attr('data-document-name');
this.revision = $("*[data-key='revision']", meta).text();
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();
this.readonly = !!$("*[data-key='readonly']", meta).text();
this.galleryLink = $("*[data-key='gallery']", meta).text();
@@
-83,17
+84,18
@@
$.ajax({
method: "GET",
url: reverse("ajax_document_text", self.id),
$.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;
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.text = data.text;
if (self.text === '') {
self.text = '<obraz></obraz>';
}
self.revision = data.revision;
+ self.commit = data.commit;
changed = true;
self.triggerDocumentChanged();
};
changed = true;
self.triggerDocumentChanged();
};
@@
-148,6
+150,7
@@
if (data.text) {
self.text = data.text;
self.revision = data.revision;
if (data.text) {
self.text = data.text;
self.revision = data.revision;
+ self.commit = data.commit;
changed = true;
self.triggerDocumentChanged();
};
changed = true;
self.triggerDocumentChanged();
};