1
0
Fork 0

added on the fly search for collections

This commit is contained in:
Heiko Kernbach 2013-02-25 19:38:18 +01:00
parent e42a40d126
commit d1096d9501
5 changed files with 28 additions and 25 deletions

View File

@ -4,19 +4,6 @@
background-color: rgba(0, 0, 0, 0.05);
}
#addDocumentLine, #sourceView {
float:right;
margin-right: 10px;
margin-top: 11px;
margin-right: 22px;
opacity: 0.3;
}
#addDocumentLine:hover, #sourceView:hover{
opacity: 0.8;
cursor: pointer;
}
#deleteRow {
border: medium none;
padding-left: 10px;
@ -123,4 +110,4 @@
#tableDiv .nav-tabs > li:hover.active > a {
background: #FFF;
border: 1px solid #FFF;
}
}

View File

@ -8,7 +8,7 @@
<div id="tableDiv">
<ul class="nav nav-tabs">
<li class="pull-right" style:margin-right:0px;><a href="#">Source</a></li>
<li class="pull-right" style:margin-right:0px;><a id="sourceView">Source</a></li>
<li class="active pull-right">
<a href="#">Listview</a>
</li>

View File

@ -48,6 +48,10 @@ var collectionsView = Backbone.View.extend({
$('.thumbnails', this.el).append('<li class="span3"><a href="#new" class="add"><img id="newCollection" src="/_admin/html/img/plus_icon.png" class="pull-left"></img> Neu hinzufuegen</a></li>');
$('#searchInput').val(this.searchOptions.searchPhrase);
$('#searchInput').focus();
var val = $('#searchInput').val();
$('#searchInput').val('');
$('#searchInput').val(val);
return this;
},
@ -55,6 +59,7 @@ var collectionsView = Backbone.View.extend({
"click .icon-info-sign" : "details",
"blur #searchInput" : "restrictToSearchPhrase",
"keypress #searchInput" : "restrictToSearchPhraseKey",
"change #searchInput" : "restrictToSearchPhrase",
"click #searchSubmit" : "restrictToSearchPhrase"
},
@ -71,11 +76,15 @@ var collectionsView = Backbone.View.extend({
restrictToSearchPhraseKey: function (e) {
// key pressed in search box
var self = this;
if (e.keyCode == 13) {
e.preventDefault();
// return pressed? this triggers the search
this.search();
}
setTimeout(function (){
self.search();
}, 200);
},
restrictToSearchPhrase: function () {

View File

@ -66,6 +66,8 @@ var dashboardView = Backbone.View.extend({
var self = this;
this.collectionStats.loadedCollections = 0;
this.collectionStats.unloadedCollections = 0;
this.collectionStats.deletedCollections = 0;
this.collectionStats.newbornCollections = 0;
this.collectionStats.totalCollections = this.collection.length;
this.collection.each(function (arango_collection) {
@ -78,12 +80,12 @@ var dashboardView = Backbone.View.extend({
else if (arango_collection.get('status') === 'unloaded') {
self.collectionStats.unloadedCollections++;
}
else if (arango_collection.get('name').substr(0,1) === "_") {
self.collectionStats.systemCollections++;
}
else if (arango_collection.get('status') === 'deleted') {
self.collectionStats.deletedCollections++;
}
if (arango_collection.get('name').substr(0,1) === "_") {
self.collectionStats.systemCollections++;
}
});
},
formatCollectionsStats: function () {

View File

@ -40,6 +40,13 @@ var documentView = Backbone.View.extend({
},
drawTable: function () {
var self = this;
$(self.table).dataTable().fnAddData([
'<a class="add" class="notwriteable" id="addDocumentLine"><img id="addDocumentLine" class="plusIcon" class="pull-left" src="/_admin/html/img/plus_icon.png"> Neu hinzuf&uuml;gen</a>',
'<div class="notwriteable"></div>',
'<div class="notwriteable"></div>',
'<div class="notwriteable"></div>',
'<div class="notwriteable"></div>'
]);
$.each(window.arangoDocumentStore.models[0].attributes, function(key, value) {
if (arangoHelper.isSystemAttribute(key)) {
$(self.table).dataTable().fnAddData([
@ -62,13 +69,6 @@ var documentView = Backbone.View.extend({
});
this.makeEditable();
$(self.table).dataTable().fnAddData([
'<a href="#new" class="add"><img id="addDocumentLine" class="plusIcon" class="pull-left" src="/_admin/html/img/plus_icon.png"> Neu hinzuf&uuml;gen</a>',
'',
'',
'',
''
]);
},
addLine: function () {
@ -156,6 +156,10 @@ var documentView = Backbone.View.extend({
var self=this;
var i = 0;
$('.writeable', documentEditTable.fnGetNodes() ).each(function () {
var aPos = documentEditTable.fnGetPosition(this);
if (aPos[0] === 0) {
$(this).removeClass('writeable');
}
if ( i == 1) {
$(this).removeClass('writeable');
i = 0;
@ -167,6 +171,7 @@ var documentView = Backbone.View.extend({
});
$('.writeable', documentEditTable.fnGetNodes()).editable(function(value, settings) {
var aPos = documentEditTable.fnGetPosition(this);
console.log(aPos);
if (aPos[1] == 0) {
documentEditTable.fnUpdate(value, aPos[0], aPos[1]);
self.updateLocalDocumentStorage();