Skip to content

Conversation

@Jayashrri
Copy link
Collaborator

This fixes issue #36

  • Passes question paper type selected at home as URL parameter
  • Checks URL parameter in student view and display the corresponding heading
  • Redirect back to home for invalid parameter passed

<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>
Copy link
Collaborator

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.

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>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

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>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@Jayashrri Jayashrri force-pushed the fix/remove_field_to_select_question_paper_type branch from 6e1da04 to 836fce9 Compare October 22, 2019 19:23
// function called when submit button clicked
function submit_click(e) {
let worksheetType = $("#worksheetType").dropdown('get value');
let worksheet = $("#worksheetType").text();
Copy link
Collaborator

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.


function upload_click(e) {
let worksheetType = $("#worksheetType").dropdown('get value');
let worksheet = $("#worksheetType").text();
Copy link
Collaborator

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.


function populate_grades(value,text, $selectedItem) {
let worksheetType = document.getElementById("worksheetType") ? $("#worksheetType").dropdown('get value') : 'paper';
let worksheet = document.getElementById("worksheetType") ? $("#worksheetType").text() : 'paper';
Copy link
Collaborator

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.

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;
Copy link
Collaborator

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.


function populate_chapters(value, text, $selectedItem) {
let worksheetType = document.getElementById("worksheetType") ? $("#worksheetType").dropdown('get value') : 'paper';
let worksheet = document.getElementById("worksheetType") ? $("#worksheetType").text() : 'paper';
Copy link
Collaborator

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.

<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>
Copy link
Collaborator

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.



def student_view(request):
paper_type = request.GET.get('type')
Copy link
Collaborator

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.

});
});

function set_paper_type(type){
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants