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
a2cbbdcc
Commit
a2cbbdcc
authored
Jan 13, 2016
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set up basic infrastructure for theming.
parent
e5413899
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
12 additions
and
12 deletions
+12
-12
drag_and_drop_v2/drag_and_drop_v2.py
+5
-1
drag_and_drop_v2/public/css/drag_and_drop.css
+0
-4
drag_and_drop_v2/public/js/drag_and_drop.js
+3
-3
drag_and_drop_v2/public/js/view.js
+1
-1
drag_and_drop_v2/public/themes/apros.css
+0
-0
drag_and_drop_v2/templates/html/drag_and_drop.html
+1
-1
tests/integration/test_base.py
+1
-1
tests/unit/test_basics.py
+1
-1
No files found.
drag_and_drop_v2/drag_and_drop_v2.py
View file @
a2cbbdcc
...
...
@@ -25,7 +25,8 @@ loader = ResourceLoader(__name__)
# Classes ###########################################################
class
DragAndDropBlock
(
XBlock
):
@XBlock.wants
(
'settings'
)
class
DragAndDropBlock
(
XBlock
,
XBlockWithSettingsMixin
,
ThemableXBlockMixin
):
"""
XBlock providing a Drag and Drop question
"""
...
...
@@ -103,6 +104,7 @@ class DragAndDropBlock(XBlock):
default
=
False
,
)
block_settings_key
=
'drag-and-drop-v2'
has_score
=
True
def
_
(
self
,
text
):
...
...
@@ -132,6 +134,8 @@ class DragAndDropBlock(XBlock):
for
js_url
in
js_urls
:
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
js_url
))
self
.
include_theme_files
(
fragment
)
fragment
.
initialize_js
(
'DragAndDropBlock'
,
self
.
get_configuration
())
return
fragment
...
...
drag_and_drop_v2/public/css/drag_and_drop.css
View file @
a2cbbdcc
...
...
@@ -39,10 +39,6 @@
background
:
#ebf0f2
;
}
/*.xblock--drag-and-drop .clear {
clear: both;
}*/
/** Draggable Items **/
.xblock--drag-and-drop
.item-bank
{
display
:
-ms-flexbox
;
...
...
drag_and_drop_v2/public/js/drag_and_drop.js
View file @
a2cbbdcc
...
...
@@ -303,7 +303,7 @@ function DragAndDropBlock(runtime, element, configuration) {
// Make zone accept items that are dropped using the mouse
$root
.
find
(
'.zone'
).
droppable
({
accept
:
'.
xblock--drag-and-drop .
item-bank .option'
,
accept
:
'.item-bank .option'
,
tolerance
:
'pointer'
,
drop
:
function
(
evt
,
ui
)
{
var
$zone
=
$
(
this
);
...
...
@@ -331,9 +331,9 @@ function DragAndDropBlock(runtime, element, configuration) {
// Make item draggable using the mouse
try
{
$item
.
draggable
({
containment
:
$root
.
find
(
'.
xblock--drag-and-drop .
drag-container'
),
containment
:
$root
.
find
(
'.drag-container'
),
cursor
:
'move'
,
stack
:
$root
.
find
(
'.
xblock--drag-and-drop .
item-bank .option'
),
stack
:
$root
.
find
(
'.item-bank .option'
),
revert
:
'invalid'
,
revertDuration
:
150
,
start
:
function
(
evt
,
ui
)
{
...
...
drag_and_drop_v2/public/js/view.js
View file @
a2cbbdcc
...
...
@@ -199,7 +199,7 @@
var
items_placed
=
$
.
grep
(
ctx
.
items
,
is_item_placed
);
var
items_in_bank
=
$
.
grep
(
ctx
.
items
,
is_item_placed
,
true
);
return
(
h
(
'section.xblock--drag-and-drop'
,
[
h
(
'section.
themed-xblock.
xblock--drag-and-drop'
,
[
problemHeader
,
h
(
'section.problem'
,
{
role
:
'application'
},
[
questionHeader
,
...
...
drag_and_drop_v2/public/themes/apros.css
0 → 100644
View file @
a2cbbdcc
drag_and_drop_v2/templates/html/drag_and_drop.html
View file @
a2cbbdcc
{% load i18n %}
<section
class=
"xblock--drag-and-drop"
>
<section
class=
"
themed-xblock
xblock--drag-and-drop"
>
<i
class=
"fa fa-spin fa-spinner initial-load-spinner"
></i>
{% trans "Loading drag and drop exercise." %}
</section>
tests/integration/test_base.py
View file @
a2cbbdcc
...
...
@@ -18,7 +18,7 @@ loader = ResourceLoader(__name__)
class
BaseIntegrationTest
(
SeleniumBaseTest
):
default_css_selector
=
'section.xblock--drag-and-drop'
default_css_selector
=
'section.
themed-xblock.
xblock--drag-and-drop'
module_name
=
__name__
_additional_escapes
=
{
...
...
tests/unit/test_basics.py
View file @
a2cbbdcc
...
...
@@ -17,7 +17,7 @@ class BasicTests(TestCaseMixin, unittest.TestCase):
def
test_template_contents
(
self
):
context
=
{}
student_fragment
=
self
.
block
.
runtime
.
render
(
self
.
block
,
'student_view'
,
context
)
self
.
assertIn
(
'<section class="xblock--drag-and-drop">'
,
student_fragment
.
content
)
self
.
assertIn
(
'<section class="
themed-xblock
xblock--drag-and-drop">'
,
student_fragment
.
content
)
self
.
assertIn
(
'Loading drag and drop exercise.'
,
student_fragment
.
content
)
def
test_get_configuration
(
self
):
...
...
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