This commit is contained in:
102
wwwroot/js/app.nav.js
Normal file
102
wwwroot/js/app.nav.js
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* app.nav.js
|
||||
* Handle dynamic navigation related operations
|
||||
* toobar, menu, fab etc
|
||||
*
|
||||
*/
|
||||
|
||||
/*jslint browser : true, continue : true,
|
||||
devel : true, indent : 2, maxerr : 50,
|
||||
newcap : true, nomen : true, plusplus : true,
|
||||
regexp : true, sloppy : true, vars : false,
|
||||
white : true
|
||||
*/
|
||||
/*global $, app */
|
||||
|
||||
app.nav = (function () {
|
||||
var contextClear, contextAddButton, contextAddLink, backUrl, backRemove, moreMenuInitialized,
|
||||
setContextTitle, setSelectedMenuItem;
|
||||
|
||||
|
||||
|
||||
// ///////////////////////////////////////////
|
||||
// //Set context menu title
|
||||
// //
|
||||
// var setContextTitle = function (title) {
|
||||
// $("#rf-context-title").html(title + "...");
|
||||
// }
|
||||
|
||||
////////////////////////////////////////////////
|
||||
//Clear the contents of the context menu (reset it)
|
||||
//
|
||||
contextClear = function () {
|
||||
$("#rf-context-group").empty();
|
||||
$("#rf-context-group").addClass("invisible");
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////
|
||||
//Add a non nav button item to the context menu
|
||||
//
|
||||
contextAddButton = function (id, title, icon, clickHandler) {
|
||||
var $group=$("#rf-context-group");
|
||||
$group.removeClass("invisible");
|
||||
|
||||
var iconClass = '';
|
||||
if (icon) {
|
||||
iconClass = "mdi mdi-" + icon;
|
||||
}
|
||||
$group.append(
|
||||
'<button type="button" id="' + id + '" class="btn btn-outline-dark ' + iconClass + '" href="#">' + title + '</a>'
|
||||
);
|
||||
|
||||
$('#' + id).bind('click', clickHandler);
|
||||
|
||||
};
|
||||
|
||||
// <button type="button" class="btn btn-outline-dark mdi mdi-key">Left</button>
|
||||
|
||||
////////////////////////////////////////////////
|
||||
//Add an url item to the context menu handling
|
||||
//phone vs larger sizes
|
||||
//
|
||||
contextAddLink = function (url, title, icon) {
|
||||
var $group=$("#rf-context-group");
|
||||
$group.removeClass("invisible");
|
||||
var iconClass = '';
|
||||
if (icon) {
|
||||
iconClass = "mdi mdi-" + icon;
|
||||
}
|
||||
$group.append(
|
||||
'<a class="btn btn-outline-dark ' + iconClass + '" href="#!/' + encodeURI(url) + '">' + title + '</a>'
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////
|
||||
//Set the active class on the selected menu item
|
||||
//
|
||||
setSelectedMenuItem = function (selectedMenuItem) {
|
||||
$(".nav-item").removeClass("active");
|
||||
if (selectedMenuItem) {
|
||||
$("#" + selectedMenuItem).addClass("active");
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return {
|
||||
contextClear: contextClear,
|
||||
contextAddButton: contextAddButton,
|
||||
contextAddLink: contextAddLink,
|
||||
setContextTitle: setContextTitle,
|
||||
setSelectedMenuItem: setSelectedMenuItem
|
||||
|
||||
};
|
||||
}());
|
||||
Reference in New Issue
Block a user