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
70ba1ff9
Commit
70ba1ff9
authored
Sep 03, 2012
by
David Ormsbee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #595 from MITx/feature/ibrahim/discussion_sort_preferences
Feature/ibrahim/discussion sort preferences
parents
80353b0a
6f8926e7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
9 deletions
+22
-9
lms/djangoapps/django_comment_client/forum/views.py
+13
-1
lms/envs/common.py
+3
-3
lms/lib/comment_client/user.py
+2
-2
lms/static/sass/_discussion.scss
+2
-1
lms/templates/discussion/_sort.html
+2
-2
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
70ba1ff9
...
...
@@ -112,7 +112,7 @@ def get_threads(request, course_id, discussion_id=None):
default_query_params
=
{
'page'
:
1
,
'per_page'
:
THREADS_PER_PAGE
,
'sort_key'
:
'
activity
'
,
'sort_key'
:
'
date
'
,
'sort_order'
:
'desc'
,
'text'
:
''
,
'tags'
:
''
,
...
...
@@ -120,6 +120,18 @@ def get_threads(request, course_id, discussion_id=None):
'course_id'
:
course_id
,
}
if
not
request
.
GET
.
get
(
'sort_key'
):
# If the user did not select a sort key, use their last used sort key
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user
.
retrieve
()
# TODO: After the comment service is updated this can just be user.default_sort_key because the service returns the default value
default_query_params
[
'sort_key'
]
=
user
.
get
(
'default_sort_key'
)
or
default_query_params
[
'sort_key'
]
else
:
# If the user clicked a sort key, update their default sort key
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user
.
default_sort_key
=
request
.
GET
.
get
(
'sort_key'
)
user
.
save
()
query_params
=
merge_dict
(
default_query_params
,
strip_none
(
extract
(
request
.
GET
,
[
'page'
,
'sort_key'
,
'sort_order'
,
'text'
,
'tags'
])))
...
...
lms/envs/common.py
View file @
70ba1ff9
...
...
@@ -432,7 +432,7 @@ main_vendor_js = [
'js/vendor/jquery.qtip.min.js'
,
]
discussion_js
=
glob2
.
glob
(
PROJECT_ROOT
/
'static/coffee/src/discussion/*.coffee'
)
discussion_js
=
sorted
(
glob2
.
glob
(
PROJECT_ROOT
/
'static/coffee/src/discussion/*.coffee'
)
)
# Load javascript from all of the available xmodules, and
# prep it for use in pipeline js
...
...
@@ -500,10 +500,10 @@ PIPELINE_JS = {
'source_filenames'
:
[
pth
.
replace
(
COMMON_ROOT
/
'static/'
,
''
)
for
pth
in
glob2
.
glob
(
COMMON_ROOT
/
'static/coffee/src/**/*.coffee'
)
in
sorted
(
glob2
.
glob
(
COMMON_ROOT
/
'static/coffee/src/**/*.coffee'
)
)
]
+
[
pth
.
replace
(
PROJECT_ROOT
/
'static/'
,
''
)
for
pth
in
glob2
.
glob
(
PROJECT_ROOT
/
'static/coffee/src/**/*.coffee'
)
\
for
pth
in
sorted
(
glob2
.
glob
(
PROJECT_ROOT
/
'static/coffee/src/**/*.coffee'
)
)
\
if
pth
not
in
courseware_only_js
and
pth
not
in
discussion_js
]
+
[
'js/form.ext.js'
,
...
...
lms/lib/comment_client/user.py
View file @
70ba1ff9
...
...
@@ -8,10 +8,10 @@ class User(models.Model):
accessible_fields
=
[
'username'
,
'email'
,
'follower_ids'
,
'upvoted_ids'
,
'downvoted_ids'
,
'id'
,
'external_id'
,
'subscribed_user_ids'
,
'children'
,
'course_id'
,
'subscribed_thread_ids'
,
'subscribed_commentable_ids'
,
'threads_count'
,
'comments_count'
,
'threads_count'
,
'comments_count'
,
'default_sort_key'
]
updatable_fields
=
[
'username'
,
'external_id'
,
'email'
]
updatable_fields
=
[
'username'
,
'external_id'
,
'email'
,
'default_sort_key'
]
initializable_fields
=
updatable_fields
base_url
=
"{prefix}/users"
.
format
(
prefix
=
settings
.
PREFIX
)
...
...
lms/static/sass/_discussion.scss
View file @
70ba1ff9
...
...
@@ -506,7 +506,8 @@ $tag-text-color: #5b614f;
font-size
:
inherit
;
font-weight
:
bold
;
margin-left
:
1%
;
padding-top
:
9px
;
padding-top
:
4px
;
padding-bottom
:
2px
;
text-decoration
:
none
;
}
...
...
lms/templates/discussion/_sort.html
View file @
70ba1ff9
...
...
@@ -31,9 +31,9 @@
<div
class=
"discussion-sort local"
>
<span
class=
"discussion-label"
>
Sort by:
</span>
${link_to_sort('activity', 'top')}
${link_to_sort('date', 'date')}
${link_to_sort('activity', 'top')}
${link_to_sort('votes', 'votes')}
...
...
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