Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
cda7fd0d
Commit
cda7fd0d
authored
Mar 26, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up display_name hack - fix to Studio submitted upstream
parent
67048650
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
9 additions
and
39 deletions
+9
-39
mentoring/answer.py
+1
-7
mentoring/choice.py
+1
-7
mentoring/message.py
+1
-7
mentoring/questionnaire.py
+1
-7
mentoring/templates/html/answer_editable.html
+1
-1
mentoring/templates/html/mcqblock.html
+1
-1
mentoring/templates/html/mrqblock.html
+1
-1
mentoring/templates/html/ratingblock.html
+1
-1
mentoring/tip.py
+1
-7
No files found.
mentoring/answer.py
View file @
cda7fd0d
...
@@ -144,17 +144,11 @@ class AnswerBlock(AnswerMixin, StepMixin, StudioEditableXBlockMixin, XBlock):
...
@@ -144,17 +144,11 @@ class AnswerBlock(AnswerMixin, StepMixin, StudioEditableXBlockMixin, XBlock):
editable_fields
=
(
'question'
,
'name'
,
'min_characters'
,
'weight'
,
'default_from'
)
editable_fields
=
(
'question'
,
'name'
,
'min_characters'
,
'weight'
,
'default_from'
)
@property
@property
def
studio_display_name
(
self
):
def
display_name_with_default
(
self
):
if
not
self
.
lonely_step
:
if
not
self
.
lonely_step
:
return
self
.
_
(
u"Question {number}"
)
.
format
(
number
=
self
.
step_number
)
return
self
.
_
(
u"Question {number}"
)
.
format
(
number
=
self
.
step_number
)
return
self
.
_
(
u"Question"
)
return
self
.
_
(
u"Question"
)
def
__getattribute__
(
self
,
name
):
""" Provide a read-only display name without adding a display_name field to the class. """
if
name
==
"display_name"
:
return
self
.
studio_display_name
return
super
(
AnswerBlock
,
self
)
.
__getattribute__
(
name
)
@lazy
@lazy
def
student_input
(
self
):
def
student_input
(
self
):
"""
"""
...
...
mentoring/choice.py
View file @
cda7fd0d
...
@@ -61,19 +61,13 @@ class ChoiceBlock(StudioEditableXBlockMixin, XBlock):
...
@@ -61,19 +61,13 @@ class ChoiceBlock(StudioEditableXBlockMixin, XBlock):
return
self
.
runtime
.
service
(
self
,
"i18n"
)
.
ugettext
(
text
)
return
self
.
runtime
.
service
(
self
,
"i18n"
)
.
ugettext
(
text
)
@property
@property
def
studio_display_name
(
self
):
def
display_name_with_default
(
self
):
try
:
try
:
status
=
self
.
get_parent
()
.
describe_choice_correctness
(
self
.
value
)
status
=
self
.
get_parent
()
.
describe_choice_correctness
(
self
.
value
)
except
Exception
:
except
Exception
:
status
=
self
.
_
(
u"Out of Context"
)
# Parent block should implement describe_choice_correctness()
status
=
self
.
_
(
u"Out of Context"
)
# Parent block should implement describe_choice_correctness()
return
self
.
_
(
u"Choice ({status})"
)
.
format
(
status
=
status
)
return
self
.
_
(
u"Choice ({status})"
)
.
format
(
status
=
status
)
def
__getattribute__
(
self
,
name
):
""" Provide a read-only display name without adding a display_name field to the class. """
if
name
==
"display_name"
:
return
self
.
studio_display_name
return
super
(
ChoiceBlock
,
self
)
.
__getattribute__
(
name
)
def
fallback_view
(
self
,
view_name
,
context
):
def
fallback_view
(
self
,
view_name
,
context
):
return
Fragment
(
u'<span class="choice-text">{}</span>'
.
format
(
self
.
content
))
return
Fragment
(
u'<span class="choice-text">{}</span>'
.
format
(
self
.
content
))
...
...
mentoring/message.py
View file @
cda7fd0d
...
@@ -69,7 +69,7 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin):
...
@@ -69,7 +69,7 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin):
return
Fragment
(
html
)
return
Fragment
(
html
)
@property
@property
def
studio_display_name
(
self
):
def
display_name_with_default
(
self
):
if
self
.
type
==
'max_attempts_reached'
:
if
self
.
type
==
'max_attempts_reached'
:
max_attempts
=
self
.
get_parent
()
.
max_attempts
max_attempts
=
self
.
get_parent
()
.
max_attempts
return
self
.
_
(
u"Message when student reaches max. # of attempts ({limit})"
)
.
format
(
return
self
.
_
(
u"Message when student reaches max. # of attempts ({limit})"
)
.
format
(
...
@@ -81,12 +81,6 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin):
...
@@ -81,12 +81,6 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin):
return
self
.
_
(
u"Message shown when incomplete"
)
return
self
.
_
(
u"Message shown when incomplete"
)
return
u"INVALID MESSAGE"
return
u"INVALID MESSAGE"
def
__getattribute__
(
self
,
name
):
""" Provide a read-only display name without adding a display_name field to the class. """
if
name
==
"display_name"
:
return
self
.
studio_display_name
return
super
(
MentoringMessageBlock
,
self
)
.
__getattribute__
(
name
)
@classmethod
@classmethod
def
get_template
(
cls
,
template_id
):
def
get_template
(
cls
,
template_id
):
"""
"""
...
...
mentoring/questionnaire.py
View file @
cda7fd0d
...
@@ -114,17 +114,11 @@ class QuestionnaireAbstractBlock(StudioEditableXBlockMixin, StudioContainerXBloc
...
@@ -114,17 +114,11 @@ class QuestionnaireAbstractBlock(StudioEditableXBlockMixin, StudioContainerXBloc
return
block
return
block
@property
@property
def
studio_display_name
(
self
):
def
display_name_with_default
(
self
):
if
not
self
.
lonely_step
:
if
not
self
.
lonely_step
:
return
self
.
_
(
u"Question {number}"
)
.
format
(
number
=
self
.
step_number
)
return
self
.
_
(
u"Question {number}"
)
.
format
(
number
=
self
.
step_number
)
return
self
.
_
(
u"Question"
)
return
self
.
_
(
u"Question"
)
def
__getattribute__
(
self
,
name
):
""" Provide a read-only display name without adding a display_name field to the class. """
if
name
==
"display_name"
:
return
self
.
studio_display_name
return
super
(
QuestionnaireAbstractBlock
,
self
)
.
__getattribute__
(
name
)
def
student_view
(
self
,
context
=
None
):
def
student_view
(
self
,
context
=
None
):
name
=
getattr
(
self
,
"unmixed_class"
,
self
.
__class__
)
.
__name__
name
=
getattr
(
self
,
"unmixed_class"
,
self
.
__class__
)
.
__name__
...
...
mentoring/templates/html/answer_editable.html
View file @
cda7fd0d
<div
class=
"xblock-answer"
data-completed=
"{{ self.completed }}"
>
<div
class=
"xblock-answer"
data-completed=
"{{ self.completed }}"
>
{% if not hide_header %}
<h3
class=
"question-title"
>
{{ self.display_name }}
</h3>
{% endif %}
{% if not hide_header %}
<h3
class=
"question-title"
>
{{ self.display_name
_with_default
}}
</h3>
{% endif %}
<p>
{{ self.question }}
</p>
<p>
{{ self.question }}
</p>
<textarea
<textarea
class=
"answer editable"
cols=
"50"
rows=
"10"
name=
"input"
class=
"answer editable"
cols=
"50"
rows=
"10"
name=
"input"
...
...
mentoring/templates/html/mcqblock.html
View file @
cda7fd0d
<fieldset
class=
"choices questionnaire"
>
<fieldset
class=
"choices questionnaire"
>
<legend
class=
"question"
>
<legend
class=
"question"
>
{% if not hide_header %}
<h3
class=
"question-title"
>
{{ self.display_name }}
</h3>
{% endif %}
{% if not hide_header %}
<h3
class=
"question-title"
>
{{ self.display_name
_with_default
}}
</h3>
{% endif %}
<p>
{{ self.question }}
</p>
<p>
{{ self.question }}
</p>
</legend>
</legend>
<div
class=
"choices-list"
>
<div
class=
"choices-list"
>
...
...
mentoring/templates/html/mrqblock.html
View file @
cda7fd0d
<fieldset
class=
"choices questionnaire"
data-hide_results=
"{{self.hide_results}}"
>
<fieldset
class=
"choices questionnaire"
data-hide_results=
"{{self.hide_results}}"
>
<legend
class=
"question"
>
<legend
class=
"question"
>
{% if not hide_header %}
<h3
class=
"question-title"
>
{{ self.display_name }}
</h3>
{% endif %}
{% if not hide_header %}
<h3
class=
"question-title"
>
{{ self.display_name
_with_default
}}
</h3>
{% endif %}
<p>
{{ self.question }}
</p>
<p>
{{ self.question }}
</p>
</legend>
</legend>
<div
class=
"choices-list"
>
<div
class=
"choices-list"
>
...
...
mentoring/templates/html/ratingblock.html
View file @
cda7fd0d
<fieldset
class=
"rating questionnaire"
>
<fieldset
class=
"rating questionnaire"
>
<legend
class=
"question"
>
<legend
class=
"question"
>
{% if not hide_header %}
<h3
class=
"question-title"
>
{{ self.display_name }}
</h3>
{% endif %}
{% if not hide_header %}
<h3
class=
"question-title"
>
{{ self.display_name
_with_default
}}
</h3>
{% endif %}
<p>
{{ self.question }}
</p>
<p>
{{ self.question }}
</p>
</legend>
</legend>
<div
class=
"choices-list"
>
<div
class=
"choices-list"
>
...
...
mentoring/tip.py
View file @
cda7fd0d
...
@@ -76,7 +76,7 @@ class TipBlock(StudioEditableXBlockMixin, XBlock):
...
@@ -76,7 +76,7 @@ class TipBlock(StudioEditableXBlockMixin, XBlock):
return
self
.
runtime
.
service
(
self
,
"i18n"
)
.
ugettext
(
text
)
return
self
.
runtime
.
service
(
self
,
"i18n"
)
.
ugettext
(
text
)
@property
@property
def
studio_display_name
(
self
):
def
display_name_with_default
(
self
):
values_list
=
[]
values_list
=
[]
for
entry
in
self
.
get_parent
()
.
human_readable_choices
:
for
entry
in
self
.
get_parent
()
.
human_readable_choices
:
if
entry
[
"value"
]
in
self
.
values
:
if
entry
[
"value"
]
in
self
.
values
:
...
@@ -86,12 +86,6 @@ class TipBlock(StudioEditableXBlockMixin, XBlock):
...
@@ -86,12 +86,6 @@ class TipBlock(StudioEditableXBlockMixin, XBlock):
values_list
.
append
(
display_name
)
values_list
.
append
(
display_name
)
return
self
.
_
(
u"Tip for {list_of_choices}"
)
.
format
(
list_of_choices
=
u", "
.
join
(
values_list
))
return
self
.
_
(
u"Tip for {list_of_choices}"
)
.
format
(
list_of_choices
=
u", "
.
join
(
values_list
))
def
__getattribute__
(
self
,
name
):
""" Provide a read-only display name without adding a display_name field to the class. """
if
name
==
"display_name"
:
return
self
.
studio_display_name
return
super
(
TipBlock
,
self
)
.
__getattribute__
(
name
)
def
fallback_view
(
self
,
view_name
,
context
):
def
fallback_view
(
self
,
view_name
,
context
):
html
=
ResourceLoader
(
__name__
)
.
render_template
(
"templates/html/tip.html"
,
{
html
=
ResourceLoader
(
__name__
)
.
render_template
(
"templates/html/tip.html"
,
{
'content'
:
self
.
content
,
'content'
:
self
.
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