1
0
Fork 0

modal design + redrawing view after collection load/unload

This commit is contained in:
Heiko Kernbach 2013-03-01 12:31:46 +01:00
parent 23bcbd9d34
commit a2bf43e2b1
6 changed files with 26 additions and 15 deletions

View File

@ -6,6 +6,7 @@
.modal-body .icon-info-sign { .modal-body .icon-info-sign {
padding-bottom: 5px; padding-bottom: 5px;
margin-bottom: 10px; margin-bottom: 10px;
margin-left: 10px;
opacity: 0.7; opacity: 0.7;
} }

View File

@ -214,6 +214,11 @@ window.arangoCollections = Backbone.Collection.extend({
url: "/_api/collection/" + id + "/load", url: "/_api/collection/" + id + "/load",
success: function () { success: function () {
arangoHelper.arangoNotification('Collection loaded'); arangoHelper.arangoNotification('Collection loaded');
window.arangoCollectionsStore.fetch({
success: function () {
window.collectionsView.render();
}
});
}, },
error: function (data) { error: function (data) {
var temp = JSON.parse(data.responseText); var temp = JSON.parse(data.responseText);
@ -228,6 +233,11 @@ window.arangoCollections = Backbone.Collection.extend({
url: "/_api/collection/" + id + "/unload", url: "/_api/collection/" + id + "/unload",
success: function () { success: function () {
arangoHelper.arangoNotification('Collection unloaded'); arangoHelper.arangoNotification('Collection unloaded');
window.arangoCollectionsStore.fetch({
success: function () {
window.collectionsView.render();
}
});
}, },
error: function () { error: function () {
var temp = JSON.parse(data.responseText); var temp = JSON.parse(data.responseText);

View File

@ -20,6 +20,10 @@ $(document).ready(function() {
window.arangoDocumentsStore = new window.arangoDocuments(); window.arangoDocumentsStore = new window.arangoDocuments();
window.arangoDocumentStore = new window.arangoDocument(); window.arangoDocumentStore = new window.arangoDocument();
window.collectionView = new window.collectionView({
model: arangoCollection
});
window.dashboardView = new window.dashboardView({ window.dashboardView = new window.dashboardView({
collection: window.arangoCollectionsStore collection: window.arangoCollectionsStore
}); });
@ -55,26 +59,22 @@ $(document).ready(function() {
window.arangoCollectionsStore.fetch({ window.arangoCollectionsStore.fetch({
success: function () { success: function () {
var collectionsView = new window.collectionsView({ window.collectionsView = new window.collectionsView({
collection: window.arangoCollectionsStore collection: window.arangoCollectionsStore
}); });
collectionsView.render(); window.collectionsView.render();
naviView.selectMenuItem('collections-menu'); naviView.selectMenuItem('collections-menu');
} }
}); });
}, },
collection: function(colid) { collection: function(colid) {
//TODO: if-statement for every view ! //TODO: if-statement for every view !
if (!this.collectionView) { if (!window.collectionView) {
this.collectionView = new window.collectionView({
colId: colid,
model: arangoCollection
});
} }
else { else {
this.collectionView.options.colId = colid;
} }
this.collectionView.render(); window.collectionView.options.colId = colid;
window.collectionView.render();
}, },
newCollection: function() { newCollection: function() {
if (!this.newCollectionView) { if (!this.newCollectionView) {

View File

@ -40,7 +40,7 @@
</tr> </tr>
<tr> <tr>
<th class="collectionTh">Status:</th> <th class="collectionTh">Status:</th>
<th class="collectionTh"> <th class="collectionTh">
<div id="change-collection-status" class="modal-text"/> <div id="change-collection-status" class="modal-text"/>
</th> </th>
@ -49,7 +49,7 @@
</table> </table>
</div> </div>
<div id="colFooter" class="modal-footer"> <div id="colFooter" class="modal-footer">
<button id="delete-modified-collection" class="btn btn-danger" style="float:right">Delete</button> <button id="delete-modified-collection" class="btn btn-danger pull-right" style="margin-right:8px">Delete</button>
<button id="save-modified-collection" class="btn btn-success">Save</button> <button id="save-modified-collection" class="btn btn-success pull-left">Save</button>
</div> </div>
</div> </div>

View File

@ -60,6 +60,6 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button id="save-new-collection" class="btn btn-success">Create Collection</button> <button id="save-new-collection" class="btn btn-success pull-left">Create Collection</button>
</div> </div>
</div> </div>

View File

@ -35,12 +35,12 @@ var collectionView = Backbone.View.extend({
$('#change-collection-status').text(this.myCollection.status); $('#change-collection-status').text(this.myCollection.status);
if (this.myCollection.status == 'unloaded') { if (this.myCollection.status == 'unloaded') {
$('#colFooter').append('<button id="load-modified-collection" class="btn">Load</button>'); $('#colFooter').append('<button id="load-modified-collection" class="btn" style="margin-right: 10px">Load</button>');
$('#collectionSizeBox').hide(); $('#collectionSizeBox').hide();
$('#collectionSyncBox').hide(); $('#collectionSyncBox').hide();
} }
else if (this.myCollection.status == 'loaded') { else if (this.myCollection.status == 'loaded') {
$('#colFooter').append('<button id="unload-modified-collection" class="btn">Unload</button>'); $('#colFooter').append('<button id="unload-modified-collection" class="btn" style="margin-right: 10px">Unload</button>');
var data = window.arangoCollectionsStore.getProperties(this.options.colId, true); var data = window.arangoCollectionsStore.getProperties(this.options.colId, true);
this.fillLoadedModal(data); this.fillLoadedModal(data);
} }