First Commit

This commit is contained in:
SowinskiBraeden committed 2020-11-25 09:10:06 -08:00
commit 601e886c14
2123 files changed
+334815

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
<% if (user.role == "Teacher") { %>
<% include teacherDashboard %>
<% } %>
<% if (user.role == "Student") { %>
<% include studentDashboard %>
<% } %>
+33
View File
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link
rel="stylesheet"
href="https://bootswatch.com/4/journal/bootstrap.min.css"
/>
<title>XP-System Mock</title>
</head>
<body>
<div class="container"><%- body %></div>
<script
src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"
integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut"
crossorigin="anonymous"
></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"
integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k"
crossorigin="anonymous"
></script>
</body>
</html>
+34
View File
@@ -0,0 +1,34 @@
<div class="row mt-5">
<div class="col-md-6 m-auto">
<div class="card card-body">
<h1 class="text-center mb-3"><i class="fas fa-sign-in-alt"></i> Login</h1>
<% include ./partials/messages %>
<form action="/users/login" method="POST">
<div class="form-group">
<label for="email">Email</label>
<input
type="email"
id="email"
name="email"
class="form-control"
placeholder="Enter Email"
/>
</div>
<div class="form-group">
<label for="password">Password</label>
<input
type="password"
id="password"
name="password"
class="form-control"
placeholder="Enter Password"
/>
</div>
<button type="submit" class="btn btn-primary btn-block">Login</button>
</form>
<p class="lead mt-4">
No Account? <a href="/users/register">Register</a>
</p>
</div>
</div>
</div>
+29
View File
@@ -0,0 +1,29 @@
<% if(typeof errors != 'undefined'){ %> <% errors.forEach(function(error) { %>
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<%= error.msg %>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<% }); %> <% } %> <% if(success_msg != ''){ %>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<%= success_msg %>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<% } %> <% if(error_msg != ''){ %>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<%= error_msg %>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<% } %> <% if(error != ''){ %>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<%= error %>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<% } %>
+60
View File
@@ -0,0 +1,60 @@
<div class="row mt-5">
<div class="col-md-6 m-auto">
<div class="card card-body">
<h1 class="text-center mb-3">
<i class="fas fa-user-plus"></i> Register
</h1>
<% include ./partials/messages %>
<form action="/users/register" method="POST">
<div class="form-group">
<label for="name">Name</label>
<input
type="name"
id="name"
name="name"
class="form-control"
placeholder="Enter Name"
value="<%= typeof name != 'undefined' ? name : '' %>"
/>
</div>
<div class="form-group">
<label for="email">Email</label>
<input
type="email"
id="email"
name="email"
class="form-control"
placeholder="Enter Email"
value="<%= typeof email != 'undefined' ? email : '' %>"
/>
</div>
<div class="form-group">
<label for="password">Password</label>
<input
type="password"
id="password"
name="password"
class="form-control"
placeholder="Create Password"
value="<%= typeof password != 'undefined' ? password : '' %>"
/>
</div>
<div class="form-group">
<label for="password2">Confirm Password</label>
<input
type="password"
id="password2"
name="password2"
class="form-control"
placeholder="Confirm Password"
value="<%= typeof password2 != 'undefined' ? password2 : '' %>"
/>
</div>
<button type="submit" class="btn btn-primary btn-block">
Register
</button>
</form>
<p class="lead mt-4">Have An Account? <a href="/users/login">Login</a></p>
</div>
</div>
</div>
+95
View File
@@ -0,0 +1,95 @@
<style>
#myProgress {
width: 100%;
background-color: #ddd;
}
#myBar {
width: 1%;
height: 30px;
background-color: #46c7f2;
}
</style>
<h1 class="mt-4">Student Dashboard</h1>
<p class="lead mb-3">Welcome <%= user.name %></p>
<br>
<div>
<h1 id='userRank'></h1>
<h1>XP: <%= user.xp %></h1>
<p id='XP-Till'></p>
</div>
<br>
<div>
</div>
<div>
<p stlye='text-align: right;' id='percent'></p>
<div id="myProgress">
<div id="myBar"></div>
</div>
</div>
<br>
<a href="/users/logout" class="btn btn-secondary">Logout</a>
<script>
let xp = <%= user.xp %>;
let currRank;
let rankUp;
let remain;
let ranks = [
{"Digital Noob": 0}, // index 0
{"Digital Novice": 48}, // index 1
{"Digital Novice II": 100}, // index 2
{"Digital Amature": 148}, // index 3
{"Digital Amature II": 200}, // index 4
{"Digital Apprentice": 248}, // index 5
{"Digital Apprentice II": 300}, // index 6
{"Digital Journeyman": 396}, // index 7
{"Digital Journeyman II": 476}, // index 8
{"Digital Journeyman III": 532}, // index 9
{"Digital Crafter": 580}, // index 10
{"Expert Digital Crafter": 648}, // index 11
{"Master Digital Crafter": 800} // index 12
]
// Get current rank
let indexes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12]
if (xp < 800) {
for(var i = 0; i < ranks.length; i++) {
for (let rank in ranks[i]) {
let nextIndex = indexes[i];
for (let nextRank in ranks[nextIndex]) {
if (xp >= ranks[i][rank] && xp < ranks[nextIndex][nextRank]) {
currRank = rank;
currRankXP = ranks[i][rank]
// Calculate xp till next Rank
if (i < 12) {
i++;
let nextRank = ranks[i];
for (let r in nextRank) {
let goal = nextRank[r];
rankUp = r;
remain = goal - xp;
// Calculate progress bar
let total = goal - currRankXP;
let progress = xp - currRankXP;
let percent = (progress/total)*100;
let elem = document.getElementById("myBar");
elem.style.width = percent + '%';
document.getElementById('percent').innerHTML = progress + '|' + total;
}
}
}
}
}
}
} else {
currRank = "Master Digital Crafter";
remain = 0;
rankUp = 'No higher Rank, Good Job!';
}
//Show Data
document.getElementById('userRank').innerHTML = currRank;
document.getElementById('XP-Till').innerHTML = remain + 'XP till your next Rank: ' + rankUp;
</script>
+119
View File
@@ -0,0 +1,119 @@
<style>
.members {
width: 230px;
}
h2 {
font: 350 35px/1.5 Helvetica, Verdana, sans-serif;
margin: 0;
padding: 0;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
li {
font: 200 20px/1.5 Helvetica, Verdana, sans-serif;
border-bottom: 1px solid #ccc;
}
li:last-child {
border: none;
}
li a {
text-decoration: none;
color: #000;
display: block;
width: 200px;
-webkit-transition: font-size 0.3s ease, background-color 0.3s ease;
-moz-transition: font-size 0.3s ease, background-color 0.3s ease;
-o-transition: font-size 0.3s ease, background-color 0.3s ease;
-ms-transition: font-size 0.3s ease, background-color 0.3s ease;
transition: font-size 0.3s ease, background-color 0.3s ease;
}
li a:hover {
font-size: 30px;
background: #f6f6f6;
}
</style>
<h1 class="mt-4">Teacher Dashboard</h1>
<p class="lead mb-3">Welcome <%= user.name %></p>
<br>
<a href="/users/logout" class="btn btn-secondary">Logout</a>
<br>
<h2>Site Members</h2>
<div class='members'>
<ul>
<% members.forEach(function (member) { %>
<li><button class='btn btn-link mt-2' onclick='openProfile("<%= member.id %>")'><%= member.name %></button></li>
<div style='display: none;' data-role='page' id='<%= member._id %>'>
<p class="lead mb-3"><%= member.name %></p>
<p class='lead mb-3'><%= member.email %></p>
<br>
<div>
<p id='userRank'></p>
<p>XP: <%= member.xp %></p>
<p><%= member.role %></p>
</div>
<br>
<script>
let xp = <%= member.xp %>;
let currRank;
let ranks = [
{"Digital Noob": 0}, // index 0
{"Digital Novice": 48}, // index 1
{"Digital Novice II": 100}, // index 2
{"Digital Amature": 148}, // index 3
{"Digital Amature II": 200}, // index 4
{"Digital Apprentice": 248}, // index 5
{"Digital Apprentice II": 300}, // index 6
{"Digital Journeyman": 396}, // index 7
{"Digital Journeyman II": 476}, // index 8
{"Digital Journeyman III": 532}, // index 9
{"Digital Crafter": 580}, // index 10
{"Expert Digital Crafter": 648}, // index 11
{"Master Digital Crafter": 800} // index 12
]
// Get current rank
let indexes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12]
if (xp < 800) {
for(var i = 0; i < ranks.length; i++) {
for (let rank in ranks[i]) {
let nextIndex = indexes[i];
for (let nextRank in ranks[nextIndex]) {
if (xp >= ranks[i][rank] && xp < ranks[nextIndex][nextRank]) {
currRank = rank;
}
}
}
}
} else {
currRank = "Master Digital Crafter";
}
//Show Data
document.getElementById('userRank').innerHTML = currRank;
</script>
</div>
<% }) %>
</ul>
</div>
<script>
function openProfile(id) {
let state = document.getElementById(id).style.display;
if (state == "block") {
document.getElementById(id).style.display = 'none';
} else {
document.getElementById(id).style.display = 'block';
}
}
</script>
+12
View File
@@ -0,0 +1,12 @@
<div class="row mt-5">
<div class="col-md-6 m-auto">
<div class="card card-body text-center">
<h1><i class="fab fa-node-js fa-3x"></i></h1>
<p>Create an account or login</p>
<a href="/users/register" class="btn btn-primary btn-block mb-2"
>Register</a
>
<a href="/users/login" class="btn btn-secondary btn-block">Login</a>
</div>
</div>
</div>