mirror of https://gitee.com/bigwinds/arangodb
This commit is contained in:
parent
3f1a9513ca
commit
0730c14416
|
@ -1,3 +1,7 @@
|
||||||
|
#documentsTableID .key {
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
table.dataTable thead th {
|
table.dataTable thead th {
|
||||||
cursor: default !important;
|
cursor: default !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="documentsTableID">
|
<table cellpadding="0" cellspacing="0" border="0" class="display" id="documentsTableID">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 100px">_key</th>
|
|
||||||
<th style="width: 490px">Content</th>
|
<th style="width: 490px">Content</th>
|
||||||
|
<th style="width: 100px">_key</th>
|
||||||
<th style="width: 10px"></th>
|
<th style="width: 10px"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
@ -138,7 +138,7 @@ var documentsView = Backbone.View.extend({
|
||||||
var hash = window.location.hash.split("/");
|
var hash = window.location.hash.split("/");
|
||||||
var page = hash[3];
|
var page = hash[3];
|
||||||
var deleted = false;
|
var deleted = false;
|
||||||
this.docid = $(self.idelement).text();
|
this.docid = $(self.idelement).next().text();
|
||||||
|
|
||||||
if (this.type === 'document') {
|
if (this.type === 'document') {
|
||||||
var result = window.arangoDocumentStore.deleteDocument(this.colid, this.docid);
|
var result = window.arangoDocumentStore.deleteDocument(this.colid, this.docid);
|
||||||
|
@ -184,12 +184,13 @@ var documentsView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
var checkData = $(this.table).dataTable().fnGetData(self);
|
var checkData = $(this.table).dataTable().fnGetData(self);
|
||||||
if (checkData && checkData[0] === '') {
|
if (checkData && checkData[1] === '') {
|
||||||
this.addDocument();
|
this.addDocument();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var docId = self.firstChild.textContent;
|
var docId = self.firstChild;
|
||||||
window.location.hash = "#collection/" + this.colid + "/" + docId;
|
var NeXt = $(docId).next().text();
|
||||||
|
window.location.hash = "#collection/" + this.colid + "/" + NeXt;
|
||||||
},
|
},
|
||||||
|
|
||||||
initTable: function (colid, pageid) {
|
initTable: function (colid, pageid) {
|
||||||
|
@ -207,9 +208,9 @@ var documentsView = Backbone.View.extend({
|
||||||
"iDisplayLength": -1,
|
"iDisplayLength": -1,
|
||||||
"bJQueryUI": false,
|
"bJQueryUI": false,
|
||||||
"aoColumns": [
|
"aoColumns": [
|
||||||
|
{ "sClass":"","bSortable": false, "sWidth":"500px"},
|
||||||
{ "sClass":"", "bSortable": false, "sWidth":"30px"},
|
{ "sClass":"", "bSortable": false, "sWidth":"30px"},
|
||||||
{ "sClass":"","bSortable": false},
|
{ "bSortable": false, "sClass": "", "sWidth":"20px"}
|
||||||
{ "bSortable": false, "sClass": ""}
|
|
||||||
],
|
],
|
||||||
"oLanguage": { "sEmptyTable": "No documents"}
|
"oLanguage": { "sEmptyTable": "No documents"}
|
||||||
});
|
});
|
||||||
|
@ -219,23 +220,36 @@ var documentsView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
drawTable: function() {
|
drawTable: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
$(self.table).dataTable().fnAddData([
|
$(self.table).dataTable().fnAddData([
|
||||||
'',
|
|
||||||
'<a id="plusIconDoc" style="padding-left: 30px">Add document</a>',
|
'<a id="plusIconDoc" style="padding-left: 30px">Add document</a>',
|
||||||
|
'',
|
||||||
'<img src="img/plus_icon.png" id="documentAddBtn"></img>'
|
'<img src="img/plus_icon.png" id="documentAddBtn"></img>'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$.each(window.arangoDocumentsStore.models, function(key, value) {
|
$.each(window.arangoDocumentsStore.models, function(key, value) {
|
||||||
|
|
||||||
|
var tempObj = {};
|
||||||
|
$.each(value.attributes.content, function(k, v) {
|
||||||
|
if (k === '_id' || k === '_rev' || k === '_key') {
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tempObj[k] = v;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$(self.table).dataTable().fnAddData([
|
$(self.table).dataTable().fnAddData([
|
||||||
|
|
||||||
|
'<pre class="prettify" title="'
|
||||||
|
+ self.escaped(JSON.stringify(tempObj))
|
||||||
|
+ '">'
|
||||||
|
+ self.cutByResolution(JSON.stringify(tempObj))
|
||||||
|
+ '</pre>',
|
||||||
|
|
||||||
'<div class="key">'
|
'<div class="key">'
|
||||||
+ value.attributes.key
|
+ value.attributes.key
|
||||||
+ '</div>',
|
+ '</div>',
|
||||||
'<pre class="prettify" title="'
|
|
||||||
+ self.escaped(JSON.stringify(value.attributes.content))
|
|
||||||
+ '">'
|
|
||||||
+ self.cutByResolution(JSON.stringify(value.attributes.content))
|
|
||||||
+ '</pre>',
|
|
||||||
'<button class="enabled" id="deleteDoc">'
|
'<button class="enabled" id="deleteDoc">'
|
||||||
+ '<img src="img/icon_delete.png" width="16" height="16"></button>'
|
+ '<img src="img/icon_delete.png" width="16" height="16"></button>'
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in New Issue