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
f8c997e6
Commit
f8c997e6
authored
Apr 22, 2014
by
Alan Boudreault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a title element
parent
23d9de72
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
2 deletions
+58
-2
mentoring/__init__.py
+1
-0
mentoring/mentoring.py
+12
-1
mentoring/templates/html/mentoring.html
+3
-0
mentoring/title.py
+40
-0
setup.py
+2
-1
No files found.
mentoring/__init__.py
View file @
f8c997e6
...
@@ -8,3 +8,4 @@ from .mentoring import MentoringBlock
...
@@ -8,3 +8,4 @@ from .mentoring import MentoringBlock
from
.message
import
MentoringMessageBlock
from
.message
import
MentoringMessageBlock
from
.table
import
MentoringTableBlock
,
MentoringTableColumnBlock
,
MentoringTableColumnHeaderBlock
from
.table
import
MentoringTableBlock
,
MentoringTableColumnBlock
,
MentoringTableColumnHeaderBlock
from
.tip
import
TipBlock
from
.tip
import
TipBlock
from
.title
import
TitleBlock
mentoring/mentoring.py
View file @
f8c997e6
...
@@ -34,6 +34,7 @@ from xblock.fields import Boolean, Scope, String, Integer, Float
...
@@ -34,6 +34,7 @@ from xblock.fields import Boolean, Scope, String, Integer, Float
from
xblock.fragment
import
Fragment
from
xblock.fragment
import
Fragment
from
.light_children
import
XBlockWithLightChildren
from
.light_children
import
XBlockWithLightChildren
from
.title
import
TitleBlock
from
.message
import
MentoringMessageBlock
from
.message
import
MentoringMessageBlock
from
.utils
import
get_scenarios_from_path
,
load_resource
,
render_template
from
.utils
import
get_scenarios_from_path
,
load_resource
,
render_template
...
@@ -79,7 +80,7 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -79,7 +80,7 @@ class MentoringBlock(XBlockWithLightChildren):
def
student_view
(
self
,
context
):
def
student_view
(
self
,
context
):
fragment
,
named_children
=
self
.
get_children_fragment
(
fragment
,
named_children
=
self
.
get_children_fragment
(
context
,
view_name
=
'mentoring_view'
,
context
,
view_name
=
'mentoring_view'
,
not_instance_of
=
MentoringMessageBlock
not_instance_of
=
(
MentoringMessageBlock
,
TitleBlock
)
)
)
fragment
.
add_content
(
render_template
(
'templates/html/mentoring.html'
,
{
fragment
.
add_content
(
render_template
(
'templates/html/mentoring.html'
,
{
...
@@ -98,6 +99,16 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -98,6 +99,16 @@ class MentoringBlock(XBlockWithLightChildren):
return
fragment
return
fragment
@property
@property
def
title
(
self
):
"""
Returns the title child.
"""
for
child
in
self
.
get_children_objects
():
if
isinstance
(
child
,
TitleBlock
):
return
child
return
None
@property
def
has_missing_dependency
(
self
):
def
has_missing_dependency
(
self
):
"""
"""
Returns True if the student needs to complete another step before being able to complete
Returns True if the student needs to complete another step before being able to complete
...
...
mentoring/templates/html/mentoring.html
View file @
f8c997e6
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
You need to complete
<a
href=
"{{ missing_dependency_url }}"
>
the previous step
</a>
before
You need to complete
<a
href=
"{{ missing_dependency_url }}"
>
the previous step
</a>
before
attempting this step.
attempting this step.
</div>
</div>
{% if self.title %}
<h2>
{{ self.title.content }} {% if self.weight %} ({{ self.weight }} Points Possible) {% endif %}
</h2>
{% endif %}
{% for name, c in named_children %}
{% for name, c in named_children %}
{{c.body_html|safe}}
{{c.body_html|safe}}
{% endfor %}
{% endfor %}
...
...
mentoring/title.py
0 → 100644
View file @
f8c997e6
# -*- 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 ###########################################################
import
logging
from
.light_children
import
LightChild
,
Scope
,
String
# Globals ###########################################################
log
=
logging
.
getLogger
(
__name__
)
# Classes ###########################################################
class
TitleBlock
(
LightChild
):
"""
A simple html representation of a title, with the mentoring weight.
"""
content
=
String
(
help
=
"Text to display"
,
scope
=
Scope
.
content
,
default
=
""
)
setup.py
View file @
f8c997e6
...
@@ -58,7 +58,8 @@ BLOCKS_CHILDREN = [
...
@@ -58,7 +58,8 @@ BLOCKS_CHILDREN = [
'message = mentoring:MentoringMessageBlock'
,
'message = mentoring:MentoringMessageBlock'
,
'tip = mentoring:TipBlock'
,
'tip = mentoring:TipBlock'
,
'choice = mentoring:ChoiceBlock'
,
'choice = mentoring:ChoiceBlock'
,
'html = mentoring:HTMLBlock'
'html = mentoring:HTMLBlock'
,
'title = mentoring:TitleBlock'
]
]
setup
(
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