Editing The Management Navigation
Our Management Navigation bar currently looks like the one for the public page which doesn't do us any good since we have a whole different set of needs in this part of our website. We are going to be displaying links to tools we need to manage our site, not to browse it like a consumer.
Here are the tools we are going to have:
- Managing Articles and text for the site ( manageArticles.bxm)
- Managing books and book data ( manageBooks.bxm )
- Managing Users and those allowed in the management area ( manageUsers.bxm )
We are going to relocate the management search form and do some other needed code tweaks.
!!!note Throughout the book there are code samples which indicate adding and removing lines of code. The line numbers mght not always line up exactly with what your code does but the snippet itself should be accurately self contained.
BoxLang uses the # to indicate a variable or code which needs to be evaluated. However, in Javascript and CSS, the # also refers to an id of an element or a even just a placeholder at times. In our managementNav.bxm page, there are a few places where this occurs and our BoxLang server is going to object. In this case, it is used as a placeholder for a link so we replace it with the link to the default tool: dashboard.
<bx:output>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">
<a class="navbar-brand" href="#cgi.script_name#?tool=dashboard">
<img src="/images/rdb.png" alt="Read Dees Books Logo"/>
</a>
Because we added <bx:output> we need to also add </bx:output> at the end of the file to keep our syntax instact.
</bx:output>
Here, the # is being used literally as a referenece to the element with the id of navbarSupportedContent. In order to have a single # appear where it needs to but also satisfy BoxLang, we need to double up the # to ## which BoxLang will rewrite as a single # so the HTML and CSS can read it correctly.
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="##navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
<a class="nav-link" href="#cgi.script_name#?tool=dashboard">Home #currClass#</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Store Information</a>
<a class="nav-link" href="#cgi.script_name#?tool=manageArticles">Articles #currClass#</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Highlighted Favorites</a>
<a class="nav-link" href="#cgi.script_name#?tool=manageBooks">Books #currClass#</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Events</a>
<a class="nav-link" href="#cgi.script_name#?tool=manageUsers">Users #currClass#</a>
</li>
</ul>
</div>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>