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
d240c922
Commit
d240c922
authored
May 15, 2015
by
E. Kolpakov
Committed by
Jonathan Piacenti
Jun 09, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Part of jump to children prototype - XBlock-side support for jumping to children
parent
42901b10
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
0 deletions
+48
-0
problem_builder/__init__.py
+1
-0
problem_builder/beeper.py
+45
-0
problem_builder/templates/html/mentoring_add_buttons.html
+1
-0
setup.py
+1
-0
No files found.
problem_builder/__init__.py
View file @
d240c922
...
...
@@ -7,3 +7,4 @@ from .mrq import MRQBlock
from
.message
import
MentoringMessageBlock
from
.table
import
MentoringTableBlock
,
MentoringTableColumn
from
.tip
import
TipBlock
from
.beeper
import
BeeperBlock
problem_builder/beeper.py
0 → 100644
View file @
d240c922
from
xblock.core
import
XBlock
from
xblock.fields
import
Scope
,
String
from
xblock.fragment
import
Fragment
from
xblockutils.studio_editable
import
StudioEditableXBlockMixin
# Make '_' a no-op so we can scrape strings
def
_
(
text
):
return
text
class
BeeperBlock
(
StudioEditableXBlockMixin
,
XBlock
):
""" Dummy XBlock to demonstrate navigation to children """
content
=
String
(
display_name
=
_
(
"Beeper Text"
),
help
=
_
(
"Text to display"
),
scope
=
Scope
.
content
,
default
=
""
,
)
editable_fields
=
(
'content'
,)
def
student_view
(
self
,
context
):
normalized_id
=
self
.
scope_ids
.
usage_id
.
replace
(
run
=
None
,
branch
=
None
,
version_guid
=
None
)
fragment
=
Fragment
()
if
context
.
get
(
'activate_block_id'
,
None
)
==
normalized_id
:
fragment
.
add_javascript
(
"alert('{content}')"
.
format
(
content
=
self
.
content
))
return
fragment
def
author_view
(
self
,
content
):
fragment
=
Fragment
()
fragment
.
add_content
(
unicode
(
_
(
"<div>Beeper ID: {id}</div><div>Beeper Message: {message}</div>"
)
.
format
(
id
=
self
.
id
,
message
=
self
.
content
)
))
return
fragment
@property
def
id
(
self
):
"""
Get the url_name for this block. In Studio/LMS it is provided by a mixin, so we just
defer to super(). In the workbench or any other platform, we use the usage_id.
"""
try
:
return
super
(
BeeperBlock
,
self
)
.
url_name
except
AttributeError
:
return
unicode
(
self
.
scope_ids
.
usage_id
)
problem_builder/templates/html/mentoring_add_buttons.html
View file @
d240c922
...
...
@@ -11,6 +11,7 @@
<li><a
href=
"#"
class=
"single-template add-xblock-component-button"
data-category=
"html"
>
{% trans "HTML" %}
</a></li>
<li><a
href=
"#"
class=
"single-template add-xblock-component-button"
data-category=
"pb-answer-recap"
>
{% trans "Long Answer Recap" %}
</a></li>
<li><a
href=
"#"
class=
"single-template add-xblock-component-button"
data-category=
"pb-table"
>
{% trans "Answer Recap Table" %}
</a></li>
<li><a
href=
"#"
class=
"single-template add-xblock-component-button"
data-category=
"pb-beeper"
>
{% trans "Beeper" %}
</a></li>
<li><a
href=
"#"
class=
"single-template add-xblock-component-button"
data-category=
"pb-message"
data-boilerplate=
"completed"
>
{% trans "Message (Complete)" %}
</a></li>
<li><a
href=
"#"
class=
"single-template add-xblock-component-button"
data-category=
"pb-message"
data-boilerplate=
"incomplete"
>
{% trans "Message (Incomplete)" %}
</a></li>
<li><a
href=
"#"
class=
"single-template add-xblock-component-button"
data-category=
"pb-message"
data-boilerplate=
"max_attempts_reached"
>
{% trans "Message (Max # Attempts)" %}
</a></li>
...
...
setup.py
View file @
d240c922
...
...
@@ -54,6 +54,7 @@ BLOCKS = [
'pb-choice = problem_builder:ChoiceBlock'
,
'pb-dashboard = problem_builder:DashboardBlock'
,
'pb-beeper = problem_builder:BeeperBlock'
# Deprecated. You can temporarily uncomment and run 'python setup.py develop' if you have these blocks
# installed from testing mentoring v2 and need to get past an error message.
#'mentoring = problem_builder:MentoringBlock', # Deprecated alias for problem-builder
...
...
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