1
0
Fork 0

Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel

This commit is contained in:
Michael Hackstein 2013-04-05 17:24:09 +02:00
commit c59f39c1c9
2 changed files with 54 additions and 3 deletions

View File

@ -1,3 +1,20 @@
.sorting_1 textarea {
display: inline !important;
}
.textInline {
display:inline !important;
}
.validateError {
border: 2px solid red !important;
}
.disabledBtn {
opacity: 0.4 !important;
cursor: default !important;
}
#collectionPrev, #collectionNext{ #collectionPrev, #collectionNext{
cursor: pointer; cursor: pointer;
} }

View File

@ -18,7 +18,8 @@ var documentView = Backbone.View.extend({
"click #documentTableID tr" : "clicked", "click #documentTableID tr" : "clicked",
"click #editSecondRow" : "editSecond", "click #editSecondRow" : "editSecond",
"keydown .sorting_1" : "listenKey", "keydown .sorting_1" : "listenKey",
"keydown" : "listenGlobalKey" "keydown" : "listenGlobalKey",
"blur textarea" : "checkFocus",
}, },
checkFocus: function(e) { checkFocus: function(e) {
@ -28,9 +29,10 @@ var documentView = Backbone.View.extend({
$.each(data, function(key, val) { $.each(data, function(key, val) {
if (val[0] === self.currentKey) { if (val[0] === self.currentKey) {
$(self.table).dataTable().fnDeleteRow( key ); $(self.table).dataTable().fnDeleteRow( key );
$('#addRow').removeClass('disabledBtn');
} }
}); });
$('td').removeClass('validateError');
}, },
listenGlobalKey: function(e) { listenGlobalKey: function(e) {
@ -105,6 +107,7 @@ var documentView = Backbone.View.extend({
var result = window.arangoDocumentStore.saveDocument(this.colid, this.docid, model); var result = window.arangoDocumentStore.saveDocument(this.colid, this.docid, model);
if (result === true) { if (result === true) {
arangoHelper.arangoNotification('Document saved'); arangoHelper.arangoNotification('Document saved');
$('td').removeClass('validateError');
} }
else if (result === false) { else if (result === false) {
arangoHelper.arangoAlert('Document error'); arangoHelper.arangoAlert('Document error');
@ -116,6 +119,7 @@ var documentView = Backbone.View.extend({
var result = window.arangoDocumentStore.saveEdge(this.colid, this.docid, model); var result = window.arangoDocumentStore.saveEdge(this.colid, this.docid, model);
if (result === true) { if (result === true) {
arangoHelper.arangoNotification('Edge saved'); arangoHelper.arangoNotification('Edge saved');
$('td').removeClass('validateError');
} }
else if (result === false) { else if (result === false) {
arangoHelper.arangoError('Edge error'); arangoHelper.arangoError('Edge error');
@ -173,6 +177,10 @@ var documentView = Backbone.View.extend({
}, },
addLine: function (event) { addLine: function (event) {
if ($('#addRow').hasClass('disabledBtn') === true) {
return;
}
$('#addRow').addClass('disabledBtn');
//event.stopPropagation(); //event.stopPropagation();
var randomKey = arangoHelper.getRandomToken(); var randomKey = arangoHelper.getRandomToken();
var self = this; var self = this;
@ -342,9 +350,35 @@ var documentView = Backbone.View.extend({
cancelcssclass: 'btn btn-danger pull-right', cancelcssclass: 'btn btn-danger pull-right',
cancel: 'Cancel', cancel: 'Cancel',
submit: 'Save', submit: 'Save',
onblur: 'ignore' onblur: 'cancel',
onsubmit: self.validate
}); });
}, },
validate: function (settings, td) {
var returnval = true;
if ($(td).hasClass('sorting_1') === true) {
var toCheck = $('textarea').val();
var data = $('#documentTableID').dataTable().fnGetData();
if (toCheck === '') {
$(td).addClass('validateError');
arangoHelper.arangoNotification("Key is empty!");
returnval = false;
return returnval;
}
$.each(data, function(key, val) {
if (val[0] === toCheck) {
$(td).addClass('validateError');
arangoHelper.arangoNotification("Key already exists!");
returnval = false;
}
});
}
else if ($(td).hasClass('rightCell') === true) {
}
return returnval;
},
getTypedValue: function (value) { getTypedValue: function (value) {
value = value.replace(/(^\s+|\s+$)/g, ''); value = value.replace(/(^\s+|\s+$)/g, '');
if (value == 'true') { if (value == 'true') {