Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

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

@@ -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>
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.

<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>
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

<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>
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.

@@ -122,7 +127,11 @@ $(document).ready(function(){
}

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.

@@ -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';
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.

@@ -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;
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.

@@ -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';
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.

@@ -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>
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.

@@ -55,9 +55,10 @@ def contact(request):


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.

@@ -596,6 +625,10 @@ function populate_subjects(value,text, $selectedItem) {
});
});

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