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
94bea7a7
Commit
94bea7a7
authored
Jul 06, 2017
by
Douglas Cerna
Committed by
Alex Dusenbery
Oct 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cherry picked Adolfo's commits and addressed Braden's observations
parent
40f37608
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
88 additions
and
7 deletions
+88
-7
common/static/common/js/discussion/views/discussion_inline_view.js
+2
-1
common/static/common/js/discussion/views/discussion_topic_menu_view.js
+1
-0
common/static/common/js/discussion/views/new_post_view.js
+42
-2
common/static/common/templates/discussion/new-post-visibility.underscore
+11
-0
common/static/common/templates/discussion/new-post.underscore
+7
-0
lms/djangoapps/discussion/views.py
+2
-0
lms/templates/discussion/_underscore_templates.html
+23
-4
No files found.
common/static/common/js/discussion/views/discussion_inline_view.js
View file @
94bea7a7
...
...
@@ -126,7 +126,8 @@
course_settings
:
this
.
courseSettings
,
topicId
:
discussionId
,
startHeader
:
this
.
startHeader
,
is_commentable_divided
:
response
.
is_commentable_divided
is_commentable_divided
:
response
.
is_commentable_divided
,
user_group_id
:
response
.
user_group_id
,
});
this
.
newPostView
.
render
();
...
...
common/static/common/js/discussion/views/discussion_topic_menu_view.js
View file @
94bea7a7
...
...
@@ -15,6 +15,7 @@
initialize
:
function
(
options
)
{
this
.
course_settings
=
options
.
course_settings
;
this
.
currentTopicId
=
options
.
topicId
;
this
.
group_name
=
options
.
group_name
;
_
.
bindAll
(
this
,
'handleTopicEvent'
);
...
...
common/static/common/js/discussion/views/new_post_view.js
View file @
94bea7a7
...
...
@@ -42,6 +42,7 @@
}
this
.
course_settings
=
options
.
course_settings
;
this
.
is_commentable_divided
=
options
.
is_commentable_divided
;
this
.
user_group_id
=
options
.
user_group_id
;
this
.
topicId
=
options
.
topicId
;
this
.
discussionBoardView
=
options
.
discussionBoardView
;
};
...
...
@@ -53,6 +54,7 @@
_
.
extend
(
context
,
{
group_options
:
this
.
getGroupOptions
(),
is_commentable_divided
:
this
.
is_commentable_divided
,
is_discussion_division_enabled
:
this
.
course_settings
.
get
(
'is_discussion_division_enabled'
),
mode
:
this
.
mode
,
startHeader
:
this
.
startHeader
,
form_id
:
this
.
mode
+
(
this
.
topicId
?
'-'
+
this
.
topicId
:
''
)
...
...
@@ -68,10 +70,17 @@
if
(
this
.
isTabMode
())
{
this
.
topicView
=
new
DiscussionTopicMenuView
({
topicId
:
this
.
topicId
,
course_settings
:
this
.
course_settings
course_settings
:
this
.
course_settings
,
group_name
:
this
.
getGroupName
()
});
this
.
topicView
.
on
(
'thread:topic_change'
,
this
.
toggleGroupDropdown
);
this
.
topicView
.
on
(
'thread:topic_change'
,
this
.
toggleGroupDropDown
);
if
(
this
.
course_settings
.
get
(
'is_discussion_division_enabled'
))
{
this
.
topicView
.
on
(
'thread:topic_change'
,
this
.
updateVisibilityMessage
);
}
this
.
addField
(
this
.
topicView
.
render
());
}
else
{
this
.
group_name
=
this
.
getGroupName
();
this
.
updateVisibilityMessage
(
null
,
this
.
is_commentable_divided
);
}
return
DiscussionUtil
.
makeWmdEditor
(
this
.
$el
,
$
.
proxy
(
this
.
$
,
this
),
'js-post-body'
);
};
...
...
@@ -100,6 +109,26 @@
}
};
NewPostView
.
prototype
.
getGroupName
=
function
()
{
var
userGroupId
;
var
group
;
var
group_name
=
null
;
if
(
this
.
course_settings
.
get
(
'is_discussion_division_enabled'
))
{
userGroupId
=
$
(
'#discussion-container'
).
data
(
'user-group-id'
);
if
(
!
userGroupId
)
{
userGroupId
=
this
.
user_group_id
;
}
group
=
this
.
course_settings
.
get
(
'groups'
).
find
(
function
(
group
)
{
return
group
.
id
==
userGroupId
;
});
if
(
group
)
{
group_name
=
group
.
name
;
}
}
return
group_name
;
};
NewPostView
.
prototype
.
events
=
{
'keypress .forum-new-post-form input:not(.wmd-input)'
:
function
(
event
)
{
return
DiscussionUtil
.
ignoreEnterKey
(
event
);
...
...
@@ -121,6 +150,17 @@
}
};
NewPostView
.
prototype
.
updateVisibilityMessage
=
function
(
$target
,
force_divided
)
{
var
visEl
=
$
(
'.group-visibility .field-label-text'
);
var
visTemplate
=
edx
.
HtmlUtils
.
template
(
$
(
'#new-post-visibility-template'
).
html
());
var
group_name
=
null
;
if
((
$target
&&
$target
.
data
(
'divided'
))
||
force_divided
)
{
group_name
=
this
.
group_name
;
}
edx
.
HtmlUtils
.
setHtml
(
visEl
,
visTemplate
({
group_name
:
group_name
}));
};
NewPostView
.
prototype
.
postOptionChange
=
function
(
event
)
{
var
$optionElem
,
$target
;
$target
=
$
(
event
.
target
);
...
...
common/static/common/templates/discussion/new-post-visibility.underscore
0 → 100644
View file @
94bea7a7
<% if (group_name) { %>
<%-
interpolate(
gettext('This post will be visible only to %(group_name)s.'),
{group_name: group_name},
true
)
%>
<% } else { %>
<%- gettext('This post will be visible to everyone.') %>
<% } %>
common/static/common/templates/discussion/new-post.underscore
View file @
94bea7a7
...
...
@@ -29,6 +29,13 @@
</div>
</label>
</div>
<% } else if (is_discussion_division_enabled) { %>
<div class="post-field group-visibility">
<label class="field-label">
<!-- Wrapper for the visibility message filled out by a separate template -->
<span class="field-label-text"></span>
</label>
</div>
<% } %>
<div class="post-field">
<label class="field-label">
...
...
lms/djangoapps/discussion/views.py
View file @
94bea7a7
...
...
@@ -205,11 +205,13 @@ def inline_discussion(request, course_key, discussion_id):
threads
=
[
utils
.
prepare_content
(
thread
,
course_key
,
is_staff
)
for
thread
in
threads
]
with
function_trace
(
"add_courseware_context"
):
add_courseware_context
(
threads
,
course
,
request
.
user
)
course_discussion_settings
=
get_course_discussion_settings
(
course
.
id
)
return
utils
.
JsonResponse
({
'is_commentable_divided'
:
is_commentable_divided
(
course_key
,
discussion_id
),
'discussion_data'
:
threads
,
'user_info'
:
user_info
,
'user_group_id'
:
get_group_id_for_user
(
request
.
user
,
course_discussion_settings
),
'annotated_content_info'
:
annotated_content_info
,
'page'
:
query_params
[
'page'
],
'num_pages'
:
query_params
[
'num_pages'
],
...
...
lms/templates/discussion/_underscore_templates.html
View file @
94bea7a7
...
...
@@ -13,10 +13,29 @@
<
%
template_names =
[
'
thread
',
'
thread-show
',
'
thread-edit
',
'
thread-response
',
'
thread-response-show
',
'
thread-response-edit
',
'
response-comment-show
',
'
response-comment-edit
',
'
thread-list-item
',
'
search-alert
',
'
new-post
',
'
new-post-menu-entry
',
'
new-post-menu-category
',
'
new-post-alert
',
'
topic
',
'
post-user-display
',
'
inline-discussion
',
'
pagination
',
'
profile-thread
',
'
customwmd-prompt
',
'
nav-loading
',
'
thread-type
'
'
thread
',
'
thread-show
',
'
thread-edit
',
'
thread-response
',
'
thread-response-show
',
'
thread-response-edit
',
'
response-comment-show
',
'
response-comment-edit
',
'
thread-list-item
',
'
search-alert
',
'
new-post
',
'
new-post-menu-entry
',
'
new-post-menu-category
',
'
new-post-alert
',
'
new-post-visibility
',
'
topic
',
'
post-user-display
',
'
inline-discussion
',
'
pagination
',
'
profile-thread
',
'
customwmd-prompt
',
'
nav-loading
',
'
thread-type
'
]
##
same
,
but
without
trailing
"
-template
"
in
script
ID
-
these
templates
does
not
contain
any
free
variables
...
...
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