Skip to content

Commit 35503c4

Browse files
committed
Enhance navigation experience
1 parent 8c25a79 commit 35503c4

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @var string
2020
*/
21-
define('MPG_APP_VERSION', '1.0.7');
21+
define('MPG_APP_VERSION', '1.0.8');
2222

2323
/**
2424
* Development mode?

static/js/mpg.database.visualize.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,39 @@ MPG.visNetworkOptions = {
3333

3434
};
3535

36+
/**
37+
* Forwards navigation links.
38+
*
39+
* @returns {void}
40+
*/
41+
MPG.helpers.forwardNavLinks = function() {
42+
43+
var fragmentUrl = window.location.hash.split('#');
44+
45+
if ( fragmentUrl.length === 2 && fragmentUrl[1] !== '' ) {
46+
47+
databaseAndCollectionName = fragmentUrl[1].split('/');
48+
49+
if ( databaseAndCollectionName.length === 1 ) {
50+
51+
MPG.helpers.completeNavLinks('#' + databaseAndCollectionName[0]);
52+
53+
} else if ( databaseAndCollectionName.length === 2 ) {
54+
55+
MPG.helpers.completeNavLinks(
56+
'#' + databaseAndCollectionName[0] + '/' + databaseAndCollectionName[1]
57+
);
58+
59+
}
60+
61+
}
62+
63+
};
64+
3665
/**
3766
* Draws vis.Network graph.
67+
*
68+
* @returns {void}
3869
*/
3970
MPG.drawVisNetwork = function() {
4071

@@ -84,7 +115,9 @@ MPG.drawVisNetwork = function() {
84115
// When document is ready:
85116
window.addEventListener('DOMContentLoaded', function(_event) {
86117

118+
MPG.helpers.forwardNavLinks();
87119
MPG.eventListeners.addMenuToggle();
120+
88121
MPG.drawVisNetwork();
89122

90123
});

static/js/mpg.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ MPG.helpers.navigateOnSamePage = function() {
128128
/**
129129
* Completes navigation links with an URL fragment.
130130
*
131-
* @param {string} urlFragment
131+
* @param {string} urlFragment
132+
*
133+
* @returns {void}
132134
*/
133135
MPG.helpers.completeNavLinks = function(urlFragment) {
134136

views/parts/menu.tpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div class="navbar-nav">
66
<a class="nav-item nav-link<?php echo ('collection' === $viewName) ? ' active' : ''; ?>" data-canonical-url="<?php echo MPG_BASE_URL; ?>/manageCollections" href="<?php echo MPG_BASE_URL; ?>/manageCollections">Manage collections</a>
77
<a class="nav-item nav-link<?php echo ('collection.import' === $viewName) ? ' active' : ''; ?>" data-canonical-url="<?php echo MPG_BASE_URL; ?>/importDocuments" href="<?php echo MPG_BASE_URL; ?>/importDocuments">Import documents</a>
8-
<a class="nav-item nav-link<?php echo ('database.visualize' === $viewName) ? ' active' : ''; ?>" href="<?php echo MPG_BASE_URL; ?>/visualizeDatabase">Visualize database</a>
8+
<a class="nav-item nav-link<?php echo ('database.visualize' === $viewName) ? ' active' : ''; ?>" data-canonical-url="<?php echo MPG_BASE_URL; ?>/visualizeDatabase" href="<?php echo MPG_BASE_URL; ?>/visualizeDatabase">Visualize database</a>
99
<a class="nav-item nav-link<?php echo ('database.query' === $viewName) ? ' active' : ''; ?>" data-canonical-url="<?php echo MPG_BASE_URL; ?>/queryDatabase" href="<?php echo MPG_BASE_URL; ?>/queryDatabase">Query database</a>
1010
<a class="nav-item nav-link<?php echo ('collection.indexes' === $viewName) ? ' active' : ''; ?>" data-canonical-url="<?php echo MPG_BASE_URL; ?>/manageIndexes" href="<?php echo MPG_BASE_URL; ?>/manageIndexes">Manage indexes</a>
1111
<a class="nav-item nav-link<?php echo ('database.users' === $viewName) ? ' active' : ''; ?>" data-canonical-url="<?php echo MPG_BASE_URL; ?>/manageUsers" href="<?php echo MPG_BASE_URL; ?>/manageUsers">Manage users</a>

0 commit comments

Comments
 (0)