nus-mtp/cs-modify

View on GitHub
templates/mountingEdit.html

Summary

Maintainability
Test Coverage
$def with (moduleCode, aySem, mountingValue, quota)

$ title_string = 'Editing ' + moduleCode + ' for ' + aySem

$var title:$title_string
$ home = ['/', 'Home']
$ moduleInfo = ['/modules', 'Module Information']
$ viewModule = ['/viewModule?code=' + moduleCode, moduleCode]
$ individualModuleInfo = ['/individualModuleInfo?code=' + moduleCode + '&aysem=' + aySem, 'Module Info for ' + aySem]
$ editIndividualModule = ['#', title_string]
$var hierarchy = [home, moduleInfo, viewModule, individualModuleInfo, editIndividualModule]

<body>
    <div class="container-block container">
        <div class="row red">
            <div class="col-md-12">
                <div class="row">
                    <h1 class="title text-center">Edit <b>$moduleCode</b> For <b>$aySem</b></h1>
                    <!--mounting information-->
                    <form id="edit-mounting-form" name="edit-mounting-form" action="/editMounting" method="post">

                        <label for="module-code">Module Code:</label>
                        <p id="module-code">$moduleCode</p>
                        <br>
                        <div class="form-group">
                            <!--mounting status-->
                            <label>Mounting Status:</label><br>
                            $if mountingValue == 1:
                                <input type="radio" onclick="document.getElementById('quota').disabled = false;" name="mountingStatus" value="Mounted" checked="checked"> Mounted<br>
                                <input type="radio" onclick="document.getElementById('quota').disabled = true;" name="mountingStatus" value="Not Mounted"> Not Mounted
                            $else:
                                <input type="radio" onclick="document.getElementById('quota').disabled = false;" name="mountingStatus" value="Mounted"> Mounted<br>
                                <input type="radio" onclick="document.getElementById('quota').disabled = true;" name="mountingStatus" value="Not Mounted" checked="checked"> Not Mounted
                            <br>
                        </div>
                        <div class="form-group">
                            <label for="class-quota">Class Quota</label>
                            $if mountingValue == 1:
                                <input class="form-control" id="quota" type="number" min="0" max="999" size="10" name="quota" value="$quota">
                            $else:
                                <input class="form-control" id="quota" type="number" min="0" size="10" name="quota" value="$quota" disabled>
                            <br>
                        </div>
                        <br>
                        <input type="hidden" name="code" value="$moduleCode" required>
                        <input type="hidden" name="aysem" value="$aySem" required>
                        <button type="button" class="btn btn-primary" onclick="if(!confirm('Are you sure you want to cancel editing?')){event.preventDefault();}else{window.location='/individualModuleInfo?code=$moduleCode&aysem=$aySem';}">Cancel</button>
                        <input class="btn btn-primary" type="submit" value="Submit" />&nbsp;
                    </form>
                </div>
            </div>
        </div>
    </div>

</body>