Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-drag-and-drop-v2
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
xblock-drag-and-drop-v2
Commits
21ee62c0
Commit
21ee62c0
authored
Sep 15, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to control whether or not header title is shown to students.
parent
5736ed87
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
21 additions
and
1 deletions
+21
-1
drag_and_drop_v2/drag_and_drop_v2.py
+9
-0
drag_and_drop_v2/public/js/drag_and_drop.js
+1
-0
drag_and_drop_v2/public/js/drag_and_drop_edit.js
+1
-0
drag_and_drop_v2/public/js/view.js
+5
-1
drag_and_drop_v2/templates/html/drag_and_drop_edit.html
+2
-0
tests/data/test_get_data.json
+1
-0
tests/data/test_get_html_data.json
+1
-0
tests/test_drag_and_drop_v2.py
+1
-0
No files found.
drag_and_drop_v2/drag_and_drop_v2.py
View file @
21ee62c0
...
@@ -29,6 +29,13 @@ class DragAndDropBlock(XBlock):
...
@@ -29,6 +29,13 @@ class DragAndDropBlock(XBlock):
default
=
"Drag and Drop"
default
=
"Drag and Drop"
)
)
show_title
=
Boolean
(
display_name
=
"Show title"
,
help
=
"Display the title to the user?"
,
scope
=
Scope
.
settings
,
default
=
True
)
question_text
=
String
(
question_text
=
String
(
display_name
=
"Question text"
,
display_name
=
"Question text"
,
help
=
"The question text that is displayed to the user"
,
help
=
"The question text that is displayed to the user"
,
...
@@ -128,6 +135,7 @@ class DragAndDropBlock(XBlock):
...
@@ -128,6 +135,7 @@ class DragAndDropBlock(XBlock):
@XBlock.json_handler
@XBlock.json_handler
def
studio_submit
(
self
,
submissions
,
suffix
=
''
):
def
studio_submit
(
self
,
submissions
,
suffix
=
''
):
self
.
display_name
=
submissions
[
'display_name'
]
self
.
display_name
=
submissions
[
'display_name'
]
self
.
show_title
=
submissions
[
'show_title'
]
self
.
question_text
=
submissions
[
'question_text'
]
self
.
question_text
=
submissions
[
'question_text'
]
self
.
weight
=
float
(
submissions
[
'weight'
])
self
.
weight
=
float
(
submissions
[
'weight'
])
self
.
data
=
submissions
[
'data'
]
self
.
data
=
submissions
[
'data'
]
...
@@ -244,6 +252,7 @@ class DragAndDropBlock(XBlock):
...
@@ -244,6 +252,7 @@ class DragAndDropBlock(XBlock):
}
}
data
[
'title'
]
=
self
.
display_name
data
[
'title'
]
=
self
.
display_name
data
[
'show_title'
]
=
self
.
show_title
data
[
'question_text'
]
=
self
.
question_text
data
[
'question_text'
]
=
self
.
question_text
return
data
return
data
...
...
drag_and_drop_v2/public/js/drag_and_drop.js
View file @
21ee62c0
...
@@ -244,6 +244,7 @@ function DragAndDropBlock(runtime, element) {
...
@@ -244,6 +244,7 @@ function DragAndDropBlock(runtime, element) {
var
context
=
{
var
context
=
{
header_html
:
state
.
title
,
header_html
:
state
.
title
,
show_title
:
state
.
show_title
,
question_html
:
state
.
question_text
,
question_html
:
state
.
question_text
,
popup_html
:
state
.
state
.
feedback
||
''
,
popup_html
:
state
.
state
.
feedback
||
''
,
feedback_html
:
$
.
trim
(
state
.
state
.
finished
?
state
.
feedback
.
finish
:
state
.
feedback
.
start
),
feedback_html
:
$
.
trim
(
state
.
state
.
finished
?
state
.
feedback
.
finish
:
state
.
feedback
.
start
),
...
...
drag_and_drop_v2/public/js/drag_and_drop_edit.js
View file @
21ee62c0
...
@@ -410,6 +410,7 @@ function DragAndDropEditBlock(runtime, element) {
...
@@ -410,6 +410,7 @@ function DragAndDropEditBlock(runtime, element) {
var
data
=
{
var
data
=
{
'display_name'
:
$
(
element
).
find
(
'.display-name'
).
val
(),
'display_name'
:
$
(
element
).
find
(
'.display-name'
).
val
(),
'show_title'
:
$
(
element
).
find
(
'.show-title'
).
is
(
':checked'
),
'weight'
:
$
(
element
).
find
(
'.weight'
).
val
(),
'weight'
:
$
(
element
).
find
(
'.weight'
).
val
(),
'question_text'
:
$
(
element
).
find
(
'.question-text'
).
val
(),
'question_text'
:
$
(
element
).
find
(
'.question-text'
).
val
(),
'data'
:
_fn
.
data
,
'data'
:
_fn
.
data
,
...
...
drag_and_drop_v2/public/js/view.js
View file @
21ee62c0
...
@@ -74,9 +74,13 @@
...
@@ -74,9 +74,13 @@
};
};
var
mainTemplate
=
function
(
ctx
)
{
var
mainTemplate
=
function
(
ctx
)
{
var
problemHeader
=
''
;
if
(
ctx
.
show_title
)
{
problemHeader
=
h
(
'h2.problem-header'
,
{
innerHTML
:
ctx
.
header_html
});
}
return
(
return
(
h
(
'section.xblock--drag-and-drop'
,
[
h
(
'section.xblock--drag-and-drop'
,
[
h
(
'h2.problem-header'
,
{
innerHTML
:
ctx
.
header_html
})
,
problemHeader
,
h
(
'section.problem'
,
{
role
:
'application'
},
[
h
(
'section.problem'
,
{
role
:
'application'
},
[
h
(
'div.title1'
,
'Question'
),
h
(
'div.title1'
,
'Question'
),
h
(
'p'
,
{
innerHTML
:
ctx
.
question_html
})
h
(
'p'
,
{
innerHTML
:
ctx
.
question_html
})
...
...
drag_and_drop_v2/templates/html/drag_and_drop_edit.html
View file @
21ee62c0
...
@@ -17,6 +17,8 @@
...
@@ -17,6 +17,8 @@
<form
class=
"feedback-form"
>
<form
class=
"feedback-form"
>
<h3>
Question title
</h3>
<h3>
Question title
</h3>
<input
class=
"display-name"
value=
"{{ self.display_name }}"
/>
<input
class=
"display-name"
value=
"{{ self.display_name }}"
/>
<input
class=
"show-title"
type=
"checkbox"
value=
"{{ self.show_title }}"
{%
if
self
.
show_title
%}
checked=
"checked"
{%
endif
%}
>
Show title
<h3>
Maximum score
</h3>
<h3>
Maximum score
</h3>
<input
class=
"weight"
value=
"1"
value=
"{{ self.weight }}"
/>
<input
class=
"weight"
value=
"1"
value=
"{{ self.weight }}"
/>
...
...
tests/data/test_get_data.json
View file @
21ee62c0
...
@@ -70,5 +70,6 @@
...
@@ -70,5 +70,6 @@
},
},
"targetImg"
:
"http://i0.kym-cdn.com/photos/images/newsfeed/000/030/404/1260585284155.png"
,
"targetImg"
:
"http://i0.kym-cdn.com/photos/images/newsfeed/000/030/404/1260585284155.png"
,
"title"
:
"Drag and Drop"
,
"title"
:
"Drag and Drop"
,
"show_title"
:
true
,
"question_text"
:
""
"question_text"
:
""
}
}
tests/data/test_get_html_data.json
View file @
21ee62c0
...
@@ -70,5 +70,6 @@
...
@@ -70,5 +70,6 @@
},
},
"targetImg"
:
"http://i0.kym-cdn.com/photos/images/newsfeed/000/030/404/1260585284155.png"
,
"targetImg"
:
"http://i0.kym-cdn.com/photos/images/newsfeed/000/030/404/1260585284155.png"
,
"title"
:
"Drag and Drop"
,
"title"
:
"Drag and Drop"
,
"show_title"
:
true
,
"question_text"
:
""
"question_text"
:
""
}
}
tests/test_drag_and_drop_v2.py
View file @
21ee62c0
...
@@ -59,6 +59,7 @@ def test_studio_submit():
...
@@ -59,6 +59,7 @@ def test_studio_submit():
body
=
json
.
dumps
({
body
=
json
.
dumps
({
'display_name'
:
"Test Drag & Drop"
,
'display_name'
:
"Test Drag & Drop"
,
'show_title'
:
True
,
'question_text'
:
"Question Drag & Drop"
,
'question_text'
:
"Question Drag & Drop"
,
'weight'
:
'5'
,
'weight'
:
'5'
,
'data'
:
{
'data'
:
{
...
...
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