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
1d7424ed
Commit
1d7424ed
authored
Jul 29, 2014
by
gradyward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes the translation of the Option Points display in Student Training Examples Authoring
parent
feb155b0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
24 deletions
+59
-24
openassessment/templates/openassessmentblock/edit/oa_training_example_criterion.html
+2
-6
openassessment/xblock/static/js/openassessment-lms.min.js
+0
-0
openassessment/xblock/static/js/openassessment-studio.min.js
+0
-0
openassessment/xblock/static/js/src/oa_shared.js
+13
-0
openassessment/xblock/static/js/src/studio/oa_container_item.js
+33
-0
openassessment/xblock/static/js/src/studio/oa_edit_listeners.js
+11
-18
No files found.
openassessment/templates/openassessmentblock/edit/oa_training_example_criterion.html
View file @
1d7424ed
...
...
@@ -9,14 +9,10 @@
<select
class=
"openassessment_training_example_criterion_option setting-input"
data-criterion=
"{{ criterion.name }}"
data-option=
"{{ option.name }}"
>
<option
value=
""
>
{% trans "Not Scored" %}
</option>
{% for option in criterion.options %}
<option
value=
{{
option
.
name
}}
<option
value=
{{
option
.
name
}}
data-points=
{{
option
.
points
}}
data-label=
{{
option
.
label
}}
{%
if
criterion
.
option_selected =
=
option
.
name
%}
selected
{%
endif
%}
>
{% if option.points == 1 %}
{{ option.label }} - {{ option.points }} {% trans "point" %}
{% else %}
{{ option.label }} - {{ option.points }} {% trans "points" %}
{% endif %}
{{ option.label }} - {{ option.points }} {% trans "points" %}
</option>
{% endfor %}
</select>
...
...
openassessment/xblock/static/js/openassessment-lms.min.js
View file @
1d7424ed
This diff is collapsed.
Click to expand it.
openassessment/xblock/static/js/openassessment-studio.min.js
View file @
1d7424ed
This diff is collapsed.
Click to expand it.
openassessment/xblock/static/js/src/oa_shared.js
View file @
1d7424ed
...
...
@@ -17,3 +17,15 @@ if (typeof OpenAssessment == "undefined" || !OpenAssessment) {
if
(
typeof
window
.
gettext
===
'undefined'
)
{
window
.
gettext
=
function
(
text
)
{
return
text
;
};
}
// If ngettext isn't found (workbench, testing, etc.), return the simplistic english version
if
(
typeof
window
.
ngetgext
===
'undefined'
)
{
window
.
ngettext
=
function
(
singular_text
,
plural_text
,
n
)
{
if
(
n
>
1
){
return
plural_text
;
}
else
{
return
singular_text
;
}
}
}
\ No newline at end of file
openassessment/xblock/static/js/src/studio/oa_container_item.js
View file @
1d7424ed
...
...
@@ -21,6 +21,33 @@ OpenAssessment.ItemUtilities = {
index
++
;
}
return
index
.
toString
();
},
/**
Format the option label, including the point value, and add it to the option.
Relies on the data-points and data-label attributes to provide information about the option.
Args:
element (Jquery Element): The element that represents the object.
**/
refreshOptionString
:
function
(
element
)
{
var
points
=
$
(
element
).
data
(
'points'
);
var
label
=
$
(
element
).
data
(
'label'
);
var
singular_string
=
label
+
" - "
+
points
+
" point"
;
var
multiple_string
=
label
+
" - "
+
points
+
" points"
;
// If the option doesn't have a data points value, that indicates to us that it is not a user-specified option,
// but represents the "Not Selected" option which all criterion drop-downs have.
if
(
typeof
(
points
)
===
'undefined'
){
$
(
element
).
text
(
gettext
(
'Not Selected'
)
);
}
// Otherwise, set the text of the option element to be the properly conjugated, translated string.
else
{
$
(
element
).
text
(
ngettext
(
singular_string
,
multiple_string
,
points
)
);
}
}
};
...
...
@@ -281,6 +308,12 @@ OpenAssessment.RubricCriterion.prototype = {
**/
OpenAssessment
.
TrainingExample
=
function
(
element
){
this
.
element
=
element
;
// Goes through and instantiates the option description in the training example for each option.
$
(
".openassessment_training_example_criterion_option"
,
this
.
element
)
.
each
(
function
()
{
$
(
'option'
,
this
).
each
(
function
(){
OpenAssessment
.
ItemUtilities
.
refreshOptionString
(
$
(
this
));
});
});
};
OpenAssessment
.
TrainingExample
.
prototype
=
{
...
...
openassessment/xblock/static/js/src/studio/oa_edit_listeners.js
View file @
1d7424ed
...
...
@@ -25,8 +25,10 @@ OpenAssessment.StudentTrainingListener.prototype = {
$
(
sel
,
this
.
element
).
each
(
function
()
{
var
criterion
=
this
;
var
option
=
$
(
'option[value="'
+
data
.
name
+
'"]'
,
criterion
);
$
(
option
).
text
(
view
.
_generateOptionString
(
data
.
label
,
data
.
points
));
var
option
=
$
(
'option[value="'
+
data
.
name
+
'"]'
,
criterion
)
.
data
(
"points"
,
data
.
points
)
.
data
(
"label"
,
data
.
label
);
OpenAssessment
.
ItemUtilities
.
refreshOptionString
(
option
);
}
);
},
...
...
@@ -64,9 +66,14 @@ OpenAssessment.StudentTrainingListener.prototype = {
// Risky; making an assumption that options will remain simple.
// updates could cause this to get out of sync with templates,
// but this avoids overly complex templating code.
$
(
criterion
).
append
(
$
(
"<option></option>"
)
var
option
=
$
(
"<option></option>"
)
.
attr
(
"value"
,
data
.
name
)
.
text
(
view
.
_generateOptionString
(
data
.
label
,
data
.
points
)));
.
data
(
"points"
,
data
.
points
)
.
data
(
"label"
,
data
.
label
);
// Sets the option's text description, and ads it to the criterion.
OpenAssessment
.
ItemUtilities
.
refreshOptionString
(
option
);
$
(
criterion
).
append
(
option
);
examplesUpdated
=
true
;
}
});
...
...
@@ -328,19 +335,5 @@ OpenAssessment.StudentTrainingListener.prototype = {
}
);
return
examples
;
},
/**
Format the option label, including the point value.
Args:
name (string): The option label (e.g. "Good", "Fair").
points (int): The number of points that the option is worth.
Returns:
string
**/
_generateOptionString
:
function
(
name
,
points
)
{
return
name
+
' - '
+
points
+
gettext
(
' points'
);
}
};
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