-
Notifications
You must be signed in to change notification settings - Fork 5
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
Remove field to select question paper type #52
base: master
Are you sure you want to change the base?
Remove field to select question paper type #52
Conversation
searchapp/templates/home.html
Outdated
@@ -21,19 +21,19 @@ | |||
</div> | |||
<div class="ui grid"> | |||
<div class="four wide column"> | |||
<div class="button" id="test"><a href="student_view" class="button">Test Paper</a> | |||
<div class="button" id="test"><a href="" onclick="set_paper_type('test'); return false;" class="button">Test Paper</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you write the onClick function for this in a js file? I think that will look cleaner. And also, we should get rid of <a></a>
tags if possible here and use a button instead.
searchapp/templates/home.html
Outdated
<br> | ||
<br> | ||
A Test Paper is a worksheet in the format of the board question paper.Great for pre-board preparation and | ||
to practice all the question types. The fellow needs to choose which chapters to test. | ||
</div></div> | ||
<div class="four wide column" id="generic"><div class="button"><a href="student_view" class="button">Generic Paper</a> | ||
<div class="four wide column" id="generic"><div class="button"><a href="" onclick="set_paper_type('generic'); return false;" class="button">Generic Paper</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
searchapp/templates/home.html
Outdated
<br> | ||
<br> | ||
A Generic Paper is designed as per the fellow requirements. You can choose the chapters | ||
and the number of questions of each type. Great for specific question type and differentiated practice. | ||
</div></div> | ||
<div class="four wide column" id="customized"><div class="button"><a href="student_view" class="button">Customized Paper</a> | ||
<div class="four wide column" id="customized"><div class="button"><a href="" onclick="set_paper_type('customized'); return false;" class="button">Customized Paper</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
6e1da04
to
836fce9
Compare
searchapp/static/student_view.js
Outdated
|
||
// function called when submit button clicked | ||
function submit_click(e) { | ||
let worksheetType = $("#worksheetType").dropdown('get value'); | ||
let worksheet = $("#worksheetType").text(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The worksheet type is the argument value
in display_form_sections
and that can be used instead of finding worksheet type again.
searchapp/static/student_view.js
Outdated
@@ -122,7 +127,11 @@ $(document).ready(function(){ | |||
} | |||
|
|||
function upload_click(e) { | |||
let worksheetType = $("#worksheetType").dropdown('get value'); | |||
let worksheet = $("#worksheetType").text(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code repetition. It is not needed.
searchapp/static/student_view.js
Outdated
@@ -166,7 +175,11 @@ function upload_click(e) { | |||
} | |||
|
|||
function populate_grades(value,text, $selectedItem) { | |||
let worksheetType = document.getElementById("worksheetType") ? $("#worksheetType").dropdown('get value') : 'paper'; | |||
let worksheet = document.getElementById("worksheetType") ? $("#worksheetType").text() : 'paper'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code repetition. It is not needed.
searchapp/static/student_view.js
Outdated
@@ -188,7 +201,11 @@ function populate_grades(value,text, $selectedItem) { | |||
} | |||
|
|||
function populate_subjects(value,text, $selectedItem) { | |||
let worksheetType = document.getElementById("worksheetType") ? $("#worksheetType").dropdown('get value') : 'paper'; | |||
let worksheet = document.getElementById("worksheetType") ? $("#worksheetType").text() : 'paper'; | |||
var worksheetType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code repetition. It is not needed.
searchapp/static/student_view.js
Outdated
@@ -210,7 +227,11 @@ function populate_subjects(value,text, $selectedItem) { | |||
} | |||
|
|||
function populate_chapters(value, text, $selectedItem) { | |||
let worksheetType = document.getElementById("worksheetType") ? $("#worksheetType").dropdown('get value') : 'paper'; | |||
let worksheet = document.getElementById("worksheetType") ? $("#worksheetType").text() : 'paper'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code repetition. It is not needed.
searchapp/templates/home.html
Outdated
@@ -21,19 +21,19 @@ | |||
</div> | |||
<div class="ui grid"> | |||
<div class="four wide column"> | |||
<div class="button" id="test"><a href="student_view" class="button">Test Paper</a> | |||
<div class="button" id="test"><button onclick="set_paper_type('test')">Test Paper</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a .js file for home.html and use .click
function in it to get the worksheet type based on id
. Remove the outer div with class button. Move id from <div></div>
to <button></button>
and have the same class . This will help to have a single function for all 3 and worksheet type can be set based on id.
@@ -55,9 +55,10 @@ def contact(request): | |||
|
|||
|
|||
def student_view(request): | |||
paper_type = request.GET.get('type') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make paper_type
as worksheet_type
. The same to be changed anywhere where paper_type
has been used.
searchapp/static/student_view.js
Outdated
@@ -596,6 +625,10 @@ function populate_subjects(value,text, $selectedItem) { | |||
}); | |||
}); | |||
|
|||
function set_paper_type(type){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change set_paper_type
to set_worksheet_type
.
This fixes issue #36