Commit 6c5db884 by Eugeny Kolpakov

Added `display_name` parameter to all XBlocks having student_view_data

parent 21e21468
...@@ -267,6 +267,7 @@ class AnswerBlock(SubmittingXBlockMixin, AnswerMixin, QuestionMixin, StudioEdita ...@@ -267,6 +267,7 @@ class AnswerBlock(SubmittingXBlockMixin, AnswerMixin, QuestionMixin, StudioEdita
return { return {
'id': self.name, 'id': self.name,
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self.display_name,
'type': self.CATEGORY, 'type': self.CATEGORY,
'weight': self.weight, 'weight': self.weight,
'question': self.question, 'question': self.question,
......
...@@ -74,8 +74,10 @@ class ChoiceBlock( ...@@ -74,8 +74,10 @@ class ChoiceBlock(
Returns a JSON representation of the student_view of this XBlock, Returns a JSON representation of the student_view of this XBlock,
retrievable from the Course Block API. retrievable from the Course Block API.
""" """
# display_name_with_default gives out correctness - not adding it here
return { return {
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self._(u"Choice ({content})").format(content=self.content)
'value': self.value, 'value': self.value,
'content': self.content, 'content': self.content,
} }
......
...@@ -116,6 +116,7 @@ class CompletionBlock( ...@@ -116,6 +116,7 @@ class CompletionBlock(
return { return {
'id': self.name, 'id': self.name,
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self.display_name_with_default,
'type': self.CATEGORY, 'type': self.CATEGORY,
'question': self.question, 'question': self.question,
'answer': self.answer, 'answer': self.answer,
......
...@@ -177,6 +177,7 @@ class MCQBlock(SubmittingXBlockMixin, StudentViewUserStateMixin, QuestionnaireAb ...@@ -177,6 +177,7 @@ class MCQBlock(SubmittingXBlockMixin, StudentViewUserStateMixin, QuestionnaireAb
return { return {
'id': self.name, 'id': self.name,
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self.display_name_with_default,
'type': self.CATEGORY, 'type': self.CATEGORY,
'question': self.question, 'question': self.question,
'message': self.message, 'message': self.message,
......
...@@ -923,6 +923,7 @@ class MentoringBlock( ...@@ -923,6 +923,7 @@ class MentoringBlock(
components.append(block.student_view_data()) components.append(block.student_view_data())
return { return {
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self.display_name,
'max_attempts': self.max_attempts, 'max_attempts': self.max_attempts,
'extended_feedback': self.extended_feedback, 'extended_feedback': self.extended_feedback,
'feedback_label': self.feedback_label, 'feedback_label': self.feedback_label,
...@@ -1272,6 +1273,7 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes ...@@ -1272,6 +1273,7 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
return { return {
'title': self.display_name, 'title': self.display_name,
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self.display_name,
'show_title': self.show_title, 'show_title': self.show_title,
'weight': self.weight, 'weight': self.weight,
'extended_feedback': self.extended_feedback, 'extended_feedback': self.extended_feedback,
......
...@@ -207,6 +207,7 @@ class MRQBlock(SubmittingXBlockMixin, StudentViewUserStateMixin, QuestionnaireAb ...@@ -207,6 +207,7 @@ class MRQBlock(SubmittingXBlockMixin, StudentViewUserStateMixin, QuestionnaireAb
return { return {
'id': self.name, 'id': self.name,
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self.display_name,
'title': self.display_name, 'title': self.display_name,
'type': self.CATEGORY, 'type': self.CATEGORY,
'weight': self.weight, 'weight': self.weight,
......
...@@ -362,6 +362,7 @@ class PlotBlock( ...@@ -362,6 +362,7 @@ class PlotBlock(
retrievable from the Course XBlock API. retrievable from the Course XBlock API.
""" """
return { return {
'display_name': self.display_name,
'type': self.CATEGORY, 'type': self.CATEGORY,
'title': self.display_name, 'title': self.display_name,
'q1_label': self.q1_label, 'q1_label': self.q1_label,
......
...@@ -128,6 +128,7 @@ class SliderBlock( ...@@ -128,6 +128,7 @@ class SliderBlock(
return { return {
'id': self.name, 'id': self.name,
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self.display_name_with_default,
'type': self.CATEGORY, 'type': self.CATEGORY,
'question': self.question, 'question': self.question,
'min_label': self.min_label, 'min_label': self.min_label,
......
...@@ -283,6 +283,7 @@ class MentoringStepBlock( ...@@ -283,6 +283,7 @@ class MentoringStepBlock(
return { return {
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self.display_name_with_default,
'type': self.CATEGORY, 'type': self.CATEGORY,
'title': self.display_name_with_default, 'title': self.display_name_with_default,
'show_title': self.show_title, 'show_title': self.show_title,
......
...@@ -112,6 +112,7 @@ class ConditionalMessageBlock( ...@@ -112,6 +112,7 @@ class ConditionalMessageBlock(
def student_view_data(self, context=None): def student_view_data(self, context=None):
return { return {
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self.display_name_with_default,
'type': self.CATEGORY, 'type': self.CATEGORY,
'content': self.content, 'content': self.content,
'score_condition': self.score_condition, 'score_condition': self.score_condition,
...@@ -163,6 +164,7 @@ class ScoreSummaryBlock(XBlockWithTranslationServiceMixin, XBlockWithPreviewMixi ...@@ -163,6 +164,7 @@ class ScoreSummaryBlock(XBlockWithTranslationServiceMixin, XBlockWithPreviewMixi
def student_view_data(self, context=None): def student_view_data(self, context=None):
return { return {
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self.display_name_with_default,
'type': self.CATEGORY, 'type': self.CATEGORY,
} }
...@@ -217,6 +219,7 @@ class PerQuestionFeedbackBlock(XBlockWithTranslationServiceMixin, XBlockWithPrev ...@@ -217,6 +219,7 @@ class PerQuestionFeedbackBlock(XBlockWithTranslationServiceMixin, XBlockWithPrev
def student_view_data(self, context=None): def student_view_data(self, context=None):
return { return {
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self.display_name_with_default,
'type': self.CATEGORY, 'type': self.CATEGORY,
} }
...@@ -314,6 +317,7 @@ class ReviewStepBlock( ...@@ -314,6 +317,7 @@ class ReviewStepBlock(
return { return {
'block_id': unicode(self.scope_ids.usage_id), 'block_id': unicode(self.scope_ids.usage_id),
'display_name': self.display_name,
'type': self.CATEGORY, 'type': self.CATEGORY,
'title': self.display_name, 'title': self.display_name,
'components': components, 'components': components,
......
...@@ -97,6 +97,7 @@ class TipBlock(StudioEditableXBlockMixin, XBlockWithTranslationServiceMixin, XBl ...@@ -97,6 +97,7 @@ class TipBlock(StudioEditableXBlockMixin, XBlockWithTranslationServiceMixin, XBl
def student_view_data(self, context=None): def student_view_data(self, context=None):
return { return {
'display_name': self.display_name_with_default,
'content': self.content, 'content': self.content,
'for_choices': self.values, 'for_choices': self.values,
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment