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
ffce323b
Commit
ffce323b
authored
Apr 15, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #275 from edx/will/jsi18n
Extract JavaScript i18n strings
parents
0dff7333
a67835d7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
64 additions
and
22 deletions
+64
-22
apps/openassessment/xblock/static/js/openassessment.min.js
+0
-0
apps/openassessment/xblock/static/js/src/oa_base.js
+7
-1
apps/openassessment/xblock/static/js/src/oa_edit.js
+5
-1
apps/openassessment/xblock/static/js/src/oa_grade.js
+6
-0
apps/openassessment/xblock/static/js/src/oa_response.js
+12
-5
apps/openassessment/xblock/static/js/src/oa_server.js
+24
-14
requirements/base.txt
+1
-1
urls.py
+9
-0
No files found.
apps/openassessment/xblock/static/js/openassessment.min.js
View file @
ffce323b
This diff is collapsed.
Click to expand it.
apps/openassessment/xblock/static/js/src/oa_base.js
View file @
ffce323b
...
...
@@ -6,6 +6,12 @@ if (typeof OpenAssessment == "undefined" || !OpenAssessment) {
}
// Stub gettext if the runtime doesn't provide it
if
(
typeof
window
.
gettext
===
'undefined'
)
{
window
.
gettext
=
function
(
text
)
{
return
text
;
};
}
/**
Interface for student-facing views.
...
...
@@ -337,7 +343,7 @@ OpenAssessment.BaseView.prototype = {
var
container
=
'#openassessment__'
+
step
;
$
(
container
).
toggleClass
(
'has--error'
,
true
);
$
(
container
+
' .step__status__value i'
).
removeClass
().
addClass
(
'ico icon-warning-sign'
);
$
(
container
+
' .step__status__value .copy'
).
html
(
'Unable to Load'
);
$
(
container
+
' .step__status__value .copy'
).
html
(
gettext
(
'Unable to Load'
)
);
},
/**
...
...
apps/openassessment/xblock/static/js/src/oa_edit.js
View file @
ffce323b
...
...
@@ -6,6 +6,10 @@ if (typeof OpenAssessment == "undefined" || !OpenAssessment) {
OpenAssessment
=
{};
}
// Stub gettext if the runtime doesn't provide it
if
(
typeof
window
.
gettext
===
'undefined'
)
{
window
.
gettext
=
function
(
text
)
{
return
text
;
};
}
/**
Interface for editing view in Studio.
...
...
@@ -87,7 +91,7 @@ OpenAssessment.StudioView.prototype = {
executed if the user confirms the update.
**/
confirmPostReleaseUpdate
:
function
(
onConfirm
)
{
var
msg
=
"This problem has already been released. Any changes will apply only to future assessments."
;
var
msg
=
gettext
(
"This problem has already been released. Any changes will apply only to future assessments."
)
;
// TODO: classier confirm dialog
if
(
confirm
(
msg
))
{
onConfirm
();
}
},
...
...
apps/openassessment/xblock/static/js/src/oa_grade.js
View file @
ffce323b
...
...
@@ -6,6 +6,12 @@ if (typeof OpenAssessment == "undefined" || !OpenAssessment) {
}
// Stub gettext if the runtime doesn't provide it
if
(
typeof
window
.
gettext
===
'undefined'
)
{
window
.
gettext
=
function
(
text
)
{
return
text
;
};
}
/**
Interface for grade view.
...
...
apps/openassessment/xblock/static/js/src/oa_response.js
View file @
ffce323b
...
...
@@ -6,6 +6,12 @@ if (typeof OpenAssessment == "undefined" || !OpenAssessment) {
}
// Stub gettext if the runtime doesn't provide it
if
(
typeof
window
.
gettext
===
'undefined'
)
{
window
.
gettext
=
function
(
text
)
{
return
text
;
};
}
/**
Interface for response (submission) view.
...
...
@@ -141,7 +147,8 @@ OpenAssessment.ResponseView.prototype = {
}
else
{
// Setting the HTML will overwrite the screen reader tag,
// so prepend it to the message.
sel
.
html
(
'<span class="sr">Status of Your Response:</span>
\
n'
+
msg
);
var
label
=
gettext
(
"Status of Your Response"
);
sel
.
html
(
'<span class="sr">'
+
label
+
':'
+
'</span>
\
n'
+
msg
);
}
},
...
...
@@ -177,7 +184,7 @@ OpenAssessment.ResponseView.prototype = {
// Update the save button and status only if the response has changed
if
(
$
.
trim
(
this
.
savedResponse
)
!==
currentResponse
)
{
this
.
saveEnabled
(
isBlank
);
this
.
saveStatus
(
'This response has not been saved.'
);
this
.
saveStatus
(
gettext
(
'This response has not been saved.'
)
);
}
},
...
...
@@ -186,7 +193,7 @@ OpenAssessment.ResponseView.prototype = {
**/
save
:
function
()
{
// Update the save status and error notifications
this
.
saveStatus
(
'Saving...'
);
this
.
saveStatus
(
gettext
(
'Saving...'
)
);
this
.
baseView
.
toggleActionError
(
'save'
,
null
);
var
view
=
this
;
...
...
@@ -201,10 +208,10 @@ OpenAssessment.ResponseView.prototype = {
view
.
submitEnabled
(
currentResponse
!==
''
);
if
(
currentResponse
==
savedResponse
)
{
view
.
saveEnabled
(
false
);
view
.
saveStatus
(
"This response has been saved but not submitted."
);
view
.
saveStatus
(
gettext
(
"This response has been saved but not submitted."
)
);
}
}).
fail
(
function
(
errMsg
)
{
view
.
saveStatus
(
'Error'
);
view
.
saveStatus
(
gettext
(
'Error'
)
);
view
.
baseView
.
toggleActionError
(
'save'
,
errMsg
);
});
},
...
...
apps/openassessment/xblock/static/js/src/oa_server.js
View file @
ffce323b
...
...
@@ -6,6 +6,12 @@ if (typeof OpenAssessment == "undefined" || !OpenAssessment) {
}
// Stub gettext if the runtime doesn't provide it
if
(
typeof
window
.
gettext
===
'undefined'
)
{
window
.
gettext
=
function
(
text
)
{
return
text
;
};
}
/**
Interface for server-side XBlock handlers.
...
...
@@ -69,7 +75,7 @@ OpenAssessment.Server.prototype = {
}).
done
(
function
(
data
)
{
defer
.
resolveWith
(
this
,
[
data
]);
}).
fail
(
function
(
data
)
{
defer
.
rejectWith
(
this
,
[
'This section could not be loaded.'
]);
defer
.
rejectWith
(
this
,
[
gettext
(
'This section could not be loaded.'
)
]);
});
}).
promise
();
},
...
...
@@ -100,7 +106,7 @@ OpenAssessment.Server.prototype = {
}).
done
(
function
(
data
)
{
defer
.
resolveWith
(
this
,
[
data
]);
}).
fail
(
function
(
data
)
{
defer
.
rejectWith
(
this
,
[
'This section could not be loaded.'
]);
defer
.
rejectWith
(
this
,
[
gettext
(
'This section could not be loaded.'
)
]);
});
}).
promise
();
},
...
...
@@ -119,7 +125,8 @@ OpenAssessment.Server.prototype = {
var
url
=
this
.
url
(
'submit'
);
if
(
submission
.
length
>
this
.
maxInputSize
)
{
return
$
.
Deferred
(
function
(
defer
)
{
defer
.
rejectWith
(
this
,
[
"submit"
,
"This response is too long. Please shorten the response and try to submit it again."
]);
var
errorMsg
=
gettext
(
"This response is too long. Please shorten the response and try to submit it again."
);
defer
.
rejectWith
(
this
,
[
"submit"
,
errorMsg
]);
}).
promise
();
}
return
$
.
Deferred
(
function
(
defer
)
{
...
...
@@ -140,7 +147,7 @@ OpenAssessment.Server.prototype = {
defer
.
rejectWith
(
this
,
[
errorNum
,
errorMsg
]);
}
}).
fail
(
function
(
data
)
{
defer
.
rejectWith
(
this
,
[
"AJAX"
,
"This response could not be submitted."
]);
defer
.
rejectWith
(
this
,
[
"AJAX"
,
gettext
(
"This response could not be submitted."
)
]);
});
}).
promise
();
},
...
...
@@ -159,7 +166,8 @@ OpenAssessment.Server.prototype = {
var
url
=
this
.
url
(
'save_submission'
);
if
(
submission
.
length
>
this
.
maxInputSize
)
{
return
$
.
Deferred
(
function
(
defer
)
{
defer
.
rejectWith
(
this
,
[
"This response is too long. Please shorten the response and try to save it again."
]);
var
errorMsg
=
gettext
(
"This response is too long. Please shorten the response and try to save it again."
);
defer
.
rejectWith
(
this
,
[
errorMsg
]);
}).
promise
();
}
return
$
.
Deferred
(
function
(
defer
)
{
...
...
@@ -171,7 +179,7 @@ OpenAssessment.Server.prototype = {
if
(
data
.
success
)
{
defer
.
resolve
();
}
else
{
defer
.
rejectWith
(
this
,
[
data
.
msg
]);
}
}).
fail
(
function
(
data
)
{
defer
.
rejectWith
(
this
,
[
"This response could not be saved."
]);
defer
.
rejectWith
(
this
,
[
gettext
(
"This response could not be saved."
)
]);
});
}).
promise
();
},
...
...
@@ -199,7 +207,8 @@ OpenAssessment.Server.prototype = {
var
url
=
this
.
url
(
'submit_feedback'
);
if
(
text
.
length
>
this
.
maxInputSize
)
{
return
$
.
Deferred
(
function
(
defer
)
{
defer
.
rejectWith
(
this
,
[
"This feedback is too long. Please shorten your feedback and try to submit it again."
]);
var
errorMsg
=
gettext
(
"This feedback is too long. Please shorten your feedback and try to submit it again."
);
defer
.
rejectWith
(
this
,
[
errorMsg
]);
}).
promise
();
}
var
payload
=
JSON
.
stringify
({
...
...
@@ -213,7 +222,7 @@ OpenAssessment.Server.prototype = {
else
{
defer
.
rejectWith
(
this
,
[
data
.
msg
]);
}
}
).
fail
(
function
(
data
)
{
defer
.
rejectWith
(
this
,
[
'This feedback could not be submitted.'
]);
defer
.
rejectWith
(
this
,
[
gettext
(
'This feedback could not be submitted.'
)
]);
});
}).
promise
();
},
...
...
@@ -242,7 +251,8 @@ OpenAssessment.Server.prototype = {
var
url
=
this
.
url
(
'peer_assess'
);
if
(
feedback
.
length
>
this
.
maxInputSize
)
{
return
$
.
Deferred
(
function
(
defer
)
{
defer
.
rejectWith
(
this
,
[
"The comments on this assessment are too long. Please shorten your comments and try to submit them again."
]);
var
errorMsg
=
gettext
(
"The comments on this assessment are too long. Please shorten your comments and try to submit them again."
);
defer
.
rejectWith
(
this
,
[
errorMsg
]);
}).
promise
();
}
var
payload
=
JSON
.
stringify
({
...
...
@@ -260,7 +270,7 @@ OpenAssessment.Server.prototype = {
}
}
).
fail
(
function
(
data
)
{
defer
.
rejectWith
(
this
,
[
'This assessment could not be submitted.'
]);
defer
.
rejectWith
(
this
,
[
gettext
(
'This assessment could not be submitted.'
)
]);
});
}).
promise
();
},
...
...
@@ -300,7 +310,7 @@ OpenAssessment.Server.prototype = {
}
}
).
fail
(
function
(
data
)
{
defer
.
rejectWith
(
this
,
[
'This assessment could not be submitted.'
]);
defer
.
rejectWith
(
this
,
[
gettext
(
'This assessment could not be submitted.'
)
]);
});
});
},
...
...
@@ -328,7 +338,7 @@ OpenAssessment.Server.prototype = {
if
(
data
.
success
)
{
defer
.
resolveWith
(
this
,
[
data
.
xml
]);
}
else
{
defer
.
rejectWith
(
this
,
[
data
.
msg
]);
}
}).
fail
(
function
(
data
)
{
defer
.
rejectWith
(
this
,
[
'This problem could not be loaded.'
]);
defer
.
rejectWith
(
this
,
[
gettext
(
'This problem could not be loaded.'
)
]);
});
}).
promise
();
},
...
...
@@ -357,7 +367,7 @@ OpenAssessment.Server.prototype = {
if
(
data
.
success
)
{
defer
.
resolve
();
}
else
{
defer
.
rejectWith
(
this
,
[
data
.
msg
]);
}
}).
fail
(
function
(
data
)
{
defer
.
rejectWith
(
this
,
[
'This problem could not be saved.'
]);
defer
.
rejectWith
(
this
,
[
gettext
(
'This problem could not be saved.'
)
]);
});
}).
promise
();
},
...
...
@@ -387,7 +397,7 @@ OpenAssessment.Server.prototype = {
if
(
data
.
success
)
{
defer
.
resolveWith
(
this
,
[
data
.
is_released
]);
}
else
{
defer
.
rejectWith
(
this
,
[
data
.
msg
]);
}
}).
fail
(
function
(
data
)
{
defer
.
rejectWith
(
this
,
[
"The server could not be contacted."
]);
defer
.
rejectWith
(
this
,
[
gettext
(
"The server could not be contacted."
)
]);
});
}).
promise
();
}
...
...
requirements/base.txt
View file @
ffce323b
# edX Internal Requirements
git+https://github.com/edx/XBlock.git@3b6e4218bd326f84dbeb0baed7b2b7813ffea3dd#egg=XBlock
git+https://github.com/edx/xblock-sdk.git@
50ed1646d24f6f0a21d6d0bb074e3b7c8a78fd5a
#egg=xblock-sdk
git+https://github.com/edx/xblock-sdk.git@
4b312de38c037fda31c003e02240e3bd2f6a4628
#egg=xblock-sdk
# Third Party Requirements
defusedxml==0.4.1
...
...
urls.py
View file @
ffce323b
from
django.conf
import
settings
from
django.conf.urls
import
include
,
patterns
,
url
from
django.views.i18n
import
javascript_catalog
from
django.contrib
import
admin
import
openassessment.assessment.urls
...
...
@@ -8,6 +9,11 @@ import workbench.urls
admin
.
autodiscover
()
# Packages to include in the JavaScript i18n strings
JS_INFO_DICT
=
{
'packages'
:
(
'openassessment.xblock'
,),
}
urlpatterns
=
patterns
(
''
,
# Django built-in
...
...
@@ -19,6 +25,9 @@ urlpatterns = patterns(
# edx-ora2 apps
url
(
r'^submissions/'
,
include
(
submissions
.
urls
)),
url
(
r'^peer/evaluations/'
,
include
(
openassessment
.
assessment
.
urls
)),
# JavaScript i18n
(
r'^jsi18n/$'
,
'django.views.i18n.javascript_catalog'
,
JS_INFO_DICT
),
)
# We need to do explicit setup of the Django debug toolbar because autodiscovery
...
...
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