templates/moduleEdit.html
$def with (moduleInfo, preclusions, prerequisites)
$ moduleCode = moduleInfo[0]
$ moduleName = moduleInfo[1]
$ moduleDescription = moduleInfo[2]
$ moduleMC = moduleInfo[3]
$ title_string = 'Editing ' + moduleCode
$var title:$title_string
$ home = ['/', 'Home']
$ moduleInformation = ['/modules', 'Module Information']
$ viewModule = ['/viewModule?code=' + moduleCode, moduleCode]
$ editModule = ['#', 'Edit: ' + moduleCode]
$var hierarchy = [home, moduleInformation, viewModule, editModule]
<body>
<div class="container-block container">
<div class="row red">
<div class="col-md-12">
<h1 class="title text-center">Edit <b>General Information</b> For <b>$moduleCode</b></h1>
<div class="row">
<!--module information-->
<form id="edit-module-form" name="edit-module-form" action="/editModule" method="post">
<input type="hidden" name="code" value="$moduleInfo[0]" required>
<div class="form-group">
<label for="module-name">Module Name:</label>
<input type="text" name="name" value="$moduleName" class="form-control" id="module-name" pattern="[a-zA-Z0-9\s]+" title="Module name should be alphanumeric." required>
</div>
<div class="form-group">
<label for="no-mc">Number of MCs</label>
<input type="number" min="0" max="12" size="10" name="mc" value="$moduleMC" class="form-control" id="no-mc" placeholder="no. MCs" required>
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea type="text" name="desc" class="form-control" rows="6" id="description" placeholder="description">$:moduleDescription</textarea>
</div>
<div class="form-group">
<label for="preclusion">Preclusion</label>
<br>
$if preclusions == "":
<p id="preclusion-display">Nil</p>
$else:
<p id="preclusion-display">$:preclusions</p>
<a class="btn btn-primary" id="edit-preclusion" href="/editModulePreclusions?code=$moduleCode" target="_blank">Edit Preclusions</a>
<br>
<br>
</div>
<div class="form-group">
<label for="prerequisite"> Prerequisite</label>
$if prerequisites is "":
<p id="prereq-display">Nil</p>
$else:
<p id="prereq-display">$:prerequisites</p>
<a class="btn btn-primary" id="edit-prerequisite" href="/editModulePrerequisites?code=$moduleCode" target="_blank">Edit Prerequisites</a>
<br>
<br>
</div>
<br>
<button type="button" class="btn btn-primary" onclick="if(!confirm('Are you sure you want to cancel editing?')){event.preventDefault();}else{window.location='/viewModule?code=$moduleInfo[0]';}">Cancel</button>
<input class="btn btn-primary" type="submit" value="Submit">
</form>
</div>
<br>
<hr>
</div>
</div>
</div>
</body>