aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2016-05-14 14:15:10 +0200
committerKristian Lyngstol <kristian@bohemians.org>2016-05-14 14:15:10 +0200
commit36ba81c8b4ce3bced4898d45853d2b736ef9b2b4 (patch)
tree892d968432b0899582e37235c8da7b946e33f598
parent55f2f43db3b82cacaf459a374176a8ddd56c1b73 (diff)
Add tabs for admin/map
The admin-tab is currently empty. That is besides the point. Closes #18
-rw-r--r--web/index.html14
-rw-r--r--web/js/nms-ui.js23
-rw-r--r--web/js/nms.js19
3 files changed, 55 insertions, 1 deletions
diff --git a/web/index.html b/web/index.html
index e951901..3569b3f 100644
--- a/web/index.html
+++ b/web/index.html
@@ -65,6 +65,9 @@
right: 5%;
z-index: 999;
}
+ #admin {
+ display: none;
+ }
.vertical div.map-mode-legend {
top: -10px;
right: 30px;
@@ -93,6 +96,8 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
+ <li id='map-link' class="active"><a href="#" onclick="nmsUi.setActive('map');">Map<span class="sr-only">(current)</span></a></li>
+ <li id='admin-link'><a href="#" onclick="nmsUi.setActive('admin');">Admin</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Menu
<span class="caret"></span>
@@ -147,7 +152,13 @@
</div>
</nav>
- <div class="container-fluid" id="wrap">
+
+ <div class="container-fluid" id="admin">
+ <div class="row-fluid" id="admin-row">
+ Admin-stuff goes here.
+ </div>
+ </div>
+ <div class="container-fluid" id="map">
<div class="row-fluid">
<div class="span12">
@@ -314,6 +325,7 @@
<script type="text/javascript" src="js/nms.js"></script>
<script type="text/javascript" src="js/nms-color-util.js"></script>
<script type="text/javascript" src="js/nms-map-handlers.js"></script>
+ <script type="text/javascript" src="js/nms-ui.js"></script>
<script src="js/jquery.datetimepicker.full.js" type="text/javascript"></script>
<script type="text/javascript">
initNMS();
diff --git a/web/js/nms-ui.js b/web/js/nms-ui.js
new file mode 100644
index 0000000..411ed2f
--- /dev/null
+++ b/web/js/nms-ui.js
@@ -0,0 +1,23 @@
+"use strict";
+
+
+/*
+ * The idea is to gradually move pure UI stuff into nmsUi.
+ */
+var nmsUi = nmsUi || {
+ _active: "map"
+};
+
+nmsUi.setActive = function(pane) {
+ var old = document.getElementById(nmsUi._active);
+ var newp = document.getElementById(pane);
+ old.style.display = "none";
+ newp.style.display = "block";
+
+ var oldlink = document.getElementById(nmsUi._active + "-link");
+ var newlink = document.getElementById(pane + "-link");
+ oldlink.classList.remove("active");
+ newlink.classList.add("active");
+
+ nmsUi._active = pane;
+}
diff --git a/web/js/nms.js b/web/js/nms.js
index cd60633..1f7398b 100644
--- a/web/js/nms.js
+++ b/web/js/nms.js
@@ -1,4 +1,21 @@
"use strict";
+
+/*
+ * This is the original nms.js and it's a bit of a mess as much has been
+ * moved into separate js-files and cleaned up.
+ *
+ * Gradual refactoring has begun.
+ *
+ * On the TODO list:
+ *
+ * - Move all pure UI stuff into nmsUi: nightMode, vertical mode,
+ * menushowing,
+ * - Get rid of "tvmode". As in: complete the merge
+ * - Move all time-travel related code out into a separate entity.
+ * - Remove nms.now: it belongs in nmsData.
+ * - nms.timers probably also deserves to die. It used to do a lot more,
+ * now it's just leftovers.
+ */
var nms = {
stats:{}, // Various internal stats
get nightMode() { return this._nightMode; },
@@ -495,6 +512,8 @@ function isIn(box, x, y)
/*
* Return the name of the switch found at coordinates (x,y), or 'undefined'
* if none is found.
+ *
+ * FIXME: this belongs in nmsMap.
*/
function findSwitch(x,y) {
x = parseInt(parseInt(x) / nmsMap.scale);