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

added loading page and improved student_profile #100

Merged
merged 2 commits into from
Nov 22, 2023
Merged
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
14 changes: 13 additions & 1 deletion astros/static/astros/css/registration_style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
border-color: #333; /* ending color (same as starting color) */
}
}
#preloader {
background: #000 url('../images/cool_mars_gif.gif') no-repeat center center;
background-size: 15%;
height: 100vh;
width: 100vw;
position: fixed;
z-index:100;
}
#preloader.hide {
display: none;
}


.input-code {
/* Initial border setup */
Expand All @@ -21,7 +33,7 @@
body.body {
background-color: black !important;
color:white;
overflow: hidden; /*To hide Scroll Bar*/
overflow: visible; /*To hide Scroll Bar*/
}

.landing-container {
Expand Down
13 changes: 13 additions & 0 deletions astros/static/astros/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
src: url('../fonts/aileron-regular.otf') format('truetype');
/* Add additional src lines for other font formats if necessary */
}

#preloader {
background: #000 url('../images/loader.gif') no-repeat center center;
background-size: 15%;
height: 100vh;
width: 100vw;
position: fixed;
z-index:100;
}
#preloader.hide {
display: none;
}

body.body {
background-color: white !important;
color:black;
Expand Down
Binary file added astros/static/astros/images/cool_gif.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added astros/static/astros/images/cool_mars_gif.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added astros/static/astros/images/loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added astros/static/astros/images/preload_image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added astros/static/astros/images/preloader_gif.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion astros/static/astros/js/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
document.addEventListener('DOMContentLoaded',()=>{
const submitBtns = document.querySelectorAll('.submit-btn-register');
const forgotPLinks = document.querySelectorAll('.forgot-password-link');
const preloader = document.querySelector('#preloader');
if(forgotPLinks != null){
forgotPLinks.forEach((fp)=>{
const mformDiv = fp.closest('.main-form');
Expand Down Expand Up @@ -85,6 +86,7 @@ submitBtns.forEach((submitBtn)=>{
}

if(authenticationArea.classList.contains('closed')){
preloader.classList.remove('hide');
fetch('/authentification/generate_code', {
method: 'POST',
headers: { 'X-CSRFToken': getCookie('csrftoken') },
Expand All @@ -94,13 +96,14 @@ submitBtns.forEach((submitBtn)=>{
})
.then(response => response.json())
.then(result => {
preloader.classList.add('hide');
alert(result.message);
if(result.success){
authenticationArea.style.display='block';
authenticationArea.classList.remove('closed');
}
});
submitBtn.scrollIntoView({behavior: 'smooth'});
submitBtn.scrollIntoView({behavior: 'smooth'});
}else {
fetch('/authentification/validate_code', {
method: 'POST',
Expand Down
8 changes: 8 additions & 0 deletions astros/templates/astros/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<link rel="icon" href="{% static 'astros/images/mars.ico' %}" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<div id="preloader"></div>
<body class="body">
<ul class="navbar-nav mr-auto">
{% if user.is_authenticated %}
Expand Down Expand Up @@ -66,4 +67,11 @@
<script src="{% static 'phobos/js/sidebar.js' %}"></script>
{% block scripts %}{% endblock %}
</body>

<script>
var loader = document.querySelector('#preloader');
window.addEventListener('load', ()=>{
loader.classList.add('hide');
})
</script>
</html>
9 changes: 9 additions & 0 deletions astros/templates/astros/registration_layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@
<link rel="icon" href="{% static 'astros/images/mars.ico' %}" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body class="body">
<div id="preloader"></div>
<h2 style="color:white" id="dr-r" class="bs-overrides">Dr. R </h2>
{% block body %} {% endblock %}
{% block scripts %}{% endblock %}
</body>
<script>
var loader = document.querySelector('#preloader');
window.addEventListener('load', ()=>{
console.log('loaded');
loader.classList.add('hide');
})
</script>
</html>
2 changes: 1 addition & 1 deletion astros/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def course_enroll(request, course_id, code):
if not Enrollment.objects.filter(student=student, course=course).exists():
# Checking whether code is valid.
try:
enrollment_code = EnrollmentCode.objects.filter(course=course, code=code)
enrollment_code = EnrollmentCode.objects.get(course=course, code=code)
except EnrollmentCode.DoesNotExist:
return HttpResponse(json.dumps({'state': False, 'response': 'Invalid code'}))

Expand Down
11 changes: 11 additions & 0 deletions deimos/static/deimos/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
}
}

#preloader {
background: #000 url('../images/cool_mars_gif.gif') no-repeat center center;
background-size: 15%;
height: 100vh;
width: 100vw;
position: fixed;
z-index:100;
}
#preloader.hide {
display: none;
}
.animate-border {
/* Initial border setup */
border: 2px solid #fff;
Expand Down
Binary file added deimos/static/deimos/images/cool_gif.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added deimos/static/deimos/images/cool_mars_gif.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added deimos/static/deimos/images/loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added deimos/static/deimos/images/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added deimos/static/deimos/images/preloader_gif.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions deimos/templates/deimos/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body class="body">
<div id="preloader"></div>
<ul class="navbar-nav mr-auto">
{% if user.is_authenticated %}
<li class="nav-item" style="display:none">
Expand Down Expand Up @@ -56,4 +57,10 @@
<script src="{% static 'deimos/js/sidebar.js' %}"></script>
{% block scripts %}{% endblock %}
</body>
<script>
var loader = document.querySelector('#preloader');
window.addEventListener('load', ()=>{
loader.classList.add('hide');
})
</script>
</html>
12 changes: 12 additions & 0 deletions phobos/static/phobos/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
/* Add additional src lines for other font formats if necessary */
}

#preloader {
background: #000 url('../images/cool_mars_gif.gif') no-repeat center center;
background-size: 15%;
height: 100vh;
width: 100vw;
position: fixed;
z-index:100;
}
#preloader.hide {
display: none;
}

body.body {
background-color: white !important;
color:black;
Expand Down
Binary file added phobos/static/phobos/images/cool_gif.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added phobos/static/phobos/images/cool_mars_gif.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added phobos/static/phobos/images/loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added phobos/static/phobos/images/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added phobos/static/phobos/images/loading_gif_2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added phobos/static/phobos/images/preloader_gif.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions phobos/static/phobos/js/assign_question.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
document.addEventListener('DOMContentLoaded', () => {
const assignBtn = document.querySelector('.assign-btn');
const preloader = document.querySelector('#preloader');
assignBtn.addEventListener('click', () => {
// Implement the fetch.
preloader.classList.remove('hide');
fetch(window.location.href + '/assign', {
method: 'POST',
})
Expand All @@ -13,6 +15,7 @@ document.addEventListener('DOMContentLoaded', () => {
})
.then(data => {
alert(data.message);
preloader.classList.add('hide');
if (data.success) {
assignBtn.parentNode.removeChild(assignBtn);
}
Expand Down
6 changes: 4 additions & 2 deletions phobos/static/phobos/js/export_question.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var select_assignment;
var selected_course_id;
var select_course=export_to_assignment.querySelector('select[id=select_course]');

const preloader = document.querySelector('#preloader');

document.querySelector('#btn-export_question').addEventListener('click',()=>{
export_to_assignment.style.display='block';
Expand All @@ -19,10 +19,12 @@

if(event.target.classList.contains('export-confirm') && selected_course_id != null ){
// excute back_end export function and return result
select_assignment= export_to_assignment.querySelector('#' + selected_course_id)
select_assignment= export_to_assignment.querySelector('#' + selected_course_id);
preloader.classList.remove('hide');
fetch(window.location.href+ '/export_question_to/'+ select_assignment.value)
.then(response=>response.json())
.then(result=>{
preloader.classList.add('hide');
alert(result.message);
export_result.style.display= 'block';
export_to_assignment.style.display='none';
Expand Down
Loading
Loading