Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update JS libraries #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions static/css/admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.table-striped > tbody > tr:nth-of-type(odd) {
background-color: rgba(255, 255, 255, 0.15);
}

.table-hover > tbody > tr:hover {
background-color: rgba(255, 255, 255, 0.25);
}

table.sortable th:not(.sorttable_sorted):not(.sorttable_sorted_reverse):not(.sorttable_nosort):after {
content: " \25B4\25BE"
}

.swal-success > .swal-footer > .swal-button-container > .swal-button--confirm {
background-color: #18BC9C;
}

.swal-error > .swal-footer > .swal-button-container > .swal-button--confirm {
background-color: #E74C3C;
}

canvas {
max-width: 500px;
max-height: 500px;
}
124 changes: 88 additions & 36 deletions static/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,26 +78,39 @@ const promoteFromWaitlist = (id) => {
swal({
title: 'Promote hacker ' + id + ' off the waitlist?',
text: 'Are you sure you wish to promote this hacker off the waitlist?',
type: 'info',
showCancelButton: true,
closeOnConfirm: false,
confirmButtonText: 'Yes, promote!',
confirmButtonColor: successColor
icon: 'info',
buttons: {
cancel: {
text: 'Cancel',
value: null,
visible: true,
className: '',
closeModal: true
},
confirm: {
text: 'Yes, promote!',
value: true,
visible: true,
className: '',
closeModal: false
}
},
className: 'swal-success'
}, () => {
$.get('/promote_from_waitlist?mlh_id=' + id, (data) => {
let title = ''
let msg = ''
let type = ''
let icon = ''
if (data.status === 'success') {
title = 'Promoted!'
msg = 'The hacker was successfully promoted off the waitlist!'
type = 'success'
icon = 'success'
} else {
title = 'Error!'
msg = JSON.stringify(data)
type = 'error'
icon = 'error'
}
swal(title, msg, type)
swal(title, msg, icon)
})
})
}
Expand All @@ -106,26 +119,39 @@ const changeAdmin = (id, action) => {
swal({
title: 'Modify:' + action + ' admin prviliges on hacker ' + id + ' ?',
text: 'Are you sure you wish to modify:' + action + ' this hacker\'s administrative privileges?',
type: 'warning',
showCancelButton: true,
closeOnConfirm: false,
confirmButtonText: 'Yes, ' + action + '!',
confirmButtonColor: errColor
icon: 'warning',
buttons: {
cancel: {
text: 'Cancel',
value: null,
visible: true,
className: '',
closeModal: true
},
confirm: {
text: 'Yes, ' + action + '!',
value: true,
visible: true,
className: '',
closeModal: false
}
},
className: 'swal-error'
}, () => {
$.get('/change_admin?mlh_id=' + id + '&action=' + action, (data) => {
let title = ''
let msg = ''
let type = ''
let icon = ''
if (data.status === 'success') {
title = 'Modified!'
msg = 'The hacker\'s administrative privileges have been modified:' + action + '!'
type = 'success'
icon = 'success'
} else {
title = 'Error!'
msg = JSON.stringify(data)
type = 'error'
icon = 'error'
}
swal({title: title, msg: msg, type: type}, () => window.location.reload(true))
swal({title: title, msg: msg, icon: icon}, () => window.location.reload(true))
})
})
}
Expand All @@ -134,26 +160,39 @@ const drop = (id) => {
swal({
title: 'Drop hacker ' + id + ' ?',
text: 'Are you sure you wish to drop this hacker\'s application?',
type: 'warning',
showCancelButton: true,
closeOnConfirm: false,
confirmButtonText: 'Yes, drop!',
confirmButtonColor: errColor
icon: 'warning',
buttons: {
cancel: {
text: 'Cancel',
value: null,
visible: true,
className: '',
closeModal: true
},
confirm: {
text: 'Yes, drop!',
value: true,
visible: true,
className: '',
closeModal: false
}
},
className: 'swal-error'
}, () => {
$.get('/drop?mlh_id=' + id, (data) => {
let title = ''
let msg = ''
let type = ''
let icon = ''
if (data.status === 'success') {
title = 'Dropped!'
msg = 'The hacker\'s application was successfully dropped!'
type = 'success'
icon = 'success'
} else {
title = 'Error!'
msg = JSON.stringify(data)
type = 'error'
icon = 'error'
}
swal(title, msg, type)
swal(title, msg, icon)
})
})
}
Expand All @@ -162,31 +201,44 @@ const checkIn = (id) => {
swal({
title: 'Check in hacker ' + id + ' ?',
text: 'Are you sure you wish to check in this hacker?',
type: 'info',
showCancelButton: true,
closeOnConfirm: false,
confirmButtonText: 'Yes, check in!',
confirmButtonColor: successColor
icon: 'info',
buttons: {
cancel: {
text: 'Cancel',
value: null,
visible: true,
className: '',
closeModal: true
},
confirm: {
text: 'Yes, check in!',
value: true,
visible: true,
className: '',
closeModal: false
}
},
className: 'swal-success'
}, () => {
$.get('/check_in?mlh_id=' + id, (data) => {
let title = ''
let msg = ''
let type = ''
let icon = ''
if (data.status === 'success') {
title = 'Checked in!'
msg = 'The hacker was checked in!'
type = 'success'
icon = 'success'
} else {
title = 'Error!'
msg = JSON.stringify(data)
type = 'error'
icon = 'error'
}

if (data.status === 'success' && data.action === 'check_in' && data.minor === true) {
msg += '\nATTENTION:\nHacker is a minor, please ensure they have the minor consent form!'
}

swal(title, msg, type)
swal(title, msg, icon)
})
})
}
38 changes: 14 additions & 24 deletions templates/admin.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
{% include 'header.html' %}

<script src="http://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>
<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.4.3.js"></script>
<script src="https://cdn.rawgit.com/t4t5/sweetalert/master/dist/sweetalert.min.js"></script>
<script src="https://kryogenix.org/code/browser/sorttable/sorttable.js"></script>
<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.20.2.min.js"
integrity="sha384-m+y1syHTuL0p+gUbJ6qkxdRVTkr2aXaEqmFf1MLBfD3AssHBiZY5reAy2PnP7ETY"
crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]/dist/sweetalert.min.js"
integrity="sha384-UQsTmaPFDZmoSs+C5muZerOkn3H9/UibH1bDNhuzxtDQNJ7bEKJtW7swm78LgNCh"
crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.rawgit.com/t4t5/sweetalert/master/dist/sweetalert.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.3/js/tether.min.js"
integrity="sha384-IRaPTw2/3gQVao8Rds9eeUdm8XD/9kc0n8hJhyosvPPwukPkO0Hz+3y4DmZ2Rp6t"
crossorigin="anonymous"></script>
<script src="../static/js/admin.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>

<style>
.table-striped > tbody > tr:nth-of-type(odd) {
background-color: rgba(255, 255, 255, 0.15);
}

.table-hover > tbody > tr:hover {
background-color: rgba(255, 255, 255, 0.25);
}

table.sortable th:not(.sorttable_sorted):not(.sorttable_sorted_reverse):not(.sorttable_nosort):after {
content: " \25B4\25BE"
}

canvas {
max-width: 500px;
max-height: 500px;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.min.js"
integrity="sha256-CfcERD4Ov4+lKbWbYqXD6aFM9M51gN4GUEtDhkWABMo="
crossorigin="anonymous"></script>
<link rel="stylesheet" href="../static/css/admin.css">

<div class="contact-section" style="height: auto; background-repeat: repeat; background-size: contain;">
<div class="container-fluid" style="margin-left: 3%; margin-right: 3%;">
Expand Down
36 changes: 25 additions & 11 deletions templates/dashboard.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% include 'header.html' %}
<script src="https://cdn.rawgit.com/t4t5/sweetalert/master/dist/sweetalert.min.js"></script>
<link rel="stylesheet" href="https://cdn.rawgit.com/t4t5/sweetalert/master/dist/sweetalert.css">
<script src="https://unpkg.com/[email protected]/dist/sweetalert.min.js"
integrity="sha384-UQsTmaPFDZmoSs+C5muZerOkn3H9/UibH1bDNhuzxtDQNJ7bEKJtW7swm78LgNCh"
crossorigin="anonymous"></script>

<div class="contact-section" style="height: 100%;">
<div class="container">
Expand Down Expand Up @@ -42,30 +43,43 @@ <h2>Here are your available actions... </h2>
swal({
title: 'Drop your application?',
text: 'Are you sure you wish to drop your application? This cannot be undone.',
type: 'warning',
showCancelButton: true,
closeOnConfirm: false,
confirmButtonText: 'Yes, drop!',
confirmButtonColor: errColor
icon: 'warning',
buttons: {
cancel: {
text: 'Cancel',
value: null,
visible: true,
className: '',
closeModal: true
},
confirm: {
text: 'Yes, drop!',
value: true,
visible: true,
className: '',
closeModal: false
}
},
className: 'swal-error'
}, () = > {
$.get('/drop?mlh_id=' + id, (data) = > {
let title = ''
let msg = ''
let type = ''
let icon = ''
if (data.status === 'success'
)
{
title = 'Dropped!'
msg = 'Your application was successfully dropped!'
type = 'success'
icon = 'success'
}
else
{
title = 'Error!'
msg = JSON.stringify(data)
type = 'error'
icon = 'error'
}
swal(title, msg, type)
swal(title, msg, icon)
if (data.status === 'success') {
setTimeout(() = > {window.location = '/'
},
Expand Down
12 changes: 11 additions & 1 deletion templates/footer.html
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><script src="../static/js/jquery.easing.min.js"></script><script src="../static/js/scrolling-nav.js"></script></body></html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"
integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"
integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm"
crossorigin="anonymous"></script>
<script src="../static/js/jquery.easing.min.js"></script>
<script src="../static/js/scrolling-nav.js"></script>
</body>

</html>
Loading