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
91ac771f
Commit
91ac771f
authored
Jul 08, 2015
by
Muhammad Shoaib
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the delete allowance and small tweaks in the internationalization
parent
4bb08cb5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
25 deletions
+43
-25
edx_proctoring/static/proctoring/js/views/proctored_exam_allowance_view.js
+25
-15
edx_proctoring/static/proctoring/templates/course_allowances.underscore
+17
-9
edx_proctoring/views.py
+1
-1
No files found.
edx_proctoring/static/proctoring/js/views/proctored_exam_allowance_view.js
View file @
91ac771f
...
...
@@ -15,15 +15,13 @@ var edx = edx || {};
this
.
course_id
=
this
.
$el
.
data
(
'course-id'
);
/* this should be moved to a 'data' attribute in HTML */
this
.
tempate_url
=
'/static/proctoring/templates/
add-allowance
.underscore'
;
this
.
tempate_url
=
'/static/proctoring/templates/
course_allowances
.underscore'
;
this
.
template
=
null
;
this
.
allowance_url
=
this
.
collection
.
url
;
/* re-render if the model changes */
this
.
listenTo
(
this
.
collection
,
'change'
,
this
.
collectionChanged
);
/* make the async call to the backend REST API */
/* after it loads, the listenTo event will file and */
/* will call into the rendering */
/* Load the static template for rendering. */
this
.
loadTemplateData
();
this
.
collection
.
url
=
this
.
allowance_url
+
'/'
+
this
.
course_id
;
...
...
@@ -31,10 +29,23 @@ var edx = edx || {};
},
events
:
{
'click #add-allowance'
:
'showAddModal'
,
'click
#
remove_allowance'
:
'removeAllowance'
'click
.
remove_allowance'
:
'removeAllowance'
},
showAddModal
:
function
(){
alert
(
'here'
);
getCSRFToken
:
function
()
{
var
cookieValue
=
null
;
var
name
=
'csrftoken'
;
if
(
document
.
cookie
&&
document
.
cookie
!=
''
)
{
var
cookies
=
document
.
cookie
.
split
(
';'
);
for
(
var
i
=
0
;
i
<
cookies
.
length
;
i
++
)
{
var
cookie
=
jQuery
.
trim
(
cookies
[
i
]);
// Does this cookie string begin with the name we want?
if
(
cookie
.
substring
(
0
,
name
.
length
+
1
)
==
(
name
+
'='
))
{
cookieValue
=
decodeURIComponent
(
cookie
.
substring
(
name
.
length
+
1
));
break
;
}
}
}
return
cookieValue
;
},
removeAllowance
:
function
(
event
){
var
element
=
$
(
event
.
currentTarget
);
...
...
@@ -55,9 +66,9 @@ var edx = edx || {};
'key'
:
key
},
success
:
function
()
{
// fetch the
user prefere
nces again.
self
.
collection
.
url
=
self
.
notification_preferences_all
;
self
.
render
();
// fetch the
allowa
nces again.
self
.
collection
.
url
=
self
.
allowance_url
+
'/'
+
self
.
course_id
;
self
.
hydrate
();
}
}
);
...
...
@@ -97,12 +108,11 @@ var edx = edx || {};
/* we might - at some point - add a visual element to the */
/* loading, like a spinner */
var
self
=
this
;
self
.
collection
.
fetch
(
).
done
(
function
()
{
self
.
collection
.
fetch
(
{
success
:
function
()
{
self
.
render
();
}).
fail
(
function
(){
console
.
log
(
'fail'
);
});
}
});
},
collectionChanged
:
function
()
{
this
.
hydrate
();
...
...
edx_proctoring/static/proctoring/templates/
add-allowance
.underscore
→
edx_proctoring/static/proctoring/templates/
course_allowances
.underscore
View file @
91ac771f
...
...
@@ -3,26 +3,34 @@
<a id="add-allowance" href="#" class="add blue-button">+ <%- gettext("Add Allowance") %></a>
</span>
</span>
<% var is_allowances = proctored_exam_allowances.length !== 0 %>
<% if (is_allowances) { %>
<div class="wrapper-content wrapper">
<section class="content">
<table class="allowance-table">
<thead>
<tr class="allowance-headings">
<th class="exam-name">
Exam Name
</th>
<th class="username">
Username
</th>
<th class="email">
Email
</th>
<th class="allowance-name">
Allowance Name
</th>
<th class="allowance-value">
Allowance Value
</th>
<th class="c_action">
Actions
</th>
<th class="exam-name">
<%- gettext("Exam Name") %>
</th>
<th class="username">
<%- gettext("Username") %>
</th>
<th class="email">
<%- gettext("Email") %>
</th>
<th class="allowance-name">
<%- gettext("Allowance Name") %>
</th>
<th class="allowance-value">
<%- gettext("Allowance Value") %>
</th>
<th class="c_action">
<%- gettext("Actions") %>
</th>
</tr>
</thead>
<tbody>
<% _.each(proctored_exam_allowances, function(proctored_exam_allowance){ %>
<tr class="allowance-items">
<td><%= proctored_exam_allowance.proctored_exam.exam_name %></td>
<td>
<%- interpolate(gettext(' %(exam_display_name)s '), { exam_display_name: proctored_exam_allowance.proctored_exam.exam_name }, true) %>
</td>
<td> Dummy Username </td>
<td>muhammad.shoaib@gmail.com</td>
<td><%= proctored_exam_allowance.key %></td>
<td>
<%- interpolate(gettext(' %(allowance_name)s '), { allowance_name: proctored_exam_allowance.key }, true) %>
</td>
<td><%= proctored_exam_allowance.value %></td>
<td>
<a data-exam-id="<%= proctored_exam_allowance.proctored_exam.id %>"
...
...
@@ -32,10 +40,10 @@
</td>
</tr>
<% }); %>
</tbody>
</table>
</section>
</div>
<% } %>
edx_proctoring/views.py
View file @
91ac771f
...
...
@@ -358,7 +358,7 @@ class ExamAllowanceView(AuthenticatedAPIView):
**Response Values**
* returns Nothing. deletes the allowance for the user proctored exam.
"""
#
@method_decorator(require_staff)
@method_decorator
(
require_staff
)
def
get
(
self
,
request
,
course_id
):
# pylint: disable=unused-argument
"""
HTTP GET handler. Get all allowances for a course.
...
...
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