Commit fddd96f5 authored by Roshan Rabinarayan's avatar Roshan Rabinarayan

added snackbar for successful quiz submisiion

parent 9b94e89a
No preview for this file type
...@@ -185,9 +185,69 @@ ...@@ -185,9 +185,69 @@
} }
} }
} }
#snackbar {
visibility: hidden;
min-width: 250px;
margin-left: -125px;
background-color: #333;
color: #fff;
text-align: center;
border-radius: 2px;
padding: 16px;
position: fixed;
z-index: 1;
left: 50%;
bottom: 30px;
font-size: 17px;
}
#snackbar.show {
visibility: visible;
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
animation: fadein 0.5s, fadeout 0.5s 2.5s;
}
@-webkit-keyframes fadein {
from {bottom: 0; opacity: 0;}
to {bottom: 30px; opacity: 1;}
}
@keyframes fadein {
from {bottom: 0; opacity: 0;}
to {bottom: 30px; opacity: 1;}
}
@-webkit-keyframes fadeout {
from {bottom: 30px; opacity: 1;}
to {bottom: 0; opacity: 0;}
}
@keyframes fadeout {
from {bottom: 30px; opacity: 1;}
to {bottom: 0; opacity: 0;}
}
</style> </style>
<script>
function snackBar() {
var x = document.getElementById("snackbar");
var quiz_upload=document.getElementById("quiz_upload").value;
x.className = "show";
if(quiz_upload=="True")
{
x.innerHTML ="QUIZ UPLOADED SUCCESFULLY";
}
else
{
x.innerHTML ="Welcome to Professor to Dashboard";
}
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
}
</script>
</head> </head>
<body> <input type="hidden" id ="quiz_upload" value ="{{quiz_upload}}">
<body onload="snackBar() ">
<div id="snackbar"></div>
<section class="profile"> <section class="profile">
<h3>Welcome,</h3> <h3>Welcome,</h3>
<h1>Professor {{user}}</h1> <h1>Professor {{user}}</h1>
......
...@@ -281,7 +281,7 @@ def add_quiz(request): ...@@ -281,7 +281,7 @@ def add_quiz(request):
answer=row[7],marks=int(row[5]),negative=float(row[6]),explainations=row[7],quizCode=q.quizCode,quizId=q) answer=row[7],marks=int(row[5]),negative=float(row[6]),explainations=row[7],quizCode=q.quizCode,quizId=q)
q1.save() q1.save()
i=i+9 i=i+9
return HttpResponse('success')#(request,'success') return render(request,'professor.html',{'quiz_upload':True})#(request,'success')
def monitor(request): def monitor(request):
q_id = request.GET.get('quiz') q_id = request.GET.get('quiz')
...@@ -329,4 +329,5 @@ def heartbeat(request): ...@@ -329,4 +329,5 @@ def heartbeat(request):
l.save() l.save()
print("Log saved!") print("Log saved!")
return HttpResponse('') return HttpResponse('')
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment