Compare commits

..

No commits in common. "9730b046ceeddcf9de99de57fbc6e159fcd20041" and "e2ea4e3aabfb3970a644965450a49d995fa3a56a" have entirely different histories.

4 changed files with 22 additions and 25 deletions

View file

@ -270,7 +270,10 @@ class Annotation(models.Model):
from translation.models import Translation
layer = self.get_layer()
if layer.get('translate'):
Translation.objects.get_or_create(lang=lang, key=self.value, defaults={'type': Translation.CONTENT})
t, created = Translation.objects.get_or_create(lang=lang, key=self.value)
if created:
t.type = Translation.CONTENT
t.save()
def delete(self, *args, **kwargs):
with transaction.atomic():

View file

@ -118,7 +118,10 @@ def getPage(request, data):
name = data
else:
name = data['name']
page, created = models.Page.objects.get_or_create(name=name, defaults={'text': ''})
page, created = models.Page.objects.get_or_create(name=name)
if created:
page.text = ''
page.save()
response = json_response({'name': page.name, 'text': page.text})
return render_to_json_response(response)
actions.register(getPage)

View file

@ -235,8 +235,6 @@ class Document(models.Model):
value = self.get_value(source, u'')
if isinstance(value, list):
value = u','.join(value)
if not isinstance(value, str):
value = str(value)
value = utils.sort_string(value)[:955]
set_value(s, name, value)
elif sort_type == 'words':

View file

@ -137,10 +137,8 @@ pandora.ui.collection = function() {
that.bindEvent({
closepreview: function(data) {
if (pandora.$ui.documentDialog) {
pandora.$ui.documentDialog.close();
delete pandora.$ui.documentDialog;
}
pandora.$ui.previewDialog.close();
delete pandora.$ui.previewDialog;
},
copy: function(data) {
pandora.clipboard.copy(data.ids, 'document');
@ -229,25 +227,20 @@ pandora.ui.collection = function() {
pandora.UI.set(set);
},
openpreview: function(data) {
if (!pandora.$ui.documentDialog) {
pandora.$ui.documentDialog = pandora.openDocumentDialog({
documents: that.options('selected').map(function(id) {
return that.value(id);
})
}).bindEvent({
close: function() {
that.closePreview();
delete pandora.$ui.documentDialog;
}
});
/*
if (!pandora.$ui.previewDialog) {
pandora.$ui.previewDialog = pandora.ui.previewDialog()
.open()
.bindEvent({
close: function() {
that.closePreview();
delete pandora.$ui.previewDialog;
}
});
} else {
pandora.$ui.documentDialog.update({
index: 0,
items: that.options('selected').map(function(id) {
return that.value(id);
})
});
pandora.$ui.previewDialog.update();
}
*/
},
paste: function(data) {
var items = pandora.clipboard.paste();