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
272c7b8b
Commit
272c7b8b
authored
Aug 07, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into merge
parents
547114a8
2685a3b6
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
247 additions
and
37 deletions
+247
-37
lms/djangoapps/django_comment_client/forum/views.py
+14
-0
lms/lib/comment_client.py
+16
-0
lms/static/coffee/src/discussion/discussion.coffee
+35
-21
lms/static/coffee/src/discussion/templates.coffee
+3
-2
lms/static/sass/_discussion.scss
+140
-5
lms/static/sass/course/courseware/_courseware.scss
+5
-0
lms/templates/discussion/_blank_slate.html
+2
-2
lms/templates/discussion/_forum.html
+5
-3
lms/templates/discussion/_inline.html
+5
-3
lms/templates/discussion/_recent_active_posts.html
+8
-0
lms/templates/discussion/_thread.html
+1
-1
lms/templates/discussion/_trending_tags.html
+11
-0
lms/templates/discussion/index.html
+2
-0
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
272c7b8b
...
...
@@ -122,6 +122,18 @@ def forum_form_discussion(request, course_id, discussion_id):
content
=
render_forum_discussion
(
request
,
course_id
,
threads
,
discussion_id
=
discussion_id
,
\
query_params
=
query_params
)
recent_active_threads
=
comment_client
.
search_recent_active_threads
(
course_id
,
recursive
=
False
,
query_params
=
{
'follower_id'
:
request
.
user
.
id
,
'commentable_id'
:
discussion_id
},
)
trending_tags
=
comment_client
.
search_trending_tags
(
course_id
,
query_params
=
{
'commentable_id'
:
discussion_id
},
)
if
request
.
is_ajax
():
return
utils
.
HtmlResponse
(
content
)
else
:
...
...
@@ -130,6 +142,8 @@ def forum_form_discussion(request, course_id, discussion_id):
'course'
:
course
,
'content'
:
content
,
'accordion'
:
render_accordion
(
request
,
course
,
discussion_id
),
'recent_active_threads'
:
recent_active_threads
,
'trending_tags'
:
trending_tags
,
}
return
render_to_response
(
'discussion/index.html'
,
context
)
...
...
lms/lib/comment_client.py
View file @
272c7b8b
...
...
@@ -34,6 +34,16 @@ def search_similar_threads(course_id, recursive=False, query_params={}, *args, *
attributes
=
dict
(
default_params
.
items
()
+
query_params
.
items
())
return
_perform_request
(
'get'
,
_url_for_search_similar_threads
(),
attributes
,
*
args
,
**
kwargs
)
def
search_recent_active_threads
(
course_id
,
recursive
=
False
,
query_params
=
{},
*
args
,
**
kwargs
):
default_params
=
{
'course_id'
:
course_id
,
'recursive'
:
recursive
}
attributes
=
dict
(
default_params
.
items
()
+
query_params
.
items
())
return
_perform_request
(
'get'
,
_url_for_search_recent_active_threads
(),
attributes
,
*
args
,
**
kwargs
)
def
search_trending_tags
(
course_id
,
query_params
=
{},
*
args
,
**
kwargs
):
default_params
=
{
'course_id'
:
course_id
}
attributes
=
dict
(
default_params
.
items
()
+
query_params
.
items
())
return
_perform_request
(
'get'
,
_url_for_search_trending_tags
(),
attributes
,
*
args
,
**
kwargs
)
def
create_user
(
attributes
,
*
args
,
**
kwargs
):
return
_perform_request
(
'post'
,
_url_for_users
(),
attributes
,
*
args
,
**
kwargs
)
...
...
@@ -167,6 +177,12 @@ def _url_for_search_threads():
def
_url_for_search_similar_threads
():
return
"{prefix}/search/threads/more_like_this"
.
format
(
prefix
=
PREFIX
)
def
_url_for_search_recent_active_threads
():
return
"{prefix}/search/threads/recent_active"
.
format
(
prefix
=
PREFIX
)
def
_url_for_search_trending_tags
():
return
"{prefix}/search/tags/trending"
.
format
(
prefix
=
PREFIX
)
def
_url_for_threads_tags
():
return
"{prefix}/threads/tags"
.
format
(
prefix
=
PREFIX
)
...
...
lms/static/coffee/src/discussion/discussion.coffee
View file @
272c7b8b
...
...
@@ -62,27 +62,38 @@ initializeFollowDiscussion = (discussion) ->
$local
(
".discussion-new-post"
).
show
()
handleSimilarPost
=
(
elem
)
->
Discussion
.
safeAjax
$elem
:
$
(
elem
)
url
:
Discussion
.
urlFor
'search_similar_threads'
,
id
type
:
"GET"
dateType
:
'json'
data
:
text
:
$local
(
".new-post-title"
).
val
()
success
:
(
response
,
textStatus
)
->
$wrapper
=
$local
(
".new-post-similar-posts-wrapper"
)
$similarPosts
=
$local
(
".new-post-similar-posts"
)
$similarPosts
.
empty
()
if
$
.
type
(
response
)
==
"array"
and
response
.
length
$wrapper
.
show
()
for
thread
in
response
#singleThreadUrl = Discussion.urlFor 'retrieve_single_thread
$similarPost
=
$
(
"<a>"
).
addClass
(
"similar-post"
)
.
html
(
thread
[
"title"
])
.
attr
(
"href"
,
"javascript:void(0)"
)
#TODO
.
appendTo
(
$similarPosts
)
else
$wrapper
.
hide
()
$title
=
$local
(
".new-post-title"
)
$wrapper
=
$local
(
".new-post-similar-posts-wrapper"
)
$similarPosts
=
$local
(
".new-post-similar-posts"
)
prevText
=
$title
.
attr
(
"prev-text"
)
text
=
$title
.
val
()
if
text
==
prevText
if
$local
(
".similar-post"
).
length
$wrapper
.
show
()
else
if
$
.
trim
(
text
).
length
Discussion
.
safeAjax
$elem
:
$
(
elem
)
url
:
Discussion
.
urlFor
'search_similar_threads'
,
id
type
:
"GET"
dateType
:
'json'
data
:
text
:
$local
(
".new-post-title"
).
val
()
success
:
(
response
,
textStatus
)
->
console
.
log
"request"
$similarPosts
.
empty
()
if
$
.
type
(
response
)
==
"array"
and
response
.
length
$wrapper
.
show
()
for
thread
in
response
#singleThreadUrl = Discussion.urlFor 'retrieve_single_thread
$similarPost
=
$
(
"<a>"
).
addClass
(
"similar-post"
)
.
html
(
thread
[
"title"
])
.
attr
(
"href"
,
"javascript:void(0)"
)
#TODO
.
appendTo
(
$similarPosts
)
else
$wrapper
.
hide
()
else
$wrapper
.
hide
()
$title
.
attr
(
"prev-text"
,
text
)
handleNewPost
=
(
elem
)
->
newPostForm
=
$local
(
".new-post-form"
)
...
...
@@ -102,6 +113,9 @@ initializeFollowDiscussion = (discussion) ->
$local
(
".new-post-title"
).
blur
->
handleSimilarPost
(
this
)
$local
(
".hide-similar-posts"
).
click
->
$local
(
".new-post-similar-posts-wrapper"
).
hide
()
$local
(
".discussion-submit-post"
).
click
->
handleSubmitNewPost
(
this
)
$local
(
".discussion-cancel-post"
).
click
->
...
...
lms/static/coffee/src/discussion/templates.coffee
View file @
272c7b8b
...
...
@@ -8,10 +8,11 @@ Discussion = @Discussion
newPostTemplate
:
"""
<form class="new-post-form" _id="{{discussion_id}}">
<ul class="discussion-errors"></ul>
<ul class="discussion-errors
new-post-form-error
"></ul>
<input type="text" class="new-post-title title-input" placeholder="Title"/>
<div class="new-post-similar-posts-wrapper" style="display: none">
Do you mean...
Similar Posts:
<a class="hide-similar-posts" href="javascript:void(0)">Hide</a>
<div class="new-post-similar-posts"></div>
</div>
<div class="new-post-body body-input"></div>
...
...
lms/static/sass/_discussion.scss
View file @
272c7b8b
...
...
@@ -24,11 +24,28 @@ form label {
text-shadow
:
none
;
}
div
.recent-activity
{
font-size
:
$comment_body_size
;
margin
:
4%
;
font-weight
:
bold
;
a
.recent-active-post
{
margin-bottom
:
2px
;
&
:hover
{
color
:
#1C71DD
;
text-decoration
:
none
;
font-weight
:
normal
;
}
}
}
.discussion
{
.discussion-non-content
{
margin-left
:
flex-gutter
();
}
//TITLE
.discussion-title
{
@include
discussion-font
;
@include
discussion-clickable
;
...
...
@@ -37,6 +54,7 @@ form label {
font-weight
:
bold
;
margin-bottom
:
flex-gutter
(
6
);
}
.discussion-title-wrapper
{
.discussion-watch-discussion
,
.discussion-unwatch-discussion
{
@include
discussion-font
;
...
...
@@ -45,33 +63,46 @@ form label {
margin-left
:
5px
;
}
}
.blank
{
margin
:
2%
;
}
//SORTING
.discussion-sort
{
float
:
right
;
font-size
:
$comment_body_size
;
margin-top
:
-2
.5%
;
.discussion-sort-link
{
&
:hover
{
color
:
#1C71DD
;
text-decoration
:
none
;
}
}
.discussion-sort-link.sorted
{
color
:
#1C71DD
;
font-weight
:
bold
;
}
}
//SEARCH
.search-wrapper-inline
{
display
:
inline-block
;
margin-bottom
:
6%
;
margin-top
:
3%
;
width
:
80%
;
}
.discussion-search-form
{
display
:
inline-block
;
margin-bottom
:
1%
;
width
:
flex-grid
(
12
);
.discussion-link
{
@include
button
;
color
:
white
;
...
...
@@ -82,9 +113,11 @@ form label {
padding-top
:
9px
;
text-decoration
:
none
;
}
.discussion-search-text
{
@include
discussion-font
;
}
.search-input
{
float
:
left
;
font
:
inherit
;
...
...
@@ -92,16 +125,20 @@ form label {
width
:
72%
;
}
}
.search-within
{
display
:
block
;
margin-bottom
:
3%
;
}
.discussion-search-within-board
{
font
:
inherit
;
font-size
:
$comment_body_size
;
font-style
:
normal
;
}
//BASIC BUTTON STYLES
.control-button
{
@include
button
;
@include
discussion-font
;
...
...
@@ -125,6 +162,7 @@ form label {
width
:
inherit
;
text-decoration
:
none
;
text-shadow
:
none
;
&
:hover
{
background-color
:
#A2A2A2
;
background-image
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
color-stop
(
0%
,
#A2A2A2
)
,
color-stop
(
100%
,
#7B7B7B
));
...
...
@@ -139,9 +177,12 @@ form label {
box-shadow
:
inset
0
1px
0
#BBB
,
0
0
3px
#CCC
;
}
}
//FOLLOW BUTTON
.follow-wrapper
{
float
:
right
;
.discussion-link
{
@include
button
;
background-color
:
#BEBEBE
;
...
...
@@ -155,6 +196,7 @@ form label {
padding
:
5px
8px
;
text-decoration
:
none
;
text-shadow
:
none
;
&
:hover
{
background-color
:
#AAA
;
background-image
:
none
;
...
...
@@ -165,63 +207,87 @@ form label {
}
}
}
//VOTES
.discussion-votes
{
float
:
left
;
height
:
flex-grid
(
3
);
margin
:
1%
2%
;
text-align
:
center
;
.discussion-vote-count
{
@include
discussion-font
;
font-size
:
$comment_body_size
;
}
a
.discussion-vote
{
color
:
black
;
display
:
block
;
font-size
:
15px
;
font-weight
:
bold
;
&
:hover
{
color
:
#1C71DD
;
text-decoration
:
none
;
}
&
.discussion-vote-up
{
margin-bottom
:
3px
;
}
&
.discussion-vote-down
{
margin-top
:
5px
;
}
&
.voted
{
color
:
#1C71DD
;
}
}
}
//CREATE NEW AND EDIT POSTS
.discussion-right-wrapper
{
float
:
left
;
min-height
:
40px
;
width
:
90%
;
}
.new-post-form
,
.discussion-thread-edit
{
.title-input
,
.body-input
{
display
:
block
!
important
;
font
:
inherit
;
font-style
:
normal
;
width
:
$discussion_input_width
!
important
;
}
.discussion-errors
{
color
:
#8F0E0E
;
display
:
block
;
margin-left
:
-5%
;
.new-post-similar-posts-wrapper
{
@include
border-radius
(
3px
);
border
:
1px
solid
#EEE
;
font-size
:
$comment_body_size
;
line-height
:
150%
;
margin-top
:
1%
;
padding
:
1%
1
.5%
;
}
.hide-similar-posts
{
float
:
right
;
}
.new-post-similar-posts
{
font
:
inherit
;
.similar-post
{
display
:
block
;
line-height
:
150%
;
}
}
.new-post-body
{
margin-top
:
flex-gutter
();
}
.tagsinput
{
background
:
#FAFAFA
;
border
:
1px
solid
#C8C8C8
;
...
...
@@ -241,19 +307,39 @@ form label {
-webkit-font-smoothing
:
antialiased
;
}
}
.discussion-content-edit
,
.discussion-reply-new
,
.new-post-form
{
margin
:
10px
0
10px
0
;
.discussion-errors
{
color
:
#8F0E0E
;
display
:
block
;
font
:
inherit
;
font-size
:
$comment_body_size
;
list-style
:
none
;
margin-left
:
-3%
;
padding-left
:
2em
;
}
a
:hover
{
color
:
#1C71DD
;
text-decoration
:
none
;
};
.new-post-control
{
margin-left
:
80%
;
margin-top
:
1%
;
}
.reply-post-control
{
margin-left
:
73%
;
}
.edit-post-control
{
margin-left
:
79%
;
margin-top
:
1%
;
}
.control-button
{
@include
button
;
@include
discussion-font
;
...
...
@@ -265,24 +351,35 @@ form label {
padding-top
:
9px
;
text-decoration
:
none
;
width
:
inherit
;
&
:hover
{
color
:
white
;
}
}
}
.new-post-form
{
margin
:
10px
0
40px
0
;
}
.discussion-reply-new
{
.discussion-auto-watch
{
margin-left
:
2%
;
}
}
//THREAD STYLES
.thread
{
//display: none;
.search-highlight
{
display
:
inline
;
font-weight
:
bold
;
background-color
:
lightyellow
;
}
.thread-title
{
@include
discussion-font
;
@include
discussion-clickable
;
...
...
@@ -290,18 +387,23 @@ form label {
font-size
:
$comment_title_size
;
font-weight
:
bold
;
}
.thread-body
,
.content-body
{
@include
discussion-font
;
font-size
:
$comment_body_size
;
margin-bottom
:
4px
;
margin-top
:
3px
;
min-height
:
35px
;
p
{
@include
discussion-font
;
margin
:
0
;
}
}
.thread-tags
{
display
:
inline-block
;
.thread-tag
{
@include
discussion-font
;
background
:
#CDE69C
;
...
...
@@ -314,43 +416,65 @@ form label {
margin
:
5px
7px
5px
0
;
padding
:
5px
7px
;
text-decoration
:
none
;
&
:hover
{
border-color
:
#1E4612
;
color
:
#1E4612
;
}
}
}
.info
{
@include
discussion-font
;
color
:
gray
;
font-size
:
$comment_info_size
;
font-style
:
italic
;
margin-top
:
2%
;
a
{
&
:hover
{
text-decoration
:
none
;
color
:
#1C71DD
;
}
}
.comment-time
{
display
:
inline
;
float
:
right
;
margin-right
:
-4%
;
}
.comment-count
{
display
:
inline
;
}
.discussion-reply
{
margin-left
:
4px
;
}
.discussion-link
{
@include
discussion-font
;
color
:
#1d9dd9
;
display
:
inline
;
margin-left
:
2px
;
&
:hover
{
text-decoration
:
none
;
color
:
#1C71DD
;
}
}
}
.discussion-content
{
border-top
:
lightgray
1px
solid
;
overflow
:
hidden
;
padding
:
1
.5%
0
;
.discussion-reply-new
{
@include
discussion-font
;
margin-left
:
5%
;
.reply-body
{
@include
discussion-font
;
display
:
block
;
...
...
@@ -360,12 +484,16 @@ form label {
}
}
}
//COMMENT STYLES
.comments
{
//display: none;
margin-left
:
$comment_margin_left
;
overflow
:
hidden
;
.comment
{
.comment-body
,
.content-body
{
@include
discussion-font
;
color
:
black
;
...
...
@@ -373,7 +501,9 @@ form label {
font-size
:
$comment_body_size
;
margin-top
:
3px
;
}
&
.endorsed
{
>
.discussion-content
{
background-color
:
lightyellow
;
}
...
...
@@ -381,16 +511,20 @@ form label {
}
}
}
//PAGES
.discussion-paginator
{
font-size
:
$comment_body_size
;
margin-bottom
:
10px
;
margin-top
:
20px
;
text-align
:
center
;
div
{
display
:
inline-block
;
font-weight
:
bold
;
margin
:
0
5px
;
a
{
background
:
#EEE
;
-webkit-border-radius
:
3px
;
...
...
@@ -402,6 +536,7 @@ form label {
font-weight
:
normal
;
padding
:
4px
10px
;
text-decoration
:
none
;
&
:hover
{
background
:
#DDD
;
}
...
...
lms/static/sass/course/courseware/_courseware.scss
View file @
272c7b8b
...
...
@@ -87,6 +87,11 @@ div.course-wrapper {
ul
{
list-style
:
disc
outside
none
;
padding-left
:
1em
;
&
.discussion-errors
{
list-style
:
none
;
padding-left
:
2em
;
}
}
nav
.sequence-bottom
{
...
...
lms/templates/discussion/_blank_slate.html
View file @
272c7b8b
<div
class=
"blank-state"
>
% if performed_search:
There is no result matching your search parameters
.
Sorry! We can't find anything matching your search. Please try another search
.
% else:
There
is no post
here yet. Be the first one to post!
There
are no posts
here yet. Be the first one to post!
% endif
</div>
lms/templates/discussion/_forum.html
View file @
272c7b8b
...
...
@@ -14,18 +14,20 @@
</div>
<div
class=
"discussion-new-post control-button"
href=
"javascript:void(0)"
>
New Post
</div>
</div>
<
%
include
file=
"_sort.html"
/>
% if len(threads) == 0:
<
%
include
file=
"_blank_slate.html"
/>
<div
class=
"blank"
>
<
%
include
file=
"_blank_slate.html"
/>
</div>
<div
class=
"threads"
></div>
% else:
<
%
include
file=
"_sort.html"
/>
<div
class=
"threads"
>
% for thread in threads:
${renderer.render_thread(course_id, thread, show_comments=False)}
% endfor
</div>
<
%
include
file=
"_paginator.html"
/>
% endif
<
%
include
file=
"_paginator.html"
/>
</section>
<
%!
...
...
lms/templates/discussion/_inline.html
View file @
272c7b8b
...
...
@@ -6,19 +6,21 @@
<
%
include
file=
"_search_bar.html"
/>
</div>
<div
class=
"discussion-new-post control-button"
href=
"javascript:void(0)"
>
New Post
</div>
<
%
include
file=
"_sort.html"
/>
</div>
% if len(threads) == 0:
<
%
include
file=
"_blank_slate.html"
/>
<div
class=
"blank"
>
<
%
include
file=
"_blank_slate.html"
/>
</div>
<div
class=
"threads"
></div>
% else:
<
%
include
file=
"_sort.html"
/>
<div
class=
"threads"
>
% for thread in threads:
${renderer.render_thread(course_id, thread, show_comments=False)}
% endfor
</div>
<
%
include
file=
"_paginator.html"
/>
% endif
<
%
include
file=
"_paginator.html"
/>
</section>
<
%!
...
...
lms/templates/discussion/_recent_active_posts.html
0 → 100644
View file @
272c7b8b
<div
class=
"recent-activity"
>
Recent Activity:
<div
class=
"recent-active-posts"
>
% for thread in recent_active_threads:
<a
class=
"recent-active-post"
href=
"javascript:void(0)"
>
${thread['title']}
</a>
% endfor
</div>
lms/templates/discussion/_thread.html
View file @
272c7b8b
...
...
@@ -123,7 +123,7 @@
% if content['anonymous']:
anonymous
% else:
user No.${content['user_id']}
${content['username']}
<!---# TODO add link to user-->
% endif
</div>
<div
class=
"comment-count"
>
...
...
lms/templates/discussion/_trending_tags.html
0 → 100644
View file @
272c7b8b
Trending tags:
<div
class=
"trending-tags"
>
% for tag, count in trending_tags:
<div
class=
"trending-tag"
>
<a
class=
"trending-tag-link"
href=
"javascript:void(0)"
>
${tag}
</a>
×
<span
class=
"trending-tag-count"
>
${count}
</span>
</div>
% endfor
</div>
lms/templates/discussion/index.html
View file @
272c7b8b
...
...
@@ -26,6 +26,8 @@
${accordion}
</nav>
</div>
<
%
include
file=
"_recent_active_posts.html"
/>
<
%
include
file=
"_trending_tags.html"
/>
</section>
<section
class=
"course-content"
>
...
...
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