Remove field to select question paper type#52
Remove field to select question paper type#52Jayashrri wants to merge 5 commits intosandy9999:masterfrom
Conversation
searchapp/templates/home.html
Outdated
| <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.
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
| 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> |
searchapp/templates/home.html
Outdated
| 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> |
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.
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
|
|
||
| function upload_click(e) { | ||
| let worksheetType = $("#worksheetType").dropdown('get value'); | ||
| let worksheet = $("#worksheetType").text(); |
There was a problem hiding this comment.
Code repetition. It is not needed.
searchapp/static/student_view.js
Outdated
|
|
||
| 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.
Code repetition. It is not needed.
searchapp/static/student_view.js
Outdated
| 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.
Code repetition. It is not needed.
searchapp/static/student_view.js
Outdated
|
|
||
| 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.
Code repetition. It is not needed.
searchapp/templates/home.html
Outdated
| <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.
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.
|
|
||
|
|
||
| def student_view(request): | ||
| paper_type = request.GET.get('type') |
There was a problem hiding this comment.
Make paper_type as worksheet_type. The same to be changed anywhere where paper_type has been used.
searchapp/static/student_view.js
Outdated
| }); | ||
| }); | ||
|
|
||
| function set_paper_type(type){ |
There was a problem hiding this comment.
Change set_paper_type to set_worksheet_type.
This fixes issue #36