Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-proctoring
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
edx-proctoring
Commits
f040c95f
Commit
f040c95f
authored
Jul 09, 2015
by
Muhammad Shoaib
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add allowance call
parent
20d65815
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
27 deletions
+52
-27
edx_proctoring/static/proctoring/js/models/proctored_exam_allowance_model.js
+1
-1
edx_proctoring/static/proctoring/js/views/proctored_exam_add_allowance_view.js
+42
-21
edx_proctoring/static/proctoring/js/views/proctored_exam_allowance_view.js
+9
-5
No files found.
edx_proctoring/static/proctoring/js/models/proctored_exam_allowance_model.js
View file @
f040c95f
...
...
@@ -8,8 +8,8 @@ var edx = edx || {};
edx
.
instructor_dashboard
.
proctoring
=
edx
.
instructor_dashboard
.
proctoring
||
{};
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
=
Backbone
.
Model
.
extend
({
url
:
'/api/edx_proctoring/v1/proctored_exam/allowance'
/* we should probably pull this from a data attribute on the HTML */
});
this
.
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
=
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
;
}).
call
(
this
,
Backbone
);
edx_proctoring/static/proctoring/js/views/proctored_exam_add_allowance_view.js
View file @
f040c95f
...
...
@@ -10,10 +10,12 @@ var edx = edx || {};
{
name
:
"AddAllowanceView"
,
template
:
null
,
model
:
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
,
tempate_url
:
'/static/proctoring/templates/add-new-allowance.underscore'
,
template_url
:
'/static/proctoring/templates/add-new-allowance.underscore'
,
initialize
:
function
(
options
)
{
this
.
proctored_exams
=
options
.
proctored_exams
;
this
.
proctored_exam_allowance_view
=
options
.
proctored_exam_allowance_view
;
this
.
course_id
=
options
.
course_id
;
this
.
model
=
new
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
();
_
.
bindAll
(
this
,
"render"
);
this
.
loadTemplateData
();
//Backbone.Validation.bind( this, {valid:this.hideError, invalid:this.showError});
...
...
@@ -23,7 +25,7 @@ var edx = edx || {};
},
loadTemplateData
:
function
(){
var
self
=
this
;
$
.
ajax
({
url
:
self
.
tempate_url
,
dataType
:
"html"
})
$
.
ajax
({
url
:
self
.
temp
l
ate_url
,
dataType
:
"html"
})
.
error
(
function
(
jqXHR
,
textStatus
,
errorThrown
){
})
...
...
@@ -38,7 +40,7 @@ var edx = edx || {};
return
{
proctored_exam
:
$
(
"select#proctored_exam"
).
val
(),
allowance_type
:
$
(
"select#allowance_type"
).
val
(),
value
:
$
(
"#allowance_value"
).
val
(),
allowance_
value
:
$
(
"#allowance_value"
).
val
(),
user_info
:
$
(
"#user_info"
).
val
()
};
},
...
...
@@ -70,30 +72,49 @@ var edx = edx || {};
{
event
.
preventDefault
();
var
values
=
this
.
getCurrentFormValues
();
var
self
=
this
;
self
.
model
.
fetch
(
{
headers
:
{
"X-CSRFToken"
:
self
.
proctored_exam_allowance_view
.
getCSRFToken
()
},
type
:
'PUT'
,
data
:
{
'exam_id'
:
values
.
proctored_exam
,
'user_id'
:
values
.
user_info
,
'key'
:
values
.
allowance_type
,
'value'
:
values
.
allowance_value
},
success
:
function
()
{
// fetch the allowances again.
self
.
proctored_exam_allowance_view
.
collection
.
url
=
self
.
proctored_exam_allowance_view
.
initial_url
+
self
.
course_id
+
'/allowance'
;
self
.
proctored_exam_allowance_view
.
hydrate
();
self
.
hideModal
();
}
});
// if( this.model.set( this.getCurrentFormValues()))
// {
this
.
hideModal
();
// }
},
render
:
function
()
{
var
exams_data
=
[{
'exam_name'
:
'exam12'
},{
'exam_name'
:
'exam22'
},{
'exam_name'
:
'exam32'
}];
var
allowance_types
=
[
'Additional time (minutes)'
];
render
:
function
()
{
var
allowance_types
=
[
'Additional time (minutes)'
];
$
(
this
.
el
).
html
(
this
.
template
({
proctored_exams
:
this
.
proctored_exams
,
allowance_types
:
allowance_types
}));
$
(
this
.
el
).
html
(
this
.
template
({
proctored_exams
:
this
.
proctored_exams
,
allowance_types
:
allowance_types
}));
this
.
$form
=
{
name
:
this
.
$
(
"#name"
),
email
:
this
.
$
(
"#email"
),
phone
:
this
.
$
(
"#phone"
)
};
return
this
;
}
this
.
$form
=
{
proctored_exam
:
this
.
$
(
"select#proctored_exam"
),
allowance_type
:
this
.
$
(
"select#allowance_type"
),
allowance_value
:
this
.
$
(
"#allowance_value"
),
user_info
:
this
.
$
(
"#user_info"
).
val
()
};
return
this
;
}
});
}).
call
(
this
,
Backbone
,
$
,
_
);
edx_proctoring/static/proctoring/js/views/proctored_exam_allowance_view.js
View file @
f040c95f
...
...
@@ -17,7 +17,8 @@ var edx = edx || {};
/* this should be moved to a 'data' attribute in HTML */
this
.
tempate_url
=
'/static/proctoring/templates/course_allowances.underscore'
;
this
.
template
=
null
;
this
.
allowance_url
=
this
.
collection
.
url
;
this
.
allowance_url
=
this
.
collection
.
url
+
'allowance'
;
this
.
initial_url
=
this
.
collection
.
url
;
/* re-render if the model changes */
this
.
listenTo
(
this
.
collection
,
'change'
,
this
.
collectionChanged
);
...
...
@@ -25,7 +26,7 @@ var edx = edx || {};
this
.
loadTemplateData
();
this
.
proctoredExamCollection
.
url
=
this
.
proctoredExamCollection
.
url
+
this
.
course_id
;
this
.
collection
.
url
=
this
.
allowance
_url
+
this
.
course_id
+
'/allowance'
;
this
.
collection
.
url
=
this
.
initial
_url
+
this
.
course_id
+
'/allowance'
;
},
events
:
{
...
...
@@ -68,7 +69,7 @@ var edx = edx || {};
},
success
:
function
()
{
// fetch the allowances again.
self
.
collection
.
url
=
self
.
allowance
_url
+
self
.
course_id
+
'/allowance'
;
self
.
collection
.
url
=
self
.
initial
_url
+
self
.
course_id
+
'/allowance'
;
self
.
hydrate
();
}
}
...
...
@@ -125,16 +126,19 @@ var edx = edx || {};
this
.
$el
.
show
();
}
},
showAddModal
:
function
()
{
showAddModal
:
function
(
event
)
{
var
self
=
this
;
self
.
proctoredExamCollection
.
fetch
({
success
:
function
()
{
var
add_allowance_view
=
new
edx
.
instructor_dashboard
.
proctoring
.
AddAllowanceView
({
course_id
:
self
.
course_id
,
proctored_exams
:
self
.
proctoredExamCollection
.
toJSON
()
proctored_exams
:
self
.
proctoredExamCollection
.
toJSON
(),
proctored_exam_allowance_view
:
self
});
}
});
event
.
stopPropagation
();
event
.
preventDefault
();
}
});
}).
call
(
this
,
Backbone
,
$
,
_
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment