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
47130c91
Commit
47130c91
authored
Feb 23, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove <html> block in favour of Studio/Workbench's existing ones
parent
973c53db
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
24 additions
and
88 deletions
+24
-88
mentoring/components/__init__.py
+0
-1
mentoring/components/html.py
+0
-66
mentoring/components/templates/html/message.html
+0
-6
mentoring/mentoring.py
+12
-1
mentoring/templates/xml/mentoring_data_export.xml
+2
-2
mentoring/templates/xml/mentoring_default.xml
+2
-2
mentoring/templates/xml/mentoring_with_only_one_step.xml
+2
-2
mentoring/tests/integration/xml/answer_edit_1.xml
+2
-2
mentoring/tests/integration/xml/data_export.xml
+4
-5
setup.py
+0
-1
No files found.
mentoring/components/__init__.py
View file @
47130c91
from
.answer
import
AnswerBlock
from
.choice
import
ChoiceBlock
from
.html
import
HTMLBlock
from
.mcq
import
MCQBlock
from
.mrq
import
MRQBlock
from
.message
import
MentoringMessageBlock
...
...
mentoring/components/html.py
deleted
100644 → 0
View file @
973c53db
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Harvard
#
# Authors:
# Xavier Antoviaque <xavier@antoviaque.org>
#
# 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 ###########################################################
from
lxml
import
etree
from
xblock.core
import
XBlock
from
xblock.fields
import
Scope
,
String
from
xblock.fragment
import
Fragment
# Classes ###########################################################
class
HTMLBlock
(
XBlock
):
"""
Render content as HTML
"""
FIXED_CSS_CLASS
=
"html_child"
content
=
String
(
help
=
"HTML content"
,
scope
=
Scope
.
content
,
default
=
""
)
css_class
=
String
(
help
=
"CSS Class[es] applied to wrapper div element"
,
scope
=
Scope
.
content
,
default
=
""
)
@classmethod
def
parse_xml
(
cls
,
node
,
runtime
,
keys
,
id_generator
):
"""
Construct this XBlock from the given XML node.
"""
block
=
runtime
.
construct_xblock_from_class
(
cls
,
keys
)
if
node
.
get
(
'class'
):
# Older API used "class" property, not "css_class"
node
.
set
(
'css_class'
,
node
.
get
(
'css_class'
,
node
.
get
(
'class'
)))
del
node
.
attrib
[
'class'
]
block
.
css_class
=
node
.
get
(
'css_class'
)
block
.
content
=
unicode
(
node
.
text
or
u""
)
for
child
in
node
:
block
.
content
+=
etree
.
tostring
(
child
,
encoding
=
'unicode'
)
return
block
def
fallback_view
(
self
,
view_name
,
context
=
None
):
""" Default view handler """
css_class
=
' '
.
join
(
cls
for
cls
in
(
self
.
css_class
,
self
.
FIXED_CSS_CLASS
)
if
cls
)
html
=
u'<div class="{classes}">{content}</div>'
.
format
(
classes
=
css_class
,
content
=
unicode
(
self
.
content
))
return
Fragment
(
html
)
mentoring/components/templates/html/message.html
deleted
100644 → 0
View file @
973c53db
<div
class=
"message {{ self.type }}"
>
{% if self.content %}
<p>
{{ self.content }}
</p>
{% endif %}
{{ child_content|safe }}
</div>
mentoring/mentoring.py
View file @
47130c91
...
...
@@ -190,7 +190,18 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
if
isinstance
(
child
,
MentoringMessageBlock
):
pass
# TODO
else
:
child_fragment
=
child
.
render
(
'mentoring_view'
,
context
)
try
:
child_fragment
=
child
.
render
(
'mentoring_view'
,
context
)
except
NoSuchViewError
:
if
child
.
scope_ids
.
block_type
==
'html'
:
if
getattr
(
self
.
runtime
,
'is_author_mode'
,
False
):
# html block doesn't support mentoring_view, and if we use student_view Studio will wrap
# it in HTML that we don't want in the preview. So just render its HTML directly:
child_fragment
=
Fragment
(
child
.
data
)
else
:
child_fragment
=
child
.
render
(
'student_view'
,
context
)
else
:
raise
# This type of child is not supported.
fragment
.
add_frag_resources
(
child_fragment
)
child_content
+=
child_fragment
.
content
...
...
mentoring/templates/xml/mentoring_data_export.xml
View file @
47130c91
<vertical_demo>
<html>
<html
_demo
>
<p>
Below are two mentoring blocks and a grade export block that
should be able to export their data as CSV.
</p>
</html>
</html
_demo
>
<mentoring
display_name=
"Mentoring Block 1"
mode=
"standard"
>
<html_demo>
<p>
Please answer the question below.
</p>
...
...
mentoring/templates/xml/mentoring_default.xml
View file @
47130c91
...
...
@@ -42,9 +42,9 @@
</mrq>
<message
type=
"completed"
>
<
html><p>
Congratulations!
</p></html
>
<
p>
Congratulations!
</p
>
</message>
<message
type=
"incomplete"
>
<
html><p>
Still some work to do...
</p></html
>
<
p>
Still some work to do...
</p
>
</message>
</mentoring>
mentoring/templates/xml/mentoring_with_only_one_step.xml
View file @
47130c91
...
...
@@ -18,9 +18,9 @@
</mrq>
<message
type=
"completed"
>
<
html><p>
Congratulations!
</p></html
>
<
p>
Congratulations!
</p
>
</message>
<message
type=
"incomplete"
>
<
html><p>
Still some work to do...
</p></html
>
<
p>
Still some work to do...
</p
>
</message>
</mentoring>
mentoring/tests/integration/xml/answer_edit_1.xml
View file @
47130c91
<vertical_demo>
<mentoring
url_name=
"answer_edit_1"
enforce_dependency=
"false"
>
<html>
<html
_demo
>
<p>
This should be displayed in the answer_edit scenario
</p>
</html>
</html
_demo
>
<answer
name=
"answer_1"
/>
</mentoring>
...
...
mentoring/tests/integration/xml/data_export.xml
View file @
47130c91
<vertical_demo>
<html>
<html
_demo
>
<p>
Below are two mentoring blocks and a grade export block that
should be able to export their data as CSV.
</p>
</html>
</html
_demo
>
<mentoring
display_name=
"Mentoring Block 1"
mode=
"standard"
>
<title>
Mentoring Block 1
</title>
<html>
<html_demo>
<p>
Please answer the question below.
</p>
</html>
</html
_demo
>
<answer
name=
"goal"
>
<question>
What is your goal?
</question>
...
...
setup.py
View file @
47130c91
...
...
@@ -47,7 +47,6 @@ BLOCKS = [
'mentoring-dataexport = mentoring:MentoringDataExportBlock'
,
'mentoring-table = mentoring.components:MentoringTableBlock'
,
'html = mentoring.components:HTMLBlock'
,
'mentoring-column = mentoring.components:MentoringTableColumn'
,
'mentoring-answer = mentoring.components:AnswerBlock'
,
'mentoring-answer-recap = mentoring.components:AnswerRecapBlock'
,
...
...
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