ppyordanov / Dynamic-Noise-and-Pollution-Map

A dynamically generated University of Glasgow noise and pollution campus map via the innovative Smart Citizen Kit developed in Barcelona, Spain by FabLab.
0 stars 0 forks source link

Refactor JSP structure #75

Closed ppyordanov closed 9 years ago

ppyordanov commented 9 years ago

The .jsp file structure needs refactoring as the main file "home.jsp" has started to increase in size and needs to be decomposed into smaller chunk components that could then be potentially reused on different pages, e.g. the navigation bar will be extracted in a separate file for easy inclusion.

ppyordanov commented 9 years ago

The JSP files have been split into separate components facilitating further template development. The main component types are as follows:

Here is the file list after refactoring, accompanied by a brief documentation of each component's role:

structure

var obj = JSON.parse(text);
    <link type="text/css" href="${pageContext.request.contextPath}/resources/external/bs/css/bootstrap.css"
          rel="stylesheet"/>
    <link type="text/css" href="${pageContext.request.contextPath}/resources/custom/main.css" rel="stylesheet"/>
    <link type="text/css" href="${pageContext.request.contextPath}/resources/external/jquery/jquery-ui.css"
          rel="stylesheet"/>

    <script src="${pageContext.request.contextPath}/resources/external/jquery/jquery-1.11.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/resources/external/bs/js/bootstrap.js"></script>
    <script src="${pageContext.request.contextPath}/resources/external/jquery/jquery-ui.js"></script>

    <script type="text/javascript"
            src="https://maps.googleapis.com/maps/api/js?v=3.8&libraries=geometry,visualization&sensor=false"></script>
    <script src="${pageContext.request.contextPath}/resources/custom/map_styles.js"></script>
    <script src="${pageContext.request.contextPath}/resources/custom/map.js"></script>

As well as injections of the rest of the components:

<c:set var="parser" value="parse.jsp"/>
<c:set var="navigation" value="navigation.jsp"/>
<c:set var="map" value="map.jsp"/>
<c:set var="styles" value="styles.jsp"/>
<c:set var="modes" value="modes.jsp"/>
<c:set var="filters" value="filters.jsp"/>

<jsp:include page="${parser}"></jsp:include>
<jsp:include page="${navigation}"></jsp:include>
<jsp:include page="${map}"></jsp:include>
<jsp:include page="${styles}"></jsp:include>
<jsp:include page="${modes}"></jsp:include>
<jsp:include page="${filters}"></jsp:include>

Note: comments to the relevant scripts will be included in the code

Note: what has been documented here is a temporary configuration and this post will be updated as the project hierarchy changes.