nus-mtp/cs-modify

View on GitHub
templates/moduleListing.html

Summary

Maintainability
Test Coverage
$def with (moduleInfos) 

$var title:Module Information
$ home = ['/', 'Home']
$ moduleInfo = ['#', 'Module Information']
$var hierarchy = [home, moduleInfo]

<script type="text/javascript" src="static/javascripts/moduleListing.js"></script>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <h1 class="text-center"><b>Module Information</b></h1>
            <p class="text-center">Shows <b>all modules</b> that exist in the system.</p>
            <br>
            <div class="row" id="options">
                <div class="col-md-12 text-center">
                    <form action="/moduleMountingFixed" method="post">
                        <input class="btn btn-primary" type="submit" value="Go To Module Mountings for Current AY" data-toggle="tooltip" data-placement="bottom" title="See fixed module mountings for current AY">
                    </form>
                    <form action="/moduleMountingTentative" method="post">
                        <input class="btn btn-primary" type="submit" value="Go To Module Mountings for Other AYs" data-toggle="tooltip" data-placement="bottom" title="See tentative module mountings for other AYs">
                    </form>
                </div>
            </div>
            <br>
            <button id="toggleButton" style="float: right;" class="btn btn-info" onclick="toggleFilters()" 
                data-toggle="tooltip" data-placement="left" title="Toggle filters">
                Advanced Search &nbsp; <span id="chevron" class="glyphicon glyphicon-chevron-down"></span>
            </button>
            <br>
            <br>
            <br>
            <table class="table table-bordered table-hover display dataTable" id="module-listing-table">
                <thead>
                    <tr>
                        <th>Code
                            <br><input hidden type="text" class="filter" placeholder="Code" size="10"></th>
                        <th>Name
                            <br><input hidden type="text" class="filter" placeholder="Name" size="10"></th>
                        <th>Description
                            <br><input style="width:100%" hidden type="text" class="filter" placeholder="Description"></th>
                        <th>MCs
                            <br><input hidden type="text" class="filter" placeholder="MCs" size="3"></th>
                        <th>Focus Area
                            <br><input hidden type="text" class="filter" placeholder="Focus Area" size="10"></th>
                        <th>Is New Module?
                            <br><input hidden type="text" class="filter" placeholder="Is New?" size="3"></th>
                    </tr>
                </thead>
                <tbody>
                $for moduleInfo in moduleInfos:
                    $ moduleCode = moduleInfo[0]
                    $ moduleName = moduleInfo[1]
                    $ moduleDesc = moduleInfo[2] 
                    $ moduleMc = moduleInfo[3]
                    $ moduleStatus = moduleInfo[4]
                    $ moduleFocus = moduleInfo[5]
                    <tr>
                        <td class="text-center">
                            <a href="/viewModule?code=$moduleCode" target="_blank" data-toggle="tooltip" title="View general info for $moduleCode">$moduleCode</a>
                        </td>
                        <td>$moduleName</td>
                        <td>$moduleDesc</td>
                        <td class="text-center">$moduleMc</td>
                        $if not moduleFocus:
                            <td class="text-center">-</td>
                        $else:
                            <td class="text-center">$moduleFocus</td>
                        $if moduleStatus[0:3] == 'New':
                            <td class="text-center">Yes</td>
                        $else:
                            <td class="text-center">No</td>
                    </tr>
                </tbody>
            </table>
            <br>
            <br>
        </div>
    </div>
</div>