Commit 705d3c9c authored by Ådne Karstad's avatar Ådne Karstad

feat(T2M): Add styling to tables

parent 0e20f038
......@@ -2,51 +2,26 @@
[module studyplan2TextGenerator('platform:/plugin/tdt4250.spp.model/model/spp.ecore', 'http://www.eclipse.org/emf/2002/Ecore')]
[template public studyplan2TextGenerator(uni : University)]
[template public studyplan2TextGenerator(university : University)]
[comment @main/]
[file (uni.name.concat('.html'), false, 'UTF-8')]
[file (university.name.concat('.html'), false, 'UTF-8')]
<html>
<head>
<title>[uni.name/]</title>
<title>[university.name/]</title>
<meta charset="utf-8"/>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>[uni.name/]</h1>
<h1>[university.name/]</h1>
<label for="programs">Choose program:</label>
<select name="programs" id="programs">
[for (program : Program | uni.programs)]
<option value="[nameToId(program.name)/]">[program.name/]</option>
[/for]
</select>
[generateProgramSelection(university)/]
[for (program : Program | uni.programs)]
<div id="[nameToId(program.name)/]" class="spp-table">
<h2>[program.name/]</h2
<p>[program.name/] is taken over [program.numberOfSemesters/] semesters.</p>
[for (semester : Semester | program.semesters)]
<h3>Semester [semester.semester/]</h3>
<table style="width=80%">
[for (course : Course | semester.selectedCourses)]
<tr>
<th>[course.code/]</th>
<th>[course.name/]</th>
<th>[course.credits/]</th>
<th>[course.level/]</th>
</tr>
[/for]
</table>
[/for]
</div>
[/for]
[for (program : Program | university.programs)]
[generateStudyPlans(program)/]
[/for]
<script src="index.js"></script>
</body>
......@@ -58,3 +33,41 @@
[template public nameToId(name : String)]
[name.trim().toLower().replaceAll(' ', '-')/]
[/template]
[template public generateProgramSelection(university : University)]
<label for="programs">Choose program:</label>
<select name="programs" id="programs">
[for (program : Program | university.programs)]
<option value="[nameToId(program.name)/]">[program.name/]</option>
[/for]
</select>
[/template]
[template public generateStudyPlans(program : Program)]
<div id="[nameToId(program.name)/]" class="spp-table">
<h2>[program.name/]</h2
<p>[program.name/] is taken over [program.numberOfSemesters/] semesters.</p>
[for (semester : Semester | program.semesters)]
<h3>Semester [semester.semester/]</h3>
<table style="width=80%">
<tr>
<th>Code</th>
<th>Name</th>
<th>Credits</th>
<th>Level</th>
</tr>
[for (course : Course | semester.selectedCourses)]
<tr>
<td>[course.code/]</td>
<td>[course.name/]</td>
<td>[course.credits/]</td>
<td>[course.level/]</td>
</tr>
[/for]
</table>
[/for]
</div>
[/template]
......@@ -31,7 +31,8 @@
courses="//@institutes.0/@courses.1 //@institutes.0/@courses.2 //@institutes.0/@courses.6 //@institutes.1/@courses.3 //@institutes.1/@courses.4 //@institutes.1/@courses.5"/>
</programs>
<programs
name="Lektor i Realfag">
name="Lektor i Realfag"
duration="IntegratedMasters">
<semesters
selectedCourses="//@institutes.0/@courses.0 //@institutes.1/@courses.0 //@institutes.1/@courses.3 //@institutes.1/@courses.4"/>
<semesters
......
......@@ -9,3 +9,28 @@ body {
min-height: 100vh;
}
select {
margin-top: 16px;
padding: 16px;
}
table,
td,
th {
border: 1px solid #000;
border-collapse: collapse;
}
th,
td {
padding: 16px;
}
.spp-table tr:nth-child(odd) {
background-color: #aaaaaa;
}
.spp-table tr:first-child {
background-color: #4a8bf5;
}
......@@ -31,7 +31,8 @@
courses="//@institutes.0/@courses.1 //@institutes.0/@courses.2 //@institutes.0/@courses.6 //@institutes.1/@courses.3 //@institutes.1/@courses.4 //@institutes.1/@courses.5"/>
</programs>
<programs
name="Lektor i Realfag">
name="Lektor i Realfag"
duration="IntegratedMasters">
<semesters
selectedCourses="//@institutes.0/@courses.0 //@institutes.1/@courses.0 //@institutes.1/@courses.3 //@institutes.1/@courses.4"/>
<semesters
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment