Skip to content

Commit b9944c8

Browse files
committed
added loading page and improved student_profile
1 parent 4991713 commit b9944c8

32 files changed

+370
-222
lines changed

astros/static/astros/css/registration_style.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
border-color: #333; /* ending color (same as starting color) */
1111
}
1212
}
13+
#preloader {
14+
background: #000 url('../images/cool_mars_gif.gif') no-repeat center center;
15+
background-size: 15%;
16+
height: 100vh;
17+
width: 100vw;
18+
position: fixed;
19+
z-index:100;
20+
}
21+
#preloader.hide {
22+
display: none;
23+
}
24+
1325

1426
.input-code {
1527
/* Initial border setup */
@@ -21,7 +33,7 @@
2133
body.body {
2234
background-color: black !important;
2335
color:white;
24-
overflow: hidden; /*To hide Scroll Bar*/
36+
overflow: visible; /*To hide Scroll Bar*/
2537
}
2638

2739
.landing-container {

astros/static/astros/css/style.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88
src: url('../fonts/aileron-regular.otf') format('truetype');
99
/* Add additional src lines for other font formats if necessary */
1010
}
11+
12+
#preloader {
13+
background: #000 url('../images/loader.gif') no-repeat center center;
14+
background-size: 15%;
15+
height: 100vh;
16+
width: 100vw;
17+
position: fixed;
18+
z-index:100;
19+
}
20+
#preloader.hide {
21+
display: none;
22+
}
23+
1124
body.body {
1225
background-color: white !important;
1326
color:black;
641 KB
Loading
1.71 MB
Loading
47.3 KB
Loading
58.6 KB
Loading
529 KB
Loading

astros/static/astros/js/registration.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
document.addEventListener('DOMContentLoaded',()=>{
33
const submitBtns = document.querySelectorAll('.submit-btn-register');
44
const forgotPLinks = document.querySelectorAll('.forgot-password-link');
5+
const preloader = document.querySelector('#preloader');
56
if(forgotPLinks != null){
67
forgotPLinks.forEach((fp)=>{
78
const mformDiv = fp.closest('.main-form');
@@ -85,6 +86,7 @@ submitBtns.forEach((submitBtn)=>{
8586
}
8687

8788
if(authenticationArea.classList.contains('closed')){
89+
preloader.classList.remove('hide');
8890
fetch('/authentification/generate_code', {
8991
method: 'POST',
9092
headers: { 'X-CSRFToken': getCookie('csrftoken') },
@@ -94,12 +96,14 @@ submitBtns.forEach((submitBtn)=>{
9496
})
9597
.then(response => response.json())
9698
.then(result => {
99+
preloader.classList.add('hide');
97100
alert(result.message);
98101
if(result.success){
99102
authenticationArea.style.display='block';
100103
authenticationArea.classList.remove('closed');
101104
}
102105
});
106+
submitBtn.scrollIntoView({behavior: 'smooth'});
103107
}else {
104108
fetch('/authentification/validate_code', {
105109
method: 'POST',

astros/templates/astros/layout.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<link rel="icon" href="{% static 'astros/images/mars.ico' %}" />
1515
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1616
</head>
17+
<div id="preloader"></div>
1718
<body class="body">
1819
<ul class="navbar-nav mr-auto">
1920
{% if user.is_authenticated %}
@@ -66,4 +67,11 @@
6667
<script src="{% static 'phobos/js/sidebar.js' %}"></script>
6768
{% block scripts %}{% endblock %}
6869
</body>
70+
71+
<script>
72+
var loader = document.querySelector('#preloader');
73+
window.addEventListener('load', ()=>{
74+
loader.classList.add('hide');
75+
})
76+
</script>
6977
</html>

astros/templates/astros/registration_layout.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,18 @@
1111
<link rel="icon" href="{% static 'astros/images/mars.ico' %}" />
1212
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1313
</head>
14+
1415
<body class="body">
16+
<div id="preloader"></div>
1517
<h2 style="color:white" id="dr-r" class="bs-overrides">Dr. R </h2>
1618
{% block body %} {% endblock %}
1719
{% block scripts %}{% endblock %}
1820
</body>
21+
<script>
22+
var loader = document.querySelector('#preloader');
23+
window.addEventListener('load', ()=>{
24+
console.log('loaded');
25+
loader.classList.add('hide');
26+
})
27+
</script>
1928
</html>

astros/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def course_enroll(request, course_id, code):
6565
if not Enrollment.objects.filter(student=student, course=course).exists():
6666
# Checking whether code is valid.
6767
try:
68-
enrollment_code = EnrollmentCode.objects.filter(course=course, code=code)
68+
enrollment_code = EnrollmentCode.objects.get(course=course, code=code)
6969
except EnrollmentCode.DoesNotExist:
7070
return HttpResponse(json.dumps({'state': False, 'response': 'Invalid code'}))
7171

deimos/static/deimos/css/style.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@
2424
}
2525
}
2626

27+
#preloader {
28+
background: #000 url('../images/cool_mars_gif.gif') no-repeat center center;
29+
background-size: 15%;
30+
height: 100vh;
31+
width: 100vw;
32+
position: fixed;
33+
z-index:100;
34+
}
35+
#preloader.hide {
36+
display: none;
37+
}
2738
.animate-border {
2839
/* Initial border setup */
2940
border: 2px solid #fff;
641 KB
Loading
1.71 MB
Loading
47.3 KB
Loading
187 KB
Loading
529 KB
Loading

deimos/templates/deimos/layout.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1414
</head>
1515
<body class="body">
16+
<div id="preloader"></div>
1617
<ul class="navbar-nav mr-auto">
1718
{% if user.is_authenticated %}
1819
<li class="nav-item" style="display:none">
@@ -56,4 +57,10 @@
5657
<script src="{% static 'deimos/js/sidebar.js' %}"></script>
5758
{% block scripts %}{% endblock %}
5859
</body>
60+
<script>
61+
var loader = document.querySelector('#preloader');
62+
window.addEventListener('load', ()=>{
63+
loader.classList.add('hide');
64+
})
65+
</script>
5966
</html>

phobos/models.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ class DifficultyChoices(models.TextChoices):
1111
DIFFICULT = 'DIFFICULT', 'Difficult'
1212

1313
class SubjectChoices(models.TextChoices):
14-
15-
COMPUTER_SCIENCE = 'COMPUTER_SCIENCE', 'Computer Science'
16-
MATHS = 'MATHS', 'Maths'
14+
# COMPUTER_SCIENCE = 'COMPUTER_SCIENCE', 'Computer Science'
15+
# MATHS = 'MATHS', 'Maths'
1716
PHYSICS = 'PHYSICS', 'Physics'
1817
# TODO: Add more subject choices as needed.
1918

phobos/static/phobos/css/style.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
/* Add additional src lines for other font formats if necessary */
1111
}
1212

13+
#preloader {
14+
background: #000 url('../images/cool_mars_gif.gif') no-repeat center center;
15+
background-size: 15%;
16+
height: 100vh;
17+
width: 100vw;
18+
position: fixed;
19+
z-index:100;
20+
}
21+
#preloader.hide {
22+
display: none;
23+
}
24+
1325
body.body {
1426
background-color: white !important;
1527
color:black;
641 KB
Loading
1.71 MB
Loading
47.3 KB
Loading
217 KB
Loading
122 KB
Loading
529 KB
Loading

phobos/static/phobos/js/assign_question.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
document.addEventListener('DOMContentLoaded', () => {
22
const assignBtn = document.querySelector('.assign-btn');
3+
const preloader = document.querySelector('#preloader');
34
assignBtn.addEventListener('click', () => {
45
// Implement the fetch.
6+
preloader.classList.remove('hide');
57
fetch(window.location.href + '/assign', {
68
method: 'POST',
79
})
@@ -13,6 +15,7 @@ document.addEventListener('DOMContentLoaded', () => {
1315
})
1416
.then(data => {
1517
alert(data.message);
18+
preloader.classList.add('hide');
1619
if (data.success) {
1720
assignBtn.parentNode.removeChild(assignBtn);
1821
}

phobos/static/phobos/js/export_question.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
var select_assignment;
88
var selected_course_id;
99
var select_course=export_to_assignment.querySelector('select[id=select_course]');
10-
10+
const preloader = document.querySelector('#preloader');
1111

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

2020
if(event.target.classList.contains('export-confirm') && selected_course_id != null ){
2121
// excute back_end export function and return result
22-
select_assignment= export_to_assignment.querySelector('#' + selected_course_id)
22+
select_assignment= export_to_assignment.querySelector('#' + selected_course_id);
23+
preloader.classList.remove('hide');
2324
fetch(window.location.href+ '/export_question_to/'+ select_assignment.value)
2425
.then(response=>response.json())
2526
.then(result=>{
27+
preloader.classList.add('hide');
2628
alert(result.message);
2729
export_result.style.display= 'block';
2830
export_to_assignment.style.display='none';

0 commit comments

Comments
 (0)