Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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
edx
edx-ora2
Commits
10df7db7
Commit
10df7db7
authored
May 23, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #359 from edx/will/TIM-588
Bugfix: TIM-588
parents
0ad5906e
632ac0a8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
169 additions
and
14 deletions
+169
-14
apps/openassessment/templates/openassessmentblock/oa_base.html
+1
-1
apps/openassessment/xblock/openassessmentblock.py
+1
-1
apps/openassessment/xblock/static/js/fixtures/templates.json
+68
-0
apps/openassessment/xblock/static/js/openassessment.min.js
+0
-0
apps/openassessment/xblock/static/js/spec/oa_staff_info.js
+76
-0
apps/openassessment/xblock/static/js/src/oa_staff_info.js
+15
-9
apps/openassessment/xblock/test/test_staff_info.py
+8
-3
No files found.
apps/openassessment/templates/openassessmentblock/oa_base.html
View file @
10df7db7
...
...
@@ -67,7 +67,7 @@
{% endfor %}
</ol>
{% if
is_course_staff
%}
{% if
show_staff_debug_info
%}
<div
id=
"openassessment__staff-info"
></div>
{% endif %}
</div>
...
...
apps/openassessment/xblock/openassessmentblock.py
View file @
10df7db7
...
...
@@ -227,7 +227,7 @@ class OpenAssessmentBlock(
"question"
:
self
.
prompt
,
"rubric_criteria"
:
self
.
rubric_criteria
,
"rubric_assessments"
:
ui_models
,
"
is_course_staff"
:
self
.
is_course_staff
,
"
show_staff_debug_info"
:
self
.
is_course_staff
and
not
self
.
in_studio_preview
,
}
template
=
get_template
(
"openassessmentblock/oa_base.html"
)
...
...
apps/openassessment/xblock/static/js/fixtures/templates.json
View file @
10df7db7
...
...
@@ -2,6 +2,7 @@
{
"template"
:
"openassessmentblock/oa_base.html"
,
"context"
:
{
"show_staff_debug_info"
:
false
,
"title"
:
"Test title"
,
"question"
:
"Test prompt"
,
"rubric_criteria"
:
[],
...
...
@@ -35,6 +36,42 @@
"output"
:
"oa_base.html"
},
{
"template"
:
"openassessmentblock/oa_base.html"
,
"context"
:
{
"show_staff_debug_info"
:
true
,
"title"
:
"Test title"
,
"question"
:
"Test prompt"
,
"rubric_criteria"
:
[],
"rubric_assessments"
:
[
{
"name"
:
"submission"
,
"class_id"
:
"openassessment__response"
,
"navigation_text"
:
"Your response to this problem"
,
"title"
:
"Your Response"
},
{
"name"
:
"peer-assessment"
,
"class_id"
:
"openassessment__peer-assessment"
,
"navigation_text"
:
"Your assessment(s) of peer responses"
,
"title"
:
"Assess Peers' Responses"
},
{
"name"
:
"self-assessment"
,
"class_id"
:
"openassessment__self-assessment"
,
"navigation_text"
:
"Your assessment of your response"
,
"title"
:
"Assess Your Response"
},
{
"name"
:
"grade"
,
"class_id"
:
"openassessment__grade"
,
"navigation_text"
:
"Your grade for this problem"
,
"title"
:
"Your Grade:"
}
]
},
"output"
:
"oa_base_course_staff.html"
},
{
"template"
:
"openassessmentblock/response/oa_response.html"
,
"context"
:
{
"saved_response"
:
""
,
...
...
@@ -345,5 +382,36 @@
"template"
:
"openassessmentblock/oa_edit.html"
,
"context"
:
{},
"output"
:
"oa_edit.html"
},
{
"template"
:
"openassessmentblock/staff_debug/staff_debug.html"
,
"context"
:
{
"status_counts"
:
{
"self"
:
1
,
"peer"
:
2
,
"waiting"
:
3
,
"done"
:
4
},
"num_submissions"
:
10
,
"item_id"
:
"test_item"
,
"step_dates"
:
[
{
"step"
:
"submission"
,
"start"
:
"2014-01-01"
,
"due"
:
"N/A"
},
{
"step"
:
"peer"
,
"start"
:
"2014-02-02"
,
"due"
:
"N/A"
},
{
"step"
:
"self"
,
"start"
:
"2014-03-03"
,
"due"
:
"2015-04-05"
}
]
},
"output"
:
"oa_staff_info.html"
}
]
apps/openassessment/xblock/static/js/openassessment.min.js
View file @
10df7db7
This diff is collapsed.
Click to expand it.
apps/openassessment/xblock/static/js/spec/oa_staff_info.js
0 → 100644
View file @
10df7db7
/**
Tests for staff info.
**/
describe
(
"OpenAssessment.StaffInfoView"
,
function
()
{
// Stub server that returns dummy data for the staff info view
var
StubServer
=
function
()
{
// Remember which fragments have been loaded
this
.
fragmentsLoaded
=
[];
// Render the template for the staff info view
this
.
render
=
function
(
component
)
{
var
server
=
this
;
this
.
fragmentsLoaded
.
push
(
component
);
return
$
.
Deferred
(
function
(
defer
)
{
fragment
=
readFixtures
(
"oa_staff_info.html"
);
defer
.
resolveWith
(
this
,
[
fragment
]);
});
};
};
// Stub base view
var
StubBaseView
=
function
()
{
this
.
showLoadError
=
function
(
msg
)
{};
this
.
toggleActionError
=
function
(
msg
,
step
)
{};
this
.
setUpCollapseExpand
=
function
(
sel
)
{};
this
.
scrollToTop
=
function
()
{};
this
.
loadAssessmentModules
=
function
()
{};
this
.
loadMessageView
=
function
()
{};
};
// Stubs
var
baseView
=
null
;
var
server
=
null
;
/**
Initialize the staff info view, then check whether it makes
an AJAX call to load the staff info section.
**/
var
assertStaffInfoAjaxCall
=
function
(
shouldCall
)
{
// Load the staff info view
var
el
=
$
(
"#openassessment-base"
).
get
(
0
);
var
view
=
new
OpenAssessment
.
StaffInfoView
(
el
,
server
,
baseView
);
view
.
load
();
// Check whether it tried to load staff info from the server
var
expectedFragments
=
[];
if
(
shouldCall
)
{
expectedFragments
=
[
'staff_info'
];
}
expect
(
server
.
fragmentsLoaded
).
toEqual
(
expectedFragments
);
};
beforeEach
(
function
()
{
// Configure the Jasmine fixtures path
jasmine
.
getFixtures
().
fixturesPath
=
'base/fixtures'
;
// Create a new stub server
server
=
new
StubServer
();
// Create the stub base view
baseView
=
new
StubBaseView
();
});
it
(
"Loads staff info if the page contains a course staff section"
,
function
()
{
// Load the fixture for the container page that DOES include a course staff section
loadFixtures
(
'oa_base_course_staff.html'
);
assertStaffInfoAjaxCall
(
true
);
});
it
(
"Does NOT load staff info if the page does NOT contain a course staff section"
,
function
()
{
// Load the fixture for the container page that does NOT include a course staff section
loadFixtures
(
'oa_base.html'
);
assertStaffInfoAjaxCall
(
false
);
});
});
apps/openassessment/xblock/static/js/src/oa_staff_info.js
View file @
10df7db7
...
...
@@ -23,15 +23,21 @@ OpenAssessment.StaffInfoView.prototype = {
**/
load
:
function
()
{
var
view
=
this
;
this
.
server
.
render
(
'staff_info'
).
done
(
function
(
html
)
{
// Load the HTML and install event handlers
$
(
'#openassessment__staff-info'
,
view
.
element
).
replaceWith
(
html
);
view
.
installHandlers
();
}
).
fail
(
function
(
errMsg
)
{
view
.
baseView
.
showLoadError
(
'staff_info'
);
});
// If we're course staff, the base template should contain a section
// for us to render the staff info to. If that doesn't exist,
// then we're not staff, so we don't need to send the AJAX request.
if
(
$
(
'#openassessment__staff-info'
,
view
.
element
).
length
>
0
)
{
this
.
server
.
render
(
'staff_info'
).
done
(
function
(
html
)
{
// Load the HTML and install event handlers
$
(
'#openassessment__staff-info'
,
view
.
element
).
replaceWith
(
html
);
view
.
installHandlers
();
}
).
fail
(
function
(
errMsg
)
{
view
.
baseView
.
showLoadError
(
'staff_info'
);
});
}
},
/**
...
...
apps/openassessment/xblock/test/test_staff_info.py
View file @
10df7db7
...
...
@@ -74,7 +74,6 @@ class TestCourseStaff(XBlockHandlerTestCase):
resp
=
self
.
request
(
xblock
,
'render_student_info'
,
json
.
dumps
({}))
self
.
assertIn
(
"couldn
\'
t find a response for this student."
,
resp
.
decode
(
'utf-8'
)
.
lower
())
@scenario
(
'data/basic_scenario.xml'
)
def
test_hide_course_staff_debug_info_in_studio_preview
(
self
,
xblock
):
# If we are in Studio preview mode, don't show the staff debug info
...
...
@@ -83,8 +82,15 @@ class TestCourseStaff(XBlockHandlerTestCase):
xblock
.
xmodule_runtime
=
self
.
_create_mock_runtime
(
xblock
.
scope_ids
.
usage_id
,
True
,
"Bob"
)
# If the client requests the staff info directly, they should get an error
resp
=
self
.
request
(
xblock
,
'render_staff_info'
,
json
.
dumps
({}))
self
.
assertNotIn
(
"course staff information"
,
resp
.
decode
(
'utf-8'
)
.
lower
())
self
.
assertIn
(
"do not have permission"
,
resp
.
decode
(
'utf-8'
)
.
lower
())
# The container page should not contain a staff info section at all
xblock_fragment
=
self
.
runtime
.
render
(
xblock
,
'student_view'
)
self
.
assertNotIn
(
u'staff-info'
,
xblock_fragment
.
body_html
())
@scenario
(
'data/staff_dates_scenario.xml'
,
user_id
=
'Bob'
)
def
test_staff_debug_dates_table
(
self
,
xblock
):
...
...
@@ -258,4 +264,4 @@ class TestCourseStaff(XBlockHandlerTestCase):
get_anonymous_student_id
=
lambda
user_id
,
course_id
:
anonymous_user_id
)
)
return
mock_runtime
\ No newline at end of file
return
mock_runtime
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