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
c449576f
Commit
c449576f
authored
Apr 11, 2014
by
Alan Boudreault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed FeedbackBlock and added width/height in tip child
parent
ac8381b0
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
39 additions
and
96 deletions
+39
-96
README.md
+4
-4
mentoring/__init__.py
+0
-1
mentoring/feedback.py
+0
-56
mentoring/mentoring.py
+1
-2
mentoring/public/js/questionnaire.js
+16
-0
mentoring/questionnaire.py
+1
-19
mentoring/templates/html/feedback.html
+0
-5
mentoring/templates/html/mcqblock_choices.html
+2
-1
mentoring/templates/html/mcqblock_rating.html
+1
-1
mentoring/templates/html/mrqblock_choices.html
+1
-1
mentoring/templates/html/tip.html
+10
-4
mentoring/tip.py
+2
-0
setup.py
+1
-2
No files found.
README.md
View file @
c449576f
...
...
@@ -139,10 +139,10 @@ You can set the number of maximum attempts for the unit completion:
</mentoring>
```
### Custom
feedback popup window
### Custom
tip popup window size
You can
use the
`feedback`
child to have a custom popup window. Currently, only the
*width*
and
*height*
can be modified
. The value of those attribute should be valid CSS.
You can
specify
`width`
and
`height`
attributes to the
`tip`
child to customize the popup window
size
. The value of those attribute should be valid CSS.
```
xml
<mentoring
url_name=
"mcq_1"
enforce_dependency=
"false"
>
...
...
@@ -150,7 +150,7 @@ You can use the `feedback` child to have a custom popup window. Currently, only
<question>
What do you like in this MRQ?
</question>
<choice
value=
"elegance"
>
Its elegance
</choice>
...
<
feedback
width=
"100px"
height=
"50px"
/
>
<
tip
require=
"elegance"
width=
"50px"
height=
"20px"
>
This is something everyone has to like about this MRQ
</tip
>
</mrq>
</mentoring>
```
...
...
mentoring/__init__.py
View file @
c449576f
...
...
@@ -8,4 +8,3 @@ from .mentoring import MentoringBlock
from
.message
import
MentoringMessageBlock
from
.table
import
MentoringTableBlock
,
MentoringTableColumnBlock
,
MentoringTableColumnHeaderBlock
from
.tip
import
TipBlock
from
.feedback
import
FeedbackBlock
mentoring/feedback.py
deleted
100644 → 0
View file @
ac8381b0
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Harvard
#
# Authors:
# Alan Boudreault <alan@alanb.ca>
#
# This software's license gives you freedom; you can copy, convey,
# propagate, redistribute and/or modify this program under the terms of
# the GNU Affero General Public License (AGPL) as published by the Free
# Software Foundation (FSF), either version 3 of the License, or (at your
# option) any later version of the AGPL published by the FSF.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
# General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program in a file in the toplevel directory called
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
#
# Imports ###########################################################
import
logging
from
.light_children
import
LightChild
,
Scope
,
String
from
.utils
import
render_template
# Globals ###########################################################
log
=
logging
.
getLogger
(
__name__
)
# Classes ###########################################################
class
FeedbackBlock
(
LightChild
):
"""
Represent a feedback block. Currently only used to set the width/heigth style but could be
useful to set a static header/body etc.
"""
width
=
String
(
help
=
"Width of the feedback popup"
,
scope
=
Scope
.
content
,
default
=
''
)
height
=
String
(
help
=
"Height of the feedback popup"
,
scope
=
Scope
.
content
,
default
=
''
)
def
render
(
self
):
"""
Returns a fragment containing the formatted feedback
"""
fragment
,
named_children
=
self
.
get_children_fragment
({})
fragment
.
add_content
(
render_template
(
'templates/html/feedback.html'
,
{
'self'
:
self
,
'named_children'
:
named_children
,
}))
return
self
.
xblock_container
.
fragment_text_rewriting
(
fragment
)
mentoring/mentoring.py
View file @
c449576f
...
...
@@ -35,7 +35,6 @@ from xblock.fragment import Fragment
from
.light_children
import
XBlockWithLightChildren
from
.message
import
MentoringMessageBlock
from
.feedback
import
FeedbackBlock
from
.utils
import
get_scenarios_from_path
,
load_resource
,
render_template
...
...
@@ -80,7 +79,7 @@ class MentoringBlock(XBlockWithLightChildren):
def
student_view
(
self
,
context
):
fragment
,
named_children
=
self
.
get_children_fragment
(
context
,
view_name
=
'mentoring_view'
,
not_instance_of
=
(
MentoringMessageBlock
,
FeedbackBlock
)
not_instance_of
=
MentoringMessageBlock
)
fragment
.
add_content
(
render_template
(
'templates/html/mentoring.html'
,
{
...
...
mentoring/public/js/questionnaire.js
View file @
c449576f
...
...
@@ -10,6 +10,22 @@ function MessageView(element) {
showPopup
:
function
(
popupDOM
)
{
var
self
=
this
;
this
.
clearPopupEvents
();
// Set the width/height
var
tip
=
$
(
'.tip'
,
popupDOM
)[
0
];
var
data
=
$
(
tip
).
data
();
if
(
data
&&
data
.
width
)
{
popupDOM
.
css
(
'width'
,
data
.
width
)
}
else
{
popupDOM
.
css
(
'width'
,
''
)
}
if
(
data
&&
data
.
height
)
{
popupDOM
.
css
(
'height'
,
data
.
height
);
}
else
{
popupDOM
.
css
(
'height'
,
''
)
}
popupDOM
.
show
();
popupDOM
.
on
(
'click'
,
function
()
{
self
.
clearPopupEvents
();
...
...
mentoring/questionnaire.py
View file @
c449576f
...
...
@@ -30,7 +30,6 @@ from xblock.fragment import Fragment
from
.choice
import
ChoiceBlock
from
.light_children
import
LightChild
,
Scope
,
String
from
.tip
import
TipBlock
from
.feedback
import
FeedbackBlock
from
.utils
import
render_template
...
...
@@ -80,8 +79,7 @@ class QuestionnaireAbstractBlock(LightChild):
template_path
=
'templates/html/{}_{}.html'
.
format
(
name
.
lower
(),
self
.
type
)
html
=
render_template
(
template_path
,
{
'self'
:
self
,
'custom_choices'
:
self
.
custom_choices
,
'feedback'
:
self
.
get_feedback
()
.
render
()
'custom_choices'
:
self
.
custom_choices
})
fragment
=
Fragment
(
html
)
...
...
@@ -113,22 +111,6 @@ class QuestionnaireAbstractBlock(LightChild):
tips
.
append
(
child
)
return
tips
def
get_feedback
(
self
):
"""
Returns the feedback child in this block. If there is no feedback block, provide a default one.
"""
feedback
=
None
for
child
in
self
.
get_children_objects
():
if
isinstance
(
child
,
FeedbackBlock
):
feedback
=
child
break
if
feedback
is
None
:
feedback
=
FeedbackBlock
(
self
)
feedback
.
init_block_from_node
(
feedback
,[],{})
return
feedback
def
get_submission_display
(
self
,
submission
):
"""
Get the human-readable version of a submission value
...
...
mentoring/templates/html/feedback.html
deleted
100644 → 0
View file @
ac8381b0
<div
class=
"feedback"
style=
"{% if self.width %}width:{{self.width}};{% endif %}{% if self.height %}height:{{self.height}};{% endif %}"
>
</div>
mentoring/templates/html/mcqblock_choices.html
View file @
c449576f
...
...
@@ -10,6 +10,7 @@
<div
class=
"choice-tips"
></div>
</div>
{% endfor %}
{{feedback.body_html|safe}}
<div
<
div
class=
"feedback"
></div>
</div>
</fieldset>
mentoring/templates/html/mcqblock_rating.html
View file @
c449576f
...
...
@@ -35,6 +35,6 @@
<div
class=
"choice-tips"
></div>
</div>
{% endfor %}
{{feedback.body_html|safe}}
<div
class=
"feedback"
></div>
</div>
</fieldset>
mentoring/templates/html/mrqblock_choices.html
View file @
c449576f
...
...
@@ -17,6 +17,6 @@
<div
class=
"choice-tips"
></div>
</div>
{% endfor %}
{{feedback.body_html|safe}}
<div
class=
"feedback"
></div>
</div>
</fieldset>
mentoring/templates/html/tip.html
View file @
c449576f
{% if self.content %}
<p>
{{ self.content }}
</p>
{% endif %}
{% for name, c in named_children %}
{{c.body_html|safe}}
{% endfor %}
<div
class=
"tip"
{%
if
self
.
width
%}
data-width=
"{{self.width}}"
{%
endif
%}
{%
if
self
.
height
%}
data-height=
"{{self.height}}"
{%
endif
%}
>
{% if self.content %}
<p>
{{ self.content }}
</p>
{% endif %}
{% for name, c in named_children %}
{{c.body_html|safe}}
{% endfor %}
</div>
mentoring/tip.py
View file @
c449576f
...
...
@@ -57,6 +57,8 @@ class TipBlock(LightChild):
display
=
String
(
help
=
"List of choices to display the tip for"
,
scope
=
Scope
.
content
,
default
=
None
)
reject
=
String
(
help
=
"List of choices to reject"
,
scope
=
Scope
.
content
,
default
=
None
)
require
=
String
(
help
=
"List of choices to require"
,
scope
=
Scope
.
content
,
default
=
None
)
width
=
String
(
help
=
"Width of the tip popup"
,
scope
=
Scope
.
content
,
default
=
''
)
height
=
String
(
help
=
"Height of the tip popup"
,
scope
=
Scope
.
content
,
default
=
''
)
has_children
=
True
def
render
(
self
):
...
...
setup.py
View file @
c449576f
...
...
@@ -58,8 +58,7 @@ BLOCKS_CHILDREN = [
'message = mentoring:MentoringMessageBlock'
,
'tip = mentoring:TipBlock'
,
'choice = mentoring:ChoiceBlock'
,
'html = mentoring:HTMLBlock'
,
'feedback = mentoring:FeedbackBlock'
'html = mentoring:HTMLBlock'
]
setup
(
...
...
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