mirror of https://gitee.com/bigwinds/arangodb
54 lines
1.5 KiB
JavaScript
54 lines
1.5 KiB
JavaScript
/*jslint indent: 2, nomen: true, maxlen: 100, vars: true, white: true, plusplus: true */
|
|
/*global Backbone, templateEngine, $, window*/
|
|
(function() {
|
|
"use strict";
|
|
window.NavigationView = Backbone.View.extend({
|
|
el: '#navigationBar',
|
|
|
|
events: {
|
|
"change #arangoCollectionSelect": "navigateBySelect",
|
|
"click .tab": "navigateByTab"
|
|
},
|
|
|
|
template: templateEngine.createTemplate("navigationView.ejs"),
|
|
|
|
render: function() {
|
|
$(this.el).html(this.template.render({isSystem: window.currentDB.get("isSystem")}));
|
|
return this;
|
|
},
|
|
|
|
handleResize: function (margin) {
|
|
$('.arango-logo').css('margin-left', margin - 41);
|
|
$('.nav-collapse').css('margin-right', margin + 7);
|
|
},
|
|
|
|
|
|
navigateBySelect: function() {
|
|
var navigateTo = $("#arangoCollectionSelect").find("option:selected").val();
|
|
window.App.navigate(navigateTo, {trigger: true});
|
|
},
|
|
|
|
navigateByTab: function(e) {
|
|
var tab = e.target || e.srcElement;
|
|
var navigateTo = tab.id;
|
|
window.App.navigate(navigateTo, {trigger: true});
|
|
e.stopPropagation();
|
|
},
|
|
handleSelectNavigation: function () {
|
|
$("#arangoCollectionSelect").change(function() {
|
|
var navigateTo = $(this).find("option:selected").val();
|
|
window.App.navigate(navigateTo, {trigger: true});
|
|
});
|
|
},
|
|
|
|
|
|
selectMenuItem: function (menuItem) {
|
|
$('.nav li').removeClass('active');
|
|
if (menuItem) {
|
|
$('.' + menuItem).addClass('active');
|
|
}
|
|
}
|
|
|
|
});
|
|
}());
|