Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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-platform
Commits
a8e3bca8
Commit
a8e3bca8
authored
Jan 14, 2014
by
Greg Price
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Internationalize forums CoffeeScript code
parent
a1dc49cc
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
66 additions
and
50 deletions
+66
-50
common/static/coffee/spec/discussion/view/discussion_view_spec_helper.coffee
+2
-4
common/static/coffee/src/discussion/discussion_module_view.coffee
+7
-7
common/static/coffee/src/discussion/utils.coffee
+5
-6
common/static/coffee/src/discussion/views/discussion_content_view.coffee
+22
-5
common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+7
-7
common/static/coffee/src/discussion/views/discussion_thread_show_view.coffee
+5
-5
common/static/coffee/src/discussion/views/discussion_thread_view.coffee
+1
-1
common/static/coffee/src/discussion/views/new_post_view.coffee
+3
-3
common/static/coffee/src/discussion/views/response_comment_show_view.coffee
+6
-6
common/static/coffee/src/discussion/views/thread_response_show_view.coffee
+4
-4
common/static/coffee/src/discussion/views/thread_response_view.coffee
+1
-1
common/static/js/test/i18n.js
+2
-1
common/static/js_test.yml
+1
-0
No files found.
common/static/coffee/spec/discussion/view/discussion_view_spec_helper.coffee
View file @
a8e3bca8
...
@@ -5,14 +5,12 @@ class @DiscussionViewSpecHelper
...
@@ -5,14 +5,12 @@ class @DiscussionViewSpecHelper
expect
(
button
.
hasClass
(
"is-cast"
)).
toBe
(
true
)
expect
(
button
.
hasClass
(
"is-cast"
)).
toBe
(
true
)
expect
(
button
.
attr
(
"aria-pressed"
)).
toEqual
(
"true"
)
expect
(
button
.
attr
(
"aria-pressed"
)).
toEqual
(
"true"
)
expect
(
button
.
attr
(
"data-tooltip"
)).
toEqual
(
"remove vote"
)
expect
(
button
.
attr
(
"data-tooltip"
)).
toEqual
(
"remove vote"
)
expect
(
button
.
find
(
".votes-count-number"
).
html
()).
toEqual
(
"43"
)
expect
(
button
.
text
()).
toEqual
(
"43 votes (click to remove your vote)"
)
expect
(
button
.
find
(
".sr"
).
html
()).
toEqual
(
"votes (click to remove your vote)"
)
else
else
expect
(
button
.
hasClass
(
"is-cast"
)).
toBe
(
false
)
expect
(
button
.
hasClass
(
"is-cast"
)).
toBe
(
false
)
expect
(
button
.
attr
(
"aria-pressed"
)).
toEqual
(
"false"
)
expect
(
button
.
attr
(
"aria-pressed"
)).
toEqual
(
"false"
)
expect
(
button
.
attr
(
"data-tooltip"
)).
toEqual
(
"vote"
)
expect
(
button
.
attr
(
"data-tooltip"
)).
toEqual
(
"vote"
)
expect
(
button
.
find
(
".votes-count-number"
).
html
()).
toEqual
(
"42"
)
expect
(
button
.
text
()).
toEqual
(
"42 votes (click to vote)"
)
expect
(
button
.
find
(
".sr"
).
html
()).
toEqual
(
"votes (click to vote)"
)
@
checkRenderVote
=
(
view
,
model
)
->
@
checkRenderVote
=
(
view
,
model
)
->
view
.
renderVote
()
view
.
renderVote
()
...
...
common/static/coffee/src/discussion/discussion_module_view.coffee
View file @
a8e3bca8
...
@@ -30,7 +30,7 @@ if Backbone?
...
@@ -30,7 +30,7 @@ if Backbone?
else
else
@
newPostForm
.
show
()
@
newPostForm
.
show
()
@
toggleDiscussionBtn
.
addClass
(
'shown'
)
@
toggleDiscussionBtn
.
addClass
(
'shown'
)
@
toggleDiscussionBtn
.
find
(
'.button-text'
).
html
(
"Hide Discussion"
)
@
toggleDiscussionBtn
.
find
(
'.button-text'
).
html
(
gettext
(
"Hide Discussion"
)
)
@
$
(
"section.discussion"
).
slideDown
()
@
$
(
"section.discussion"
).
slideDown
()
@
showed
=
true
@
showed
=
true
...
@@ -41,7 +41,7 @@ if Backbone?
...
@@ -41,7 +41,7 @@ if Backbone?
hideDiscussion
:
->
hideDiscussion
:
->
@
$
(
"section.discussion"
).
slideUp
()
@
$
(
"section.discussion"
).
slideUp
()
@
toggleDiscussionBtn
.
removeClass
(
'shown'
)
@
toggleDiscussionBtn
.
removeClass
(
'shown'
)
@
toggleDiscussionBtn
.
find
(
'.button-text'
).
html
(
"Show Discussion"
)
@
toggleDiscussionBtn
.
find
(
'.button-text'
).
html
(
gettext
(
"Show Discussion"
)
)
@
showed
=
false
@
showed
=
false
toggleDiscussion
:
(
event
)
->
toggleDiscussion
:
(
event
)
->
...
@@ -49,7 +49,7 @@ if Backbone?
...
@@ -49,7 +49,7 @@ if Backbone?
@
hideDiscussion
()
@
hideDiscussion
()
else
else
@
toggleDiscussionBtn
.
addClass
(
'shown'
)
@
toggleDiscussionBtn
.
addClass
(
'shown'
)
@
toggleDiscussionBtn
.
find
(
'.button-text'
).
html
(
"Hide Discussion"
)
@
toggleDiscussionBtn
.
find
(
'.button-text'
).
html
(
gettext
(
"Hide Discussion"
)
)
if
@
retrieved
if
@
retrieved
@
$
(
"section.discussion"
).
slideDown
()
@
$
(
"section.discussion"
).
slideDown
()
...
@@ -61,8 +61,8 @@ if Backbone?
...
@@ -61,8 +61,8 @@ if Backbone?
=>
=>
@
hideDiscussion
()
@
hideDiscussion
()
DiscussionUtil
.
discussionAlert
(
DiscussionUtil
.
discussionAlert
(
"Sorry"
,
gettext
(
"Sorry"
)
,
"We had some trouble loading the discussion. Please try again."
gettext
(
"We had some trouble loading the discussion. Please try again."
)
)
)
)
)
...
@@ -154,7 +154,7 @@ if Backbone?
...
@@ -154,7 +154,7 @@ if Backbone?
=>
=>
@
page
=
currPage
@
page
=
currPage
DiscussionUtil
.
discussionAlert
(
DiscussionUtil
.
discussionAlert
(
"Sorry"
,
gettext
(
"Sorry"
)
,
"We had some trouble loading the threads you requested. Please try again."
gettext
(
"We had some trouble loading the threads you requested. Please try again."
)
)
)
)
)
common/static/coffee/src/discussion/utils.coffee
View file @
a8e3bca8
...
@@ -3,7 +3,7 @@ $ ->
...
@@ -3,7 +3,7 @@ $ ->
window
.
$
$contents
=
{}
window
.
$
$contents
=
{}
$
.
fn
.
extend
$
.
fn
.
extend
loading
:
(
takeFocus
)
->
loading
:
(
takeFocus
)
->
@
$_loading
=
$
(
"<div class='loading-animation' tabindex='0'><span class='sr'>
Loading content
</span></div>"
)
@
$_loading
=
$
(
"<div class='loading-animation' tabindex='0'><span class='sr'>
"
+
gettext
(
"Loading content"
)
+
"
</span></div>"
)
$
(
this
).
after
(
@
$_loading
)
$
(
this
).
after
(
@
$_loading
)
if
takeFocus
if
takeFocus
DiscussionUtil
.
makeFocusTrap
(
@
$_loading
)
DiscussionUtil
.
makeFocusTrap
(
@
$_loading
)
...
@@ -109,7 +109,7 @@ class @DiscussionUtil
...
@@ -109,7 +109,7 @@ class @DiscussionUtil
" <header><h2/><hr/></header>"
+
" <header><h2/><hr/></header>"
+
" <p id='discussion-alert-message'/>"
+
" <p id='discussion-alert-message'/>"
+
" <hr/>"
+
" <hr/>"
+
" <button class='dismiss'>
OK
</button>"
+
" <button class='dismiss'>
"
+
gettext
(
"OK"
)
+
"
</button>"
+
"</div>"
"</div>"
)
)
@
makeFocusTrap
(
alertDiv
.
find
(
"button"
))
@
makeFocusTrap
(
alertDiv
.
find
(
"button"
))
...
@@ -137,9 +137,8 @@ class @DiscussionUtil
...
@@ -137,9 +137,8 @@ class @DiscussionUtil
if
!
params
[
"error"
]
if
!
params
[
"error"
]
params
[
"error"
]
=
=>
params
[
"error"
]
=
=>
@
discussionAlert
(
@
discussionAlert
(
"Sorry"
,
gettext
(
"Sorry"
),
"We had some trouble processing your request. Please ensure you"
+
gettext
(
"We had some trouble processing your request. Please ensure you have copied any unsaved work and then reload the page."
)
" have copied any unsaved work and then reload the page."
)
)
request
=
$
.
ajax
(
params
).
always
->
request
=
$
.
ajax
(
params
).
always
->
if
$elem
if
$elem
...
@@ -290,5 +289,5 @@ class @DiscussionUtil
...
@@ -290,5 +289,5 @@ class @DiscussionUtil
else
else
while
minLength
<
text
.
length
&&
text
[
minLength
]
!=
' '
while
minLength
<
text
.
length
&&
text
[
minLength
]
!=
' '
minLength
++
minLength
++
return
text
.
substr
(
0
,
minLength
)
+
'...'
return
text
.
substr
(
0
,
minLength
)
+
gettext
(
'…'
)
common/static/coffee/src/discussion/views/discussion_content_view.coffee
View file @
a8e3bca8
...
@@ -23,11 +23,11 @@ if Backbone?
...
@@ -23,11 +23,11 @@ if Backbone?
return
if
not
@
$
(
".post-status-closed"
).
length
return
if
not
@
$
(
".post-status-closed"
).
length
if
closed
if
closed
@
$
(
".post-status-closed"
).
show
()
@
$
(
".post-status-closed"
).
show
()
@
$
(
".action-openclose"
).
html
(
@
$
(
".action-openclose"
).
html
().
replace
(
"Close"
,
"Open"
))
@
$
(
".action-openclose"
).
html
(
@
$
(
".action-openclose"
).
html
().
replace
(
gettext
(
"Close"
),
gettext
(
"Open"
)
))
@
$
(
".discussion-reply-new"
).
hide
()
@
$
(
".discussion-reply-new"
).
hide
()
else
else
@
$
(
".post-status-closed"
).
hide
()
@
$
(
".post-status-closed"
).
hide
()
@
$
(
".action-openclose"
).
html
(
@
$
(
".action-openclose"
).
html
().
replace
(
"Open"
,
"Close"
))
@
$
(
".action-openclose"
).
html
(
@
$
(
".action-openclose"
).
html
().
replace
(
gettext
(
"Open"
),
gettext
(
"Close"
)
))
@
$
(
".discussion-reply-new"
).
show
()
@
$
(
".discussion-reply-new"
).
show
()
voted
:
(
voted
)
->
voted
:
(
voted
)
->
...
@@ -166,9 +166,26 @@ if Backbone?
...
@@ -166,9 +166,26 @@ if Backbone?
voteNum
=
@
model
.
get
(
"votes"
)[
"up_count"
]
voteNum
=
@
model
.
get
(
"votes"
)[
"up_count"
]
button
.
toggleClass
(
"is-cast"
,
voted
)
button
.
toggleClass
(
"is-cast"
,
voted
)
button
.
attr
(
"aria-pressed"
,
voted
)
button
.
attr
(
"aria-pressed"
,
voted
)
button
.
attr
(
"data-tooltip"
,
if
voted
then
"remove vote"
else
"vote"
)
button
.
attr
(
"data-tooltip"
,
if
voted
then
gettext
(
"remove vote"
)
else
gettext
(
"vote"
))
button
.
find
(
".votes-count-number"
).
html
(
voteNum
)
buttonTextFmt
=
button
.
find
(
".sr"
).
html
(
if
voted
then
"votes (click to remove your vote)"
else
"votes (click to vote)"
)
if
voted
ngettext
(
"%(voteNum)s%(startSrSpan)s vote (click to remove your vote)%(endSrSpan)s"
,
"%(voteNum)s%(startSrSpan)s votes (click to remove your vote)%(endSrSpan)s"
,
voteNum
)
else
ngettext
(
"%(voteNum)s%(startSrSpan)s vote (click to vote)%(endSrSpan)s"
,
"%(voteNum)s%(startSrSpan)s votes (click to vote)%(endSrSpan)s"
,
voteNum
)
buttonText
=
interpolate
(
buttonTextFmt
,
{
voteNum
:
voteNum
,
startSrSpan
:
"<span class='sr'>"
,
endSrSpan
:
"</span>"
},
true
)
button
.
html
(
"<span class='plus-icon'/>"
+
buttonText
)
toggleVote
:
(
event
)
=>
toggleVote
:
(
event
)
=>
event
.
preventDefault
()
event
.
preventDefault
()
...
...
common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
a8e3bca8
...
@@ -119,12 +119,12 @@ if Backbone?
...
@@ -119,12 +119,12 @@ if Backbone?
renderMorePages
:
->
renderMorePages
:
->
if
@
displayedCollection
.
hasMorePages
()
if
@
displayedCollection
.
hasMorePages
()
@
$
(
".post-list"
).
append
(
"<li class='more-pages'><a href='#'>
Load more
</a></li>"
)
@
$
(
".post-list"
).
append
(
"<li class='more-pages'><a href='#'>
"
+
gettext
(
"Load more"
)
+
"
</a></li>"
)
loadMorePages
:
(
event
)
->
loadMorePages
:
(
event
)
->
if
event
if
event
event
.
preventDefault
()
event
.
preventDefault
()
@
$
(
".more-pages"
).
html
(
'<div class="loading-animation" tabindex=0><span class="sr" role="alert">
Loading more threads
</span></div>'
)
@
$
(
".more-pages"
).
html
(
'<div class="loading-animation" tabindex=0><span class="sr" role="alert">
'
+
gettext
(
'Loading more threads'
)
+
'
</span></div>'
)
@
$
(
".more-pages"
).
addClass
(
"loading"
)
@
$
(
".more-pages"
).
addClass
(
"loading"
)
loadingDiv
=
@
$
(
".more-pages .loading-animation"
)
loadingDiv
=
@
$
(
".more-pages .loading-animation"
)
DiscussionUtil
.
makeFocusTrap
(
loadingDiv
)
DiscussionUtil
.
makeFocusTrap
(
loadingDiv
)
...
@@ -161,7 +161,7 @@ if Backbone?
...
@@ -161,7 +161,7 @@ if Backbone?
error
=
=>
error
=
=>
@
renderThreads
()
@
renderThreads
()
DiscussionUtil
.
discussionAlert
(
"Sorry"
,
"We had some trouble loading more threads. Please try again."
)
DiscussionUtil
.
discussionAlert
(
gettext
(
"Sorry"
),
gettext
(
"We had some trouble loading more threads. Please try again."
)
)
@
collection
.
retrieveAnotherPage
(
@
mode
,
options
,
{
sort_key
:
@
sortBy
},
error
)
@
collection
.
retrieveAnotherPage
(
@
mode
,
options
,
{
sort_key
:
@
sortBy
},
error
)
...
@@ -292,14 +292,14 @@ if Backbone?
...
@@ -292,14 +292,14 @@ if Backbone?
path
=
(
x
.
replace
/^\s+|\s+$/g
,
""
for
x
in
name
.
split
(
"/"
))
path
=
(
x
.
replace
/^\s+|\s+$/g
,
""
for
x
in
name
.
split
(
"/"
))
while
path
.
length
>
1
while
path
.
length
>
1
path
.
shift
()
path
.
shift
()
partialName
=
"…
/"
+
path
.
join
(
"/"
)
partialName
=
gettext
(
"…"
)
+
"
/"
+
path
.
join
(
"/"
)
if
@
getNameWidth
(
partialName
)
<
@
maxNameWidth
if
@
getNameWidth
(
partialName
)
<
@
maxNameWidth
return
partialName
return
partialName
rawName
=
path
[
0
]
rawName
=
path
[
0
]
name
=
"…
/"
+
rawName
name
=
gettext
(
"…"
)
+
"
/"
+
rawName
while
@
getNameWidth
(
name
)
>
@
maxNameWidth
while
@
getNameWidth
(
name
)
>
@
maxNameWidth
rawName
=
rawName
[
0
...
rawName
.
length
-
1
]
rawName
=
rawName
[
0
...
rawName
.
length
-
1
]
name
=
"…/"
+
rawName
+
"…"
name
=
gettext
(
"…"
)
+
"/"
+
rawName
+
gettext
(
"…"
)
return
name
return
name
filterTopic
:
(
event
)
->
filterTopic
:
(
event
)
->
...
@@ -407,7 +407,7 @@ if Backbone?
...
@@ -407,7 +407,7 @@ if Backbone?
type
:
"GET"
type
:
"GET"
$loading
:
$
$loading
:
$
loadingCallback
:
=>
loadingCallback
:
=>
@
$
(
".post-list"
).
html
(
'<li class="loading"><div class="loading-animation"><span class="sr">
Loading thread list
</span></div></li>'
)
@
$
(
".post-list"
).
html
(
'<li class="loading"><div class="loading-animation"><span class="sr">
'
+
gettext
(
'Loading thread list'
)
+
'
</span></div></li>'
)
loadedCallback
:
=>
loadedCallback
:
=>
if
callback
if
callback
callback
.
apply
@
,
[
value
]
callback
.
apply
@
,
[
value
]
...
...
common/static/coffee/src/discussion/views/discussion_thread_show_view.coffee
View file @
a8e3bca8
...
@@ -46,22 +46,22 @@ if Backbone?
...
@@ -46,22 +46,22 @@ if Backbone?
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"notflagged"
)
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"notflagged"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"aria-pressed"
,
"true"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"aria-pressed"
,
"true"
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
"Misuse Reported"
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
gettext
(
"Misuse Reported"
)
)
else
else
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"notflagged"
)
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"notflagged"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"aria-pressed"
,
"false"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"aria-pressed"
,
"false"
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
"Report Misuse"
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
gettext
(
"Report Misuse"
)
)
renderPinned
:
=>
renderPinned
:
=>
if
@
model
.
get
(
"pinned"
)
if
@
model
.
get
(
"pinned"
)
@
$
(
"[data-role=thread-pin]"
).
addClass
(
"pinned"
)
@
$
(
"[data-role=thread-pin]"
).
addClass
(
"pinned"
)
@
$
(
"[data-role=thread-pin]"
).
removeClass
(
"notpinned"
)
@
$
(
"[data-role=thread-pin]"
).
removeClass
(
"notpinned"
)
@
$
(
".discussion-pin .pin-label"
).
html
(
"Pinned"
)
@
$
(
".discussion-pin .pin-label"
).
html
(
gettext
(
"Pinned"
)
)
else
else
@
$
(
"[data-role=thread-pin]"
).
removeClass
(
"pinned"
)
@
$
(
"[data-role=thread-pin]"
).
removeClass
(
"pinned"
)
@
$
(
"[data-role=thread-pin]"
).
addClass
(
"notpinned"
)
@
$
(
"[data-role=thread-pin]"
).
addClass
(
"notpinned"
)
@
$
(
".discussion-pin .pin-label"
).
html
(
"Pin Thread"
)
@
$
(
".discussion-pin .pin-label"
).
html
(
gettext
(
"Pin Thread"
)
)
updateModelDetails
:
=>
updateModelDetails
:
=>
...
@@ -97,7 +97,7 @@ if Backbone?
...
@@ -97,7 +97,7 @@ if Backbone?
if
textStatus
==
'success'
if
textStatus
==
'success'
@
model
.
set
(
'pinned'
,
true
)
@
model
.
set
(
'pinned'
,
true
)
error
:
=>
error
:
=>
$
(
'.admin-pin'
).
text
(
"Pinning not currently available"
)
$
(
'.admin-pin'
).
text
(
gettext
(
"Pinning is not currently available"
)
)
unPin
:
->
unPin
:
->
url
=
@
model
.
urlFor
(
"unPinThread"
)
url
=
@
model
.
urlFor
(
"unPinThread"
)
...
...
common/static/coffee/src/discussion/views/discussion_thread_view.coffee
View file @
a8e3bca8
...
@@ -165,7 +165,7 @@ if Backbone?
...
@@ -165,7 +165,7 @@ if Backbone?
url
=
@
model
.
urlFor
(
'_delete'
)
url
=
@
model
.
urlFor
(
'_delete'
)
if
not
@
model
.
can
(
'can_delete'
)
if
not
@
model
.
can
(
'can_delete'
)
return
return
if
not
confirm
"Are you sure to delete thread
\"
#{
@
model
.
get
(
'title'
)
}
\"
?"
if
not
confirm
gettext
(
"Are you sure you want to delete this post?"
)
return
return
@
model
.
remove
()
@
model
.
remove
()
@
showView
.
undelegateEvents
()
@
showView
.
undelegateEvents
()
...
...
common/static/coffee/src/discussion/views/new_post_view.coffee
View file @
a8e3bca8
...
@@ -105,17 +105,17 @@ if Backbone?
...
@@ -105,17 +105,17 @@ if Backbone?
path
=
(
x
.
replace
/^\s+|\s+$/g
,
""
for
x
in
name
.
split
(
"/"
))
path
=
(
x
.
replace
/^\s+|\s+$/g
,
""
for
x
in
name
.
split
(
"/"
))
while
path
.
length
>
1
while
path
.
length
>
1
path
.
shift
()
path
.
shift
()
partialName
=
"...
/ "
+
path
.
join
(
" / "
)
partialName
=
gettext
(
"…"
)
+
"
/ "
+
path
.
join
(
" / "
)
if
@
getNameWidth
(
partialName
)
<
@
maxNameWidth
if
@
getNameWidth
(
partialName
)
<
@
maxNameWidth
return
partialName
return
partialName
rawName
=
path
[
0
]
rawName
=
path
[
0
]
name
=
"...
/ "
+
rawName
name
=
gettext
(
"…"
)
+
"
/ "
+
rawName
while
@
getNameWidth
(
name
)
>
@
maxNameWidth
while
@
getNameWidth
(
name
)
>
@
maxNameWidth
rawName
=
rawName
[
0
...
rawName
.
length
-
1
]
rawName
=
rawName
[
0
...
rawName
.
length
-
1
]
name
=
"... / "
+
rawName
+
" ..."
name
=
gettext
(
"…"
)
+
" / "
+
rawName
+
" "
+
gettext
(
"…"
)
return
name
return
name
...
...
common/static/coffee/src/discussion/views/response_comment_show_view.coffee
View file @
a8e3bca8
...
@@ -24,7 +24,7 @@ if Backbone?
...
@@ -24,7 +24,7 @@ if Backbone?
addReplyLink
:
()
->
addReplyLink
:
()
->
if
@
model
.
hasOwnProperty
(
'parent'
)
if
@
model
.
hasOwnProperty
(
'parent'
)
name
=
@
model
.
parent
.
get
(
'username'
)
?
"anonymous"
name
=
@
model
.
parent
.
get
(
'username'
)
?
gettext
(
"anonymous"
)
html
=
"<a href='#comment_
#{
@
model
.
parent
.
id
}
'>@
#{
name
}
</a>: "
html
=
"<a href='#comment_
#{
@
model
.
parent
.
id
}
'>@
#{
name
}
</a>: "
p
=
@
$
(
'.response-body p:first'
)
p
=
@
$
(
'.response-body p:first'
)
p
.
prepend
(
html
)
p
.
prepend
(
html
)
...
@@ -36,9 +36,9 @@ if Backbone?
...
@@ -36,9 +36,9 @@ if Backbone?
markAsStaff
:
->
markAsStaff
:
->
if
DiscussionUtil
.
isStaff
(
@
model
.
get
(
"user_id"
))
if
DiscussionUtil
.
isStaff
(
@
model
.
get
(
"user_id"
))
@
$el
.
find
(
"a.profile-link"
).
after
(
'<span class="staff-label">
staff
</span>'
)
@
$el
.
find
(
"a.profile-link"
).
after
(
'<span class="staff-label">
'
+
gettext
(
'staff'
)
+
'
</span>'
)
else
if
DiscussionUtil
.
isTA
(
@
model
.
get
(
"user_id"
))
else
if
DiscussionUtil
.
isTA
(
@
model
.
get
(
"user_id"
))
@
$el
.
find
(
"a.profile-link"
).
after
(
'<span class="community-ta-label">
Community TA
</span>'
)
@
$el
.
find
(
"a.profile-link"
).
after
(
'<span class="community-ta-label">
'
+
gettext
(
'Community TA'
)
+
'
</span>'
)
renderFlagged
:
=>
renderFlagged
:
=>
...
@@ -46,14 +46,14 @@ if Backbone?
...
@@ -46,14 +46,14 @@ if Backbone?
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"notflagged"
)
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"notflagged"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"aria-pressed"
,
"true"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"aria-pressed"
,
"true"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"data-tooltip"
,
"Misuse Reported"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"data-tooltip"
,
gettext
(
"Misuse Reported"
)
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
"Misuse Reported"
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
"Misuse Reported"
)
else
else
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"notflagged"
)
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"notflagged"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"aria-pressed"
,
"false"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"aria-pressed"
,
"false"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"data-tooltip"
,
"Report Misuse"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"data-tooltip"
,
gettext
(
"Report Misuse"
)
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
"Report Misuse"
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
gettext
(
"Report Misuse"
)
)
updateModelDetails
:
=>
updateModelDetails
:
=>
@
renderFlagged
()
@
renderFlagged
()
...
...
common/static/coffee/src/discussion/views/thread_response_show_view.coffee
View file @
a8e3bca8
...
@@ -42,10 +42,10 @@ if Backbone?
...
@@ -42,10 +42,10 @@ if Backbone?
markAsStaff
:
->
markAsStaff
:
->
if
DiscussionUtil
.
isStaff
(
@
model
.
get
(
"user_id"
))
if
DiscussionUtil
.
isStaff
(
@
model
.
get
(
"user_id"
))
@
$el
.
addClass
(
"staff"
)
@
$el
.
addClass
(
"staff"
)
@
$el
.
prepend
(
'<div class="staff-banner">
staff
</div>'
)
@
$el
.
prepend
(
'<div class="staff-banner">
'
+
gettext
(
'staff'
)
+
'
</div>'
)
else
if
DiscussionUtil
.
isTA
(
@
model
.
get
(
"user_id"
))
else
if
DiscussionUtil
.
isTA
(
@
model
.
get
(
"user_id"
))
@
$el
.
addClass
(
"community-ta"
)
@
$el
.
addClass
(
"community-ta"
)
@
$el
.
prepend
(
'<div class="community-ta-banner">
Community TA
</div>'
)
@
$el
.
prepend
(
'<div class="community-ta-banner">
'
+
gettext
(
'Community TA'
)
+
'
</div>'
)
edit
:
(
event
)
->
edit
:
(
event
)
->
@
trigger
"response:edit"
,
event
@
trigger
"response:edit"
,
event
...
@@ -75,12 +75,12 @@ if Backbone?
...
@@ -75,12 +75,12 @@ if Backbone?
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"notflagged"
)
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"notflagged"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"aria-pressed"
,
"true"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"aria-pressed"
,
"true"
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
"Misuse Reported"
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
gettext
(
"Misuse Reported"
)
)
else
else
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"notflagged"
)
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"notflagged"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"aria-pressed"
,
"false"
)
@
$
(
".discussion-flag-abuse"
).
attr
(
"aria-pressed"
,
"false"
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
"Report Misuse"
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
gettext
(
"Report Misuse"
))
updateModelDetails
:
=>
updateModelDetails
:
=>
@
renderVote
()
@
renderVote
()
...
...
common/static/coffee/src/discussion/views/thread_response_view.coffee
View file @
a8e3bca8
...
@@ -97,7 +97,7 @@ if Backbone?
...
@@ -97,7 +97,7 @@ if Backbone?
event
.
preventDefault
()
event
.
preventDefault
()
if
not
@
model
.
can
(
'can_delete'
)
if
not
@
model
.
can
(
'can_delete'
)
return
return
if
not
confirm
"Are you sure to delete this response? "
if
not
confirm
gettext
(
"Are you sure you want to delete this response?"
)
return
return
url
=
@
model
.
urlFor
(
'_delete'
)
url
=
@
model
.
urlFor
(
'_delete'
)
@
model
.
remove
()
@
model
.
remove
()
...
...
common/static/js/test/i18n.js
View file @
a8e3bca8
window
.
gettext
=
window
.
ngettext
=
function
(
s
){
return
s
;};
window
.
gettext
=
function
(
s
){
return
s
;};
window
.
ngettext
=
function
(
singular
,
plural
,
num
){
return
num
==
1
?
singular
:
plural
}
function
interpolate
(
fmt
,
obj
,
named
)
{
function
interpolate
(
fmt
,
obj
,
named
)
{
if
(
named
)
{
if
(
named
)
{
...
...
common/static/js_test.yml
View file @
a8e3bca8
...
@@ -37,6 +37,7 @@ lib_paths:
...
@@ -37,6 +37,7 @@ lib_paths:
-
js/vendor/URI.min.js
-
js/vendor/URI.min.js
-
coffee/src/ajax_prefix.js
-
coffee/src/ajax_prefix.js
-
js/test/add_ajax_prefix.js
-
js/test/add_ajax_prefix.js
-
js/test/i18n.js
-
coffee/src/jquery.immediateDescendents.js
-
coffee/src/jquery.immediateDescendents.js
# Paths to source JavaScript files
# Paths to source JavaScript files
...
...
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