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
8b0e4592
Commit
8b0e4592
authored
Sep 04, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed endorse
parent
10887ab1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
17 deletions
+19
-17
lms/static/coffee/src/discussion/views/discussion_content_view.coffee
+15
-17
lms/static/coffee/src/discussion/views/discussion_thread_view.coffee
+2
-0
lms/static/coffee/src/discussion/views/response_comment_view.coffee
+1
-0
lms/static/coffee/src/discussion/views/thread_response_view.coffee
+1
-0
No files found.
lms/static/coffee/src/discussion/views/discussion_content_view.coffee
View file @
8b0e4592
class
@
DiscussionContentView
extends
Backbone
.
View
partial
Renderer
:
attr
Renderer
:
endorsed
:
(
endorsed
)
->
if
endorsed
@
$
(
".action-endorse"
).
addClass
(
"is-endorsed"
)
else
@
$
(
".action-endorse"
).
removeClass
(
"is-endorsed"
)
closed
:
(
closed
)
->
# we should just re-render the whole thread, or update according to new abilities
closed
:
(
closed
)
->
voted
:
(
voted
)
->
if
voted
@
$
(
".discussion-vote"
).
addClass
(
"is-cast"
)
else
@
$
(
".discussion-vote"
).
removeClass
(
"is-cast"
)
votes_point
:
(
votes_point
)
->
@
$
(
".discussion-vote .votes-count-number"
).
html
(
votes_point
)
comments_count
:
(
comments_count
)
->
subscribed
:
(
subscribed
)
->
if
subscribed
@
$
(
".dogear"
).
addClass
(
"is-followed"
)
else
@
$
(
".dogear"
).
removeClass
(
"is-followed"
)
ability
:
(
ability
)
->
console
.
log
"ability changed"
for
action
,
selector
of
@
abilityRenderer
if
not
ability
[
action
]
selector
.
disable
.
apply
(
@
)
...
...
@@ -41,11 +35,15 @@ class @DiscussionContentView extends Backbone.View
enable
:
->
@
$
(
".action-endorse"
).
css
(
"cursor"
,
"auto"
)
disable
:
->
@
$
(
".action-endorse"
).
css
(
"cursor"
,
"default"
)
renderPartial
:
->
console
.
log
"changed"
renderPartialAttrs
:
->
for
attr
,
value
of
@
model
.
changedAttributes
()
if
@
partialRenderer
[
attr
]
@
partialRenderer
[
attr
].
apply
(
@
,
[
value
])
if
@
attrRenderer
[
attr
]
@
attrRenderer
[
attr
].
apply
(
@
,
[
value
])
renderAttrs
:
->
for
attr
,
value
of
@
model
.
attributes
if
@
attrRenderer
[
attr
]
@
attrRenderer
[
attr
].
apply
(
@
,
[
value
])
initialize
:
->
@
model
.
bind
(
'change'
,
@
renderPartial
,
@
)
@
model
.
bind
(
'change'
,
@
renderPartial
Attrs
,
@
)
lms/static/coffee/src/discussion/views/discussion_thread_view.coffee
View file @
8b0e4592
...
...
@@ -23,12 +23,14 @@ class @DiscussionThreadView extends DiscussionContentView
template
:
_
.
template
(
$
(
"#thread-template"
).
html
())
initialize
:
->
super
()
@
model
.
on
"change"
,
@
updateModelDetails
render
:
->
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
@
renderDogear
()
@
renderVoted
()
@
renderAttrs
()
@
$
(
"span.timeago"
).
timeago
()
Markdown
.
makeWmdEditor
@
$
(
".reply-body"
),
""
,
DiscussionUtil
.
urlFor
(
"upload"
),
(
text
)
->
DiscussionUtil
.
postMathJaxProcessor
(
text
)
@
convertMath
()
...
...
lms/static/coffee/src/discussion/views/response_comment_view.coffee
View file @
8b0e4592
...
...
@@ -3,6 +3,7 @@ class @ResponseCommentView extends DiscussionContentView
template
:
_
.
template
(
$
(
"#response-comment-template"
).
html
())
render
:
->
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
@
renderAttrs
()
@
$
(
".timeago"
).
timeago
()
@
convertMath
()
@
...
...
lms/static/coffee/src/discussion/views/thread_response_view.coffee
View file @
8b0e4592
...
...
@@ -11,6 +11,7 @@ class @ThreadResponseView extends DiscussionContentView
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
if
window
.
user
.
voted
(
@
model
)
@
$
(
".vote-btn"
).
addClass
(
"is-cast"
)
@
renderAttrs
()
@
$
(
".posted-details"
).
timeago
()
@
convertMath
()
@
renderComments
()
...
...
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