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
dac28f80
Commit
dac28f80
authored
Aug 03, 2012
by
Brittany Cheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:dementrock/mitx into discussion2
parents
839463e9
5ba879fc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
126 additions
and
142 deletions
+126
-142
lms/djangoapps/django_comment_client/base/urls.py
+4
-4
lms/djangoapps/django_comment_client/base/views.py
+6
-6
lms/static/coffee/src/discussion/discussion.coffee
+91
-123
lms/static/coffee/src/discussion/main.coffee
+1
-0
lms/static/coffee/src/discussion/utils.coffee
+24
-9
No files found.
lms/djangoapps/django_comment_client/base/urls.py
View file @
dac28f80
...
@@ -10,8 +10,8 @@ urlpatterns = patterns('django_comment_client.base.views',
...
@@ -10,8 +10,8 @@ urlpatterns = patterns('django_comment_client.base.views',
url
(
r'threads/(?P<thread_id>[\w\-]+)/delete'
,
'delete_thread'
,
name
=
'delete_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/delete'
,
'delete_thread'
,
name
=
'delete_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/upvote$'
,
'vote_for_thread'
,
{
'value'
:
'up'
},
name
=
'upvote_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/upvote$'
,
'vote_for_thread'
,
{
'value'
:
'up'
},
name
=
'upvote_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/downvote$'
,
'vote_for_thread'
,
{
'value'
:
'down'
},
name
=
'downvote_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/downvote$'
,
'vote_for_thread'
,
{
'value'
:
'down'
},
name
=
'downvote_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/
watch$'
,
'watch_thread'
,
name
=
'watch
_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/
follow$'
,
'follow_thread'
,
name
=
'follow
_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/un
watch$'
,
'unwatch_thread'
,
name
=
'unwatch
_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/un
follow$'
,
'unfollow_thread'
,
name
=
'unfollow
_thread'
),
url
(
r'comments/(?P<comment_id>[\w\-]+)/update$'
,
'update_comment'
,
name
=
'update_comment'
),
url
(
r'comments/(?P<comment_id>[\w\-]+)/update$'
,
'update_comment'
,
name
=
'update_comment'
),
url
(
r'comments/(?P<comment_id>[\w\-]+)/endorse$'
,
'endorse_comment'
,
name
=
'endorse_comment'
),
url
(
r'comments/(?P<comment_id>[\w\-]+)/endorse$'
,
'endorse_comment'
,
name
=
'endorse_comment'
),
...
@@ -21,8 +21,8 @@ urlpatterns = patterns('django_comment_client.base.views',
...
@@ -21,8 +21,8 @@ urlpatterns = patterns('django_comment_client.base.views',
url
(
r'comments/(?P<comment_id>[\w\-]+)/downvote$'
,
'vote_for_comment'
,
{
'value'
:
'down'
},
name
=
'downvote_comment'
),
url
(
r'comments/(?P<comment_id>[\w\-]+)/downvote$'
,
'vote_for_comment'
,
{
'value'
:
'down'
},
name
=
'downvote_comment'
),
url
(
r'(?P<commentable_id>[\w\-]+)/threads/create$'
,
'create_thread'
,
name
=
'create_thread'
),
url
(
r'(?P<commentable_id>[\w\-]+)/threads/create$'
,
'create_thread'
,
name
=
'create_thread'
),
url
(
r'(?P<commentable_id>[\w\-]+)/
watch$'
,
'watch_commentable'
,
name
=
'watch
_commentable'
),
url
(
r'(?P<commentable_id>[\w\-]+)/
follow$'
,
'follow_commentable'
,
name
=
'follow
_commentable'
),
url
(
r'(?P<commentable_id>[\w\-]+)/un
watch$'
,
'unwatch_commentable'
,
name
=
'unwatch
_commentable'
),
url
(
r'(?P<commentable_id>[\w\-]+)/un
follow$'
,
'unfollow_commentable'
,
name
=
'unfollow
_commentable'
),
url
(
r'search$'
,
'search'
,
name
=
'search'
),
url
(
r'search$'
,
'search'
,
name
=
'search'
),
)
)
lms/djangoapps/django_comment_client/base/views.py
View file @
dac28f80
...
@@ -140,42 +140,42 @@ def vote_for_thread(request, course_id, thread_id, value):
...
@@ -140,42 +140,42 @@ def vote_for_thread(request, course_id, thread_id, value):
@login_required
@login_required
@require_POST
@require_POST
def
watch
_thread
(
request
,
course_id
,
thread_id
):
def
follow
_thread
(
request
,
course_id
,
thread_id
):
user_id
=
request
.
user
.
id
user_id
=
request
.
user
.
id
response
=
comment_client
.
subscribe_thread
(
user_id
,
thread_id
)
response
=
comment_client
.
subscribe_thread
(
user_id
,
thread_id
)
return
JsonResponse
(
response
)
return
JsonResponse
(
response
)
@login_required
@login_required
@require_POST
@require_POST
def
watch
_commentable
(
request
,
course_id
,
commentable_id
):
def
follow
_commentable
(
request
,
course_id
,
commentable_id
):
user_id
=
request
.
user
.
id
user_id
=
request
.
user
.
id
response
=
comment_client
.
subscribe_commentable
(
user_id
,
commentable_id
)
response
=
comment_client
.
subscribe_commentable
(
user_id
,
commentable_id
)
return
JsonResponse
(
response
)
return
JsonResponse
(
response
)
@login_required
@login_required
@require_POST
@require_POST
def
follow
(
request
,
course_id
,
followed_user_id
):
def
follow
_user
(
request
,
course_id
,
followed_user_id
):
user_id
=
request
.
user
.
id
user_id
=
request
.
user
.
id
response
=
comment_client
.
follow
(
user_id
,
followed_user_id
)
response
=
comment_client
.
follow
(
user_id
,
followed_user_id
)
return
JsonResponse
(
response
)
return
JsonResponse
(
response
)
@login_required
@login_required
@require_POST
@require_POST
def
un
watch
_thread
(
request
,
course_id
,
thread_id
):
def
un
follow
_thread
(
request
,
course_id
,
thread_id
):
user_id
=
request
.
user
.
id
user_id
=
request
.
user
.
id
response
=
comment_client
.
unsubscribe_thread
(
user_id
,
thread_id
)
response
=
comment_client
.
unsubscribe_thread
(
user_id
,
thread_id
)
return
JsonResponse
(
response
)
return
JsonResponse
(
response
)
@login_required
@login_required
@require_POST
@require_POST
def
un
watch
_commentable
(
request
,
course_id
,
commentable_id
):
def
un
follow
_commentable
(
request
,
course_id
,
commentable_id
):
user_id
=
request
.
user
.
id
user_id
=
request
.
user
.
id
response
=
comment_client
.
unsubscribe_commentable
(
user_id
,
commentable_id
)
response
=
comment_client
.
unsubscribe_commentable
(
user_id
,
commentable_id
)
return
JsonResponse
(
response
)
return
JsonResponse
(
response
)
@login_required
@login_required
@require_POST
@require_POST
def
unfollow
(
request
,
course_id
,
followed_user_id
):
def
unfollow
_user
(
request
,
course_id
,
followed_user_id
):
user_id
=
request
.
user
.
id
user_id
=
request
.
user
.
id
response
=
comment_client
.
unfollow
(
user_id
,
followed_user_id
)
response
=
comment_client
.
unfollow
(
user_id
,
followed_user_id
)
return
JsonResponse
(
response
)
return
JsonResponse
(
response
)
...
...
lms/static/coffee/src/discussion/discussion.coffee
View file @
dac28f80
This diff is collapsed.
Click to expand it.
lms/static/coffee/src/discussion/main.coffee
View file @
dac28f80
$
->
$
->
Discussion
=
window
.
Discussion
Discussion
=
window
.
Discussion
console
.
log
"here"
if
$
(
'#accordion'
).
length
if
$
(
'#accordion'
).
length
active
=
$
(
'#accordion ul:has(li.active)'
).
index
(
'#accordion ul'
)
active
=
$
(
'#accordion ul:has(li.active)'
).
index
(
'#accordion ul'
)
$
(
'#accordion'
).
bind
(
'accordionchange'
,
@
log
).
accordion
$
(
'#accordion'
).
bind
(
'accordionchange'
,
@
log
).
accordion
...
...
lms/static/coffee/src/discussion/utils.coffee
View file @
dac28f80
...
@@ -9,23 +9,23 @@ Discussion = @Discussion
...
@@ -9,23 +9,23 @@ Discussion = @Discussion
(
selector
)
->
$
(
elem
).
find
(
selector
)
(
selector
)
->
$
(
elem
).
find
(
selector
)
generateDiscussionLink
:
(
cls
,
txt
,
handler
)
->
generateDiscussionLink
:
(
cls
,
txt
,
handler
)
->
$
(
"<a>"
).
addClass
(
"discussion-link"
)
.
$
(
"<a>"
).
addClass
(
"discussion-link"
)
attr
(
"href"
,
"javascript:void(0)"
).
.
attr
(
"href"
,
"javascript:void(0)"
)
addClass
(
cls
).
html
(
txt
).
.
addClass
(
cls
).
html
(
txt
)
click
(
->
handler
(
this
)
)
.
click
->
handler
(
this
)
urlFor
:
(
name
,
param
,
param1
)
->
urlFor
:
(
name
,
param
,
param1
)
->
{
{
watch_commentable
:
"/courses/
#{
$$course_id
}
/discussion/
#{
param
}
/watch
"
follow_discussion
:
"/courses/
#{
$$course_id
}
/discussion/
#{
param
}
/follow
"
un
watch_commentable
:
"/courses/
#{
$$course_id
}
/discussion/
#{
param
}
/unwatch
"
un
follow_discussion
:
"/courses/
#{
$$course_id
}
/discussion/
#{
param
}
/unfollow
"
create_thread
:
"/courses/
#{
$$course_id
}
/discussion/
#{
param
}
/threads/create"
create_thread
:
"/courses/
#{
$$course_id
}
/discussion/
#{
param
}
/threads/create"
update_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/update"
update_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/update"
create_comment
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/reply"
create_comment
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/reply"
delete_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/delete"
delete_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/delete"
upvote_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/upvote"
upvote_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/upvote"
downvote_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/downvote"
downvote_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/downvote"
watch_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/watch
"
follow_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/follow
"
un
watch_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/unwatch
"
un
follow_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/unfollow
"
update_comment
:
"/courses/
#{
$$course_id
}
/discussion/comments/
#{
param
}
/update"
update_comment
:
"/courses/
#{
$$course_id
}
/discussion/comments/
#{
param
}
/update"
endorse_comment
:
"/courses/
#{
$$course_id
}
/discussion/comments/
#{
param
}
/endorse"
endorse_comment
:
"/courses/
#{
$$course_id
}
/discussion/comments/
#{
param
}
/endorse"
create_sub_comment
:
"/courses/
#{
$$course_id
}
/discussion/comments/
#{
param
}
/reply"
create_sub_comment
:
"/courses/
#{
$$course_id
}
/discussion/comments/
#{
param
}
/reply"
...
@@ -50,3 +50,18 @@ Discussion = @Discussion
...
@@ -50,3 +50,18 @@ Discussion = @Discussion
handleAnchorAndReload
:
(
response
)
->
handleAnchorAndReload
:
(
response
)
->
#window.location = window.location.pathname + "#" + response['id']
#window.location = window.location.pathname + "#" + response['id']
window
.
location
.
reload
()
window
.
location
.
reload
()
bindLocalEvents
:
(
$local
,
eventsHandler
)
->
for
eventSelector
,
handler
of
eventsHandler
[
event
,
selector
]
=
eventSelector
.
split
(
' '
)
$local
(
selector
)[
event
]
handler
tagsInputOptions
:
->
autocomplete_url
:
Discussion
.
urlFor
(
'tags_autocomplete'
)
autocomplete
:
remoteDataType
:
'json'
interactive
:
true
defaultText
:
"Tag your post: press enter after each tag"
height
:
"30px"
width
:
"100%"
removeWithBackspace
:
true
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