forked from dh20199/assignment-00-git-and-github-morganmedea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
92 lines (73 loc) · 2.94 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Students</title>
<!-- external resources -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js" crossorigin="anonymous"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script> -->
<!-- steal some base styles from chota: https://jenil.github.io/chota/ -->
<link rel="stylesheet" href="https://unpkg.com/chota@latest">
<!-- customize in this file -->
<link rel="stylesheet" href="style.css">
<style>
</style>
<script type-"text/javascript" src="utils/allstudents.js"></script>
</head>
<body>
<nav class="bg-primary">
<div class="nav-center">
<h1><a class="brand" href="#">His393 Class Roster, 2017</a></h1>
</div>
</nav>
<main id="cardcontainer">
</main>
<div id="studentlist">
<table>
<tbody></tbody>
</table>
</div>
<script type="text/javascript">
let students = [];
$(function() {
$.each(studentsArray, function(i, s) {
var tblRow = `<tr>
<td>${(s.firstName) ? s.firstName : ''}</td>
<td>${(s.lastName) ? s.lastName : ''}</td>
<td>${s.nickName}</td>
<td><a href="mailto:${s.email}">${s.email}</a></td>
<td><a href="https://github.com/${s.github}">${s.github}</a></td>
</tr>`;
//$(tblRow).appendTo("main#cardcontainer");
students.push(s);
let nickString = ( s.nickName ) ? `"${s.nickName}"` : '',
spString = (s.superpower ) ? s.superpower : '',
aiString = (s.academicinterests ) ? s.academicinterests : '',
imageUrl = (s.picture) ? s.picture : "http://lorempixel.com/400/400/nature/",
imageAlt = (s.picture) ? "Image of " + (s.nickName || s.firstName || "student") : "Oops! no picture found." ;
console.log("nick is " + nickString);
let card = `
<section class="card" >
<header class="card-header">
${(s.nickName) ? s.nickName : s.firstName}
</header>
<img class="profile-image" src="${imageUrl}" alt="${imageAlt}" title="${imageAlt}">
<section class="card-body">
<h4 class="card-title">${(s.firstName) ? s.firstName : nickString} ${(s.lastName) ? s.lastName : ''}</h4>
<p class="card-text"><b>Powers:</b> ${s.superpower}</p>
<p class="card-text"><b>Academic Interests:</b> ${s.academicinterests}</p>
</section> <!-- card-body -->
<footer class="card-footer text-center">
<a href="https://github.com/${s.github}" class="button">Github</a>
<a href="mailto:${s.email}" class="button">Email</a>
</footer> <!-- card-footer -->
</section> <!-- card -->
</div>
`;
$(card).appendTo("#cardcontainer");
console.log(s);
});
});
</script>
</body>
</html>