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 || {};
...
@@ -8,8 +8,8 @@ var edx = edx || {};
edx
.
instructor_dashboard
.
proctoring
=
edx
.
instructor_dashboard
.
proctoring
||
{};
edx
.
instructor_dashboard
.
proctoring
=
edx
.
instructor_dashboard
.
proctoring
||
{};
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
=
Backbone
.
Model
.
extend
({
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
;
this
.
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
=
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
;
}).
call
(
this
,
Backbone
);
}).
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 || {};
...
@@ -10,10 +10,12 @@ var edx = edx || {};
{
{
name
:
"AddAllowanceView"
,
name
:
"AddAllowanceView"
,
template
:
null
,
template
:
null
,
model
:
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
,
template_url
:
'/static/proctoring/templates/add-new-allowance.underscore'
,
tempate_url
:
'/static/proctoring/templates/add-new-allowance.underscore'
,
initialize
:
function
(
options
)
{
initialize
:
function
(
options
)
{
this
.
proctored_exams
=
options
.
proctored_exams
;
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"
);
_
.
bindAll
(
this
,
"render"
);
this
.
loadTemplateData
();
this
.
loadTemplateData
();
//Backbone.Validation.bind( this, {valid:this.hideError, invalid:this.showError});
//Backbone.Validation.bind( this, {valid:this.hideError, invalid:this.showError});
...
@@ -23,7 +25,7 @@ var edx = edx || {};
...
@@ -23,7 +25,7 @@ var edx = edx || {};
},
},
loadTemplateData
:
function
(){
loadTemplateData
:
function
(){
var
self
=
this
;
var
self
=
this
;
$
.
ajax
({
url
:
self
.
tempate_url
,
dataType
:
"html"
})
$
.
ajax
({
url
:
self
.
temp
l
ate_url
,
dataType
:
"html"
})
.
error
(
function
(
jqXHR
,
textStatus
,
errorThrown
){
.
error
(
function
(
jqXHR
,
textStatus
,
errorThrown
){
})
})
...
@@ -38,7 +40,7 @@ var edx = edx || {};
...
@@ -38,7 +40,7 @@ var edx = edx || {};
return
{
return
{
proctored_exam
:
$
(
"select#proctored_exam"
).
val
(),
proctored_exam
:
$
(
"select#proctored_exam"
).
val
(),
allowance_type
:
$
(
"select#allowance_type"
).
val
(),
allowance_type
:
$
(
"select#allowance_type"
).
val
(),
value
:
$
(
"#allowance_value"
).
val
(),
allowance_
value
:
$
(
"#allowance_value"
).
val
(),
user_info
:
$
(
"#user_info"
).
val
()
user_info
:
$
(
"#user_info"
).
val
()
};
};
},
},
...
@@ -70,30 +72,49 @@ var edx = edx || {};
...
@@ -70,30 +72,49 @@ var edx = edx || {};
{
{
event
.
preventDefault
();
event
.
preventDefault
();
var
values
=
this
.
getCurrentFormValues
();
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()))
// if( this.model.set( this.getCurrentFormValues()))
// {
// {
this
.
hideModal
();
// }
// }
},
},
render
:
render
:
function
()
{
function
()
var
allowance_types
=
[
'Additional time (minutes)'
];
{
var
exams_data
=
[{
'exam_name'
:
'exam12'
},{
'exam_name'
:
'exam22'
},{
'exam_name'
:
'exam32'
}];
var
allowance_types
=
[
'Additional time (minutes)'
];
$
(
this
.
el
).
html
(
this
.
template
({
$
(
this
.
el
).
html
(
this
.
template
({
proctored_exams
:
this
.
proctored_exams
,
proctored_exams
:
this
.
proctored_exams
,
allowance_types
:
allowance_types
allowance_types
:
allowance_types
}));
}));
this
.
$form
=
{
this
.
$form
=
{
name
:
this
.
$
(
"#name"
),
proctored_exam
:
this
.
$
(
"select#proctored_exam"
),
email
:
this
.
$
(
"#email"
),
allowance_type
:
this
.
$
(
"select#allowance_type"
),
phone
:
this
.
$
(
"#phone"
)
allowance_value
:
this
.
$
(
"#allowance_value"
),
};
user_info
:
this
.
$
(
"#user_info"
).
val
()
return
this
;
};
}
return
this
;
}
});
});
}).
call
(
this
,
Backbone
,
$
,
_
);
}).
call
(
this
,
Backbone
,
$
,
_
);
edx_proctoring/static/proctoring/js/views/proctored_exam_allowance_view.js
View file @
f040c95f
...
@@ -17,7 +17,8 @@ var edx = edx || {};
...
@@ -17,7 +17,8 @@ var edx = edx || {};
/* this should be moved to a 'data' attribute in HTML */
/* this should be moved to a 'data' attribute in HTML */
this
.
tempate_url
=
'/static/proctoring/templates/course_allowances.underscore'
;
this
.
tempate_url
=
'/static/proctoring/templates/course_allowances.underscore'
;
this
.
template
=
null
;
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 */
/* re-render if the model changes */
this
.
listenTo
(
this
.
collection
,
'change'
,
this
.
collectionChanged
);
this
.
listenTo
(
this
.
collection
,
'change'
,
this
.
collectionChanged
);
...
@@ -25,7 +26,7 @@ var edx = edx || {};
...
@@ -25,7 +26,7 @@ var edx = edx || {};
this
.
loadTemplateData
();
this
.
loadTemplateData
();
this
.
proctoredExamCollection
.
url
=
this
.
proctoredExamCollection
.
url
+
this
.
course_id
;
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
:
{
events
:
{
...
@@ -68,7 +69,7 @@ var edx = edx || {};
...
@@ -68,7 +69,7 @@ var edx = edx || {};
},
},
success
:
function
()
{
success
:
function
()
{
// fetch the allowances again.
// 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
();
self
.
hydrate
();
}
}
}
}
...
@@ -125,16 +126,19 @@ var edx = edx || {};
...
@@ -125,16 +126,19 @@ var edx = edx || {};
this
.
$el
.
show
();
this
.
$el
.
show
();
}
}
},
},
showAddModal
:
function
()
{
showAddModal
:
function
(
event
)
{
var
self
=
this
;
var
self
=
this
;
self
.
proctoredExamCollection
.
fetch
({
self
.
proctoredExamCollection
.
fetch
({
success
:
function
()
{
success
:
function
()
{
var
add_allowance_view
=
new
edx
.
instructor_dashboard
.
proctoring
.
AddAllowanceView
({
var
add_allowance_view
=
new
edx
.
instructor_dashboard
.
proctoring
.
AddAllowanceView
({
course_id
:
self
.
course_id
,
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
,
$
,
_
);
}).
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