Add always_cohort_inline_discussions in course settings
This commit is contained in:
committed by
Jonathan Piacenti
parent
a07df1a645
commit
68fcdcc030
@@ -913,6 +913,19 @@ class CourseDescriptor(CourseFields, SequenceDescriptor):
|
||||
|
||||
return set(config.get("cohorted_discussions", []))
|
||||
|
||||
@property
|
||||
def always_cohort_inline_discussions(self):
|
||||
"""
|
||||
This allow to change the default behavior of inline discussions cohorting. By
|
||||
setting this to False, all inline discussions are non-cohorted unless their
|
||||
ids are specified in cohorted_discussions.
|
||||
"""
|
||||
config = self.cohort_config
|
||||
if config is None:
|
||||
return True
|
||||
|
||||
return bool(config.get("always_cohort_inline_discussions", True))
|
||||
|
||||
@property
|
||||
def is_newish(self):
|
||||
"""
|
||||
|
||||
@@ -11,7 +11,11 @@ _ = lambda text: text
|
||||
|
||||
|
||||
class DiscussionFields(object):
|
||||
discussion_id = String(scope=Scope.settings, default="$$GUID$$")
|
||||
discussion_id = String(
|
||||
display_name=_("Discussion Id"),
|
||||
help=_("The id is a unique identifier for the discussion. It is non editable."),
|
||||
scope=Scope.settings,
|
||||
default="$$GUID$$")
|
||||
display_name = String(
|
||||
display_name=_("Display Name"),
|
||||
help=_("Display name for this module"),
|
||||
|
||||
@@ -116,7 +116,8 @@ if Backbone?
|
||||
el: @newPostForm,
|
||||
collection: @discussion,
|
||||
course_settings: @course_settings,
|
||||
topicId: discussionId
|
||||
topicId: discussionId,
|
||||
is_commentable_cohorted: response.is_commentable_cohorted
|
||||
)
|
||||
@newPostView.render()
|
||||
@listenTo( @newPostView, 'newPost:cancel', @hideNewPost )
|
||||
|
||||
@@ -6,12 +6,14 @@ if Backbone?
|
||||
if @mode not in ["tab", "inline"]
|
||||
throw new Error("invalid mode: " + @mode)
|
||||
@course_settings = options.course_settings
|
||||
@is_commentable_cohorted = options.is_commentable_cohorted
|
||||
@topicId = options.topicId
|
||||
|
||||
render: () ->
|
||||
context = _.clone(@course_settings.attributes)
|
||||
_.extend(context, {
|
||||
cohort_options: @getCohortOptions(),
|
||||
is_commentable_cohorted: @is_commentable_cohorted,
|
||||
mode: @mode,
|
||||
form_id: @mode + (if @topicId then "-" + @topicId else "")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user