Skip to content

Commit

Permalink
Merge pull request #54 from Frankanator8/main
Browse files Browse the repository at this point in the history
finalized presentations tab
  • Loading branch information
DanielDavis05 authored Oct 18, 2023
2 parents a5f3358 + c127347 commit 578dc47
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 7 deletions.
17 changes: 11 additions & 6 deletions presentations/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
<!-- Load external JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>

<!-- Load in page specific scripts -->
<script src="/scripts/presentations/presentations.js"></script>
</head>

<body>
Expand All @@ -40,7 +38,7 @@
</header>
<section id="signupDialog" class="modal-background">
<section class="box">
<h1>Sign up to present</h1>
<h1 id="modal-title">Sign up to present</h1>

<label for="dateSelect">Choose a day:</label>
<select name="date" id="dateSelect">
Expand All @@ -50,6 +48,8 @@ <h1>Sign up to present</h1>
<select name="time" id="timeSelect">
<option value="1">1</option>
<option value="2">2</option>
<option value="1+2">Both</option>

</select>
<br><br><br>
<label for="topic">Topic:</label>
Expand All @@ -61,15 +61,14 @@ <h1>Sign up to present</h1>
<p>Make sure the presentation is ONLY viewable (no editing)! When creating the link, check that "Anybody with the link can view" is on.</p>
<br>
<h2>Override Password</h2>
<p>Make/submit an override password for your presentation. <u>Make sure it is not another password you use, there is absolutely no encryption of these.</u> This override password will be used such that nobody else can claim this spot, and if you need to edit your sign up, you can input your override password here again to edit it. Note, there is a global override password for club leaders. </p>
<p id="overrideText"> This override password will be used such that nobody else can claim this spot, and if you need to edit your sign up, you can input your override password here again to edit it. Note, there is a global override password for club leaders. </p>
<br>
<label for="pw">Password:</label>
<input type="text" id="pw" name="pw"><br><br>
<button>Submit</button>
<button id="submit" onclick="register()">Submit</button>
<button class="color-mod" onclick="destroySignup()">Cancel</button>



</section>
</section>

Expand Down Expand Up @@ -97,7 +96,13 @@ <h2 class="pres-typ">Past</h2>

</section>

</body>


<!-- Load in page specific scripts -->
<script src="/scripts/presentations/presentations.js"></script>

</body>
<!-- Load in page specific scripts -->
<script src="/scripts/presentations/presentations.js"></script>
</html>
78 changes: 77 additions & 1 deletion scripts/presentations/presentations.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,80 @@ function makeSignup() {
function destroySignup() {
var backgr = document.getElementById("signupDialog");
backgr.style.display="none"
};
};

function check() {
$.ajax({
type: "GET",
url: link + "status",
data: {

"day":$("#dateSelect").val(),
"time":$("#timeSelect").val()
},
async: false,
success: function(meetingData) {
if (meetingData) {
document.getElementById("overrideText").innerHTML = `
Make an override password for your presentation. <u>Make sure it is not another password you use, there is absolutely no encryption of these.</u> Make sure to remember this, you'll need it to edit.
`;
document.getElementById("submit").innerHTML = "Sign up"
document.getElementById("modal-title").innerHTML = "Sign up to present"
} else {
document.getElementById("overrideText").innerHTML = "Input your override password or the global admin password.";
document.getElementById("submit").innerHTML = "Edit"
document.getElementById("modal-title").innerHTML = "Edit presentation"
}
}
});
};

$(function(ready){
$('#dateSelect').change(function(){
check();
});
});
window.onload = check

$(function(ready){

$('#timeSelect').change(function(){
check();
});
});

function register() {
document.getElementById("submit").innerHTML = "...";
document.getElementById("submit").disabled = true;
if ($("#topic").val() === "" || $("#presenters").val() === "" || $("#link").val() === "" || $("#pw").val() === "") {
document.getElementById("submit").disabled = false;
document.getElementById("submit").innerHTML = "Fill all fields";
} else {
$.ajax({
type: "POST",
url: link + "register",
data: {
"day":$("#dateSelect").val(),
"time":$("#timeSelect").val(),
"topic":$("#topic").val(),
"presenters":$("#presenters").val(),
"link":$("#link").val(),
"pw":$("#pw").val(),
},
headers: {},
async: false,
mode: 'cors',
success: function(res) {
document.getElementById("submit").innerHTML = res
if (res == "Success") {
setTimeout(function(){
location.reload();
}, 2000); // 3000 milliseconds = 2 seconds
} else {
document.getElementById("submit").disabled = false;
}
}
});
}

}

0 comments on commit 578dc47

Please sign in to comment.