Compare commits
3 commits
e2ea4e3aab
...
9730b046ce
| Author | SHA1 | Date | |
|---|---|---|---|
| 9730b046ce | |||
| 708a5b1b33 | |||
| 55b86bdac8 |
4 changed files with 25 additions and 22 deletions
|
|
@ -270,10 +270,7 @@ class Annotation(models.Model):
|
||||||
from translation.models import Translation
|
from translation.models import Translation
|
||||||
layer = self.get_layer()
|
layer = self.get_layer()
|
||||||
if layer.get('translate'):
|
if layer.get('translate'):
|
||||||
t, created = Translation.objects.get_or_create(lang=lang, key=self.value)
|
Translation.objects.get_or_create(lang=lang, key=self.value, defaults={'type': Translation.CONTENT})
|
||||||
if created:
|
|
||||||
t.type = Translation.CONTENT
|
|
||||||
t.save()
|
|
||||||
|
|
||||||
def delete(self, *args, **kwargs):
|
def delete(self, *args, **kwargs):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
|
|
||||||
|
|
@ -118,10 +118,7 @@ def getPage(request, data):
|
||||||
name = data
|
name = data
|
||||||
else:
|
else:
|
||||||
name = data['name']
|
name = data['name']
|
||||||
page, created = models.Page.objects.get_or_create(name=name)
|
page, created = models.Page.objects.get_or_create(name=name, defaults={'text': ''})
|
||||||
if created:
|
|
||||||
page.text = ''
|
|
||||||
page.save()
|
|
||||||
response = json_response({'name': page.name, 'text': page.text})
|
response = json_response({'name': page.name, 'text': page.text})
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(getPage)
|
actions.register(getPage)
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,8 @@ class Document(models.Model):
|
||||||
value = self.get_value(source, u'')
|
value = self.get_value(source, u'')
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
value = u','.join(value)
|
value = u','.join(value)
|
||||||
|
if not isinstance(value, str):
|
||||||
|
value = str(value)
|
||||||
value = utils.sort_string(value)[:955]
|
value = utils.sort_string(value)[:955]
|
||||||
set_value(s, name, value)
|
set_value(s, name, value)
|
||||||
elif sort_type == 'words':
|
elif sort_type == 'words':
|
||||||
|
|
|
||||||
|
|
@ -137,8 +137,10 @@ pandora.ui.collection = function() {
|
||||||
|
|
||||||
that.bindEvent({
|
that.bindEvent({
|
||||||
closepreview: function(data) {
|
closepreview: function(data) {
|
||||||
pandora.$ui.previewDialog.close();
|
if (pandora.$ui.documentDialog) {
|
||||||
delete pandora.$ui.previewDialog;
|
pandora.$ui.documentDialog.close();
|
||||||
|
delete pandora.$ui.documentDialog;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
copy: function(data) {
|
copy: function(data) {
|
||||||
pandora.clipboard.copy(data.ids, 'document');
|
pandora.clipboard.copy(data.ids, 'document');
|
||||||
|
|
@ -227,20 +229,25 @@ pandora.ui.collection = function() {
|
||||||
pandora.UI.set(set);
|
pandora.UI.set(set);
|
||||||
},
|
},
|
||||||
openpreview: function(data) {
|
openpreview: function(data) {
|
||||||
/*
|
if (!pandora.$ui.documentDialog) {
|
||||||
if (!pandora.$ui.previewDialog) {
|
pandora.$ui.documentDialog = pandora.openDocumentDialog({
|
||||||
pandora.$ui.previewDialog = pandora.ui.previewDialog()
|
documents: that.options('selected').map(function(id) {
|
||||||
.open()
|
return that.value(id);
|
||||||
.bindEvent({
|
})
|
||||||
close: function() {
|
}).bindEvent({
|
||||||
that.closePreview();
|
close: function() {
|
||||||
delete pandora.$ui.previewDialog;
|
that.closePreview();
|
||||||
}
|
delete pandora.$ui.documentDialog;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
pandora.$ui.previewDialog.update();
|
pandora.$ui.documentDialog.update({
|
||||||
|
index: 0,
|
||||||
|
items: that.options('selected').map(function(id) {
|
||||||
|
return that.value(id);
|
||||||
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
},
|
},
|
||||||
paste: function(data) {
|
paste: function(data) {
|
||||||
var items = pandora.clipboard.paste();
|
var items = pandora.clipboard.paste();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue