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
6ee45cad
Commit
6ee45cad
authored
Dec 16, 2016
by
Matjaz Gregoric
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TNL-6025] Remove improper use of section element.
parent
cb42a922
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
22 deletions
+28
-22
drag_and_drop_v2/public/js/drag_and_drop.js
+22
-16
drag_and_drop_v2/templates/html/drag_and_drop.html
+2
-2
tests/integration/test_base.py
+1
-1
tests/integration/test_title_and_question.py
+2
-2
tests/unit/test_basics.py
+1
-1
No files found.
drag_and_drop_v2/public/js/drag_and_drop.js
View file @
6ee45cad
...
@@ -247,7 +247,7 @@ function DragAndDropTemplates(configuration) {
...
@@ -247,7 +247,7 @@ function DragAndDropTemplates(configuration) {
});
});
return
(
return
(
h
(
'
section.feedback'
,
{
},
[
h
(
'
div.feedback'
,
{
attributes
:
{
'role'
:
'group'
,
'aria-label'
:
gettext
(
'Feedback'
)}
},
[
h
(
h
(
"div.feedback-content"
,
"div.feedback-content"
,
{
attributes
:
{
'aria-live'
:
'polite'
}
},
{
attributes
:
{
'aria-live'
:
'polite'
}
},
...
@@ -295,11 +295,11 @@ function DragAndDropTemplates(configuration) {
...
@@ -295,11 +295,11 @@ function DragAndDropTemplates(configuration) {
var
attemptsUsedDisplay
=
(
ctx
.
max_attempts
&&
ctx
.
max_attempts
>
0
)
?
'inline'
:
'none'
;
var
attemptsUsedDisplay
=
(
ctx
.
max_attempts
&&
ctx
.
max_attempts
>
0
)
?
'inline'
:
'none'
;
return
(
return
(
h
(
"
section
.action-toolbar-item.submit-answer"
,
{},
[
h
(
"
div
.action-toolbar-item.submit-answer"
,
{},
[
h
(
h
(
"button.btn-brand.submit-answer-button"
,
"button.btn-brand.submit-answer-button"
,
{
{
disabled
:
ctx
.
disable_submit_button
||
ctx
.
submit_spinner
,
disabled
:
ctx
.
disable_submit_button
||
ctx
.
submit_spinner
,
attributes
:
{
"aria-describedby"
:
attemptsUsedId
}},
attributes
:
{
"aria-describedby"
:
attemptsUsedId
}},
[
[
(
ctx
.
submit_spinner
?
h
(
"span.fa.fa-spin.fa-spinner"
)
:
null
),
(
ctx
.
submit_spinner
?
h
(
"span.fa.fa-spin.fa-spinner"
)
:
null
),
...
@@ -356,7 +356,7 @@ function DragAndDropTemplates(configuration) {
...
@@ -356,7 +356,7 @@ function DragAndDropTemplates(configuration) {
go_to_beginning_button_class
+=
' sr'
;
go_to_beginning_button_class
+=
' sr'
;
}
}
return
(
return
(
h
(
"
section
.action-toolbar-item.sidebar-buttons"
,
{},
[
h
(
"
div
.action-toolbar-item.sidebar-buttons"
,
{},
[
sidebarButtonTemplate
(
sidebarButtonTemplate
(
go_to_beginning_button_class
,
go_to_beginning_button_class
,
"fa-arrow-up"
,
"fa-arrow-up"
,
...
@@ -526,32 +526,35 @@ function DragAndDropTemplates(configuration) {
...
@@ -526,32 +526,35 @@ function DragAndDropTemplates(configuration) {
item_bank_properties
.
attributes
[
'dropzone'
]
=
'move'
;
item_bank_properties
.
attributes
[
'dropzone'
]
=
'move'
;
item_bank_properties
.
attributes
[
'aria-dropeffect'
]
=
'move'
;
item_bank_properties
.
attributes
[
'aria-dropeffect'
]
=
'move'
;
}
}
var
main_element_properties
=
{
attributes
:
{
'role'
:
'group'
,
'aria-label'
:
gettext
(
'Drag and Drop Problem'
)
}
};
return
(
return
(
h
(
'
section.themed-xblock.xblock--drag-and-drop'
,
[
h
(
'
div.themed-xblock.xblock--drag-and-drop'
,
main_element_properties
,
[
problemTitle
,
problemTitle
,
problemProgress
,
problemProgress
,
h
(
'div'
,
[
forwardKeyboardHelpButtonTemplate
(
ctx
)]),
h
(
'div'
,
[
forwardKeyboardHelpButtonTemplate
(
ctx
)]),
h
(
'
section
.problem'
,
[
h
(
'
div
.problem'
,
[
problemHeader
,
problemHeader
,
h
(
'p'
,
{
innerHTML
:
ctx
.
problem_html
}),
h
(
'p'
,
{
innerHTML
:
ctx
.
problem_html
}),
]),
]),
h
(
'
section
.drag-container'
,
{},
[
h
(
'
div
.drag-container'
,
{},
[
h
(
'div.item-bank'
,
item_bank_properties
,
[
h
(
'div.item-bank'
,
item_bank_properties
,
[
renderCollection
(
itemTemplate
,
items_in_bank
,
ctx
),
renderCollection
(
itemTemplate
,
items_in_bank
,
ctx
),
renderCollection
(
itemPlaceholderTemplate
,
items_placed
,
ctx
)
renderCollection
(
itemPlaceholderTemplate
,
items_placed
,
ctx
)
]),
]),
h
(
'div.target'
,
h
(
'div.target'
,
{
attributes
:
{
'role'
:
'group'
,
'arial-label'
:
gettext
(
'Drop Targets'
)}},
[
{},
itemFeedbackPopupTemplate
(
ctx
),
[
h
(
'div.target-img-wrapper'
,
[
itemFeedbackPopupTemplate
(
ctx
),
h
(
'img.target-img'
,
{
src
:
ctx
.
target_img_src
,
alt
:
ctx
.
target_img_description
}),
h
(
'div.target-img-wrapper'
,
[
]),
h
(
'img.target-img'
,
{
src
:
ctx
.
target_img_src
,
alt
:
ctx
.
target_img_description
}),
]
),
renderCollection
(
zoneTemplate
,
ctx
.
zones
,
ctx
)
renderCollection
(
zoneTemplate
,
ctx
.
zones
,
ctx
)
]),
]),
]),
]),
h
(
"
section.actions-toolbar"
,
{
},
[
h
(
"
div.actions-toolbar"
,
{
attributes
:
{
'role'
:
'group'
,
'aria-label'
:
gettext
(
'Actions'
)}
},
[
sidebarTemplate
(
ctx
),
sidebarTemplate
(
ctx
),
(
ctx
.
show_submit_answer
?
submitAnswerTemplate
(
ctx
)
:
null
),
(
ctx
.
show_submit_answer
?
submitAnswerTemplate
(
ctx
)
:
null
),
]),
]),
...
@@ -668,6 +671,9 @@ function DragAndDropBlock(runtime, element, configuration) {
...
@@ -668,6 +671,9 @@ function DragAndDropBlock(runtime, element, configuration) {
// to watch for load events on any child element, since load events do not bubble.
// to watch for load events on any child element, since load events do not bubble.
element
.
addEventListener
(
'load'
,
webkitFix
,
true
);
element
.
addEventListener
(
'load'
,
webkitFix
,
true
);
// Remove the spinner and create a blank slate for virtualDom to take over.
$root
.
empty
();
applyState
();
applyState
();
initDroppable
();
initDroppable
();
...
...
drag_and_drop_v2/templates/html/drag_and_drop.html
View file @
6ee45cad
{% load i18n %}
{% load i18n %}
<
section
class=
"themed-xblock xblock--drag-and-drop"
>
<
div
class=
"themed-xblock xblock--drag-and-drop"
>
<i
class=
"fa fa-spin fa-spinner initial-load-spinner"
></i>
{% trans "Loading drag and drop problem." %}
<i
class=
"fa fa-spin fa-spinner initial-load-spinner"
></i>
{% trans "Loading drag and drop problem." %}
</
section
>
</
div
>
tests/integration/test_base.py
View file @
6ee45cad
...
@@ -48,7 +48,7 @@ ItemDefinition = namedtuple( # pylint: disable=invalid-name
...
@@ -48,7 +48,7 @@ ItemDefinition = namedtuple( # pylint: disable=invalid-name
class
BaseIntegrationTest
(
SeleniumBaseTest
):
class
BaseIntegrationTest
(
SeleniumBaseTest
):
default_css_selector
=
'
section
.themed-xblock.xblock--drag-and-drop'
default_css_selector
=
'
div
.themed-xblock.xblock--drag-and-drop'
module_name
=
__name__
module_name
=
__name__
_additional_escapes
=
{
_additional_escapes
=
{
...
...
tests/integration/test_title_and_question.py
View file @
6ee45cad
...
@@ -26,10 +26,10 @@ class TestDragAndDropTitleAndProblem(BaseIntegrationTest):
...
@@ -26,10 +26,10 @@ class TestDragAndDropTitleAndProblem(BaseIntegrationTest):
self
.
addCleanup
(
scenarios
.
remove_scenario
,
const_page_id
)
self
.
addCleanup
(
scenarios
.
remove_scenario
,
const_page_id
)
page
=
self
.
go_to_page
(
const_page_name
)
page
=
self
.
go_to_page
(
const_page_name
)
is_problem_header_visible
=
len
(
page
.
find_elements_by_css_selector
(
'
section
.problem > h4'
))
>
0
is_problem_header_visible
=
len
(
page
.
find_elements_by_css_selector
(
'
div
.problem > h4'
))
>
0
self
.
assertEqual
(
is_problem_header_visible
,
show_problem_header
)
self
.
assertEqual
(
is_problem_header_visible
,
show_problem_header
)
problem
=
page
.
find_element_by_css_selector
(
'
section
.problem > p'
)
problem
=
page
.
find_element_by_css_selector
(
'
div
.problem > p'
)
self
.
assertEqual
(
self
.
get_element_html
(
problem
),
problem_text
)
self
.
assertEqual
(
self
.
get_element_html
(
problem
),
problem_text
)
@unpack
@unpack
...
...
tests/unit/test_basics.py
View file @
6ee45cad
...
@@ -45,7 +45,7 @@ class BasicTests(TestCaseMixin, unittest.TestCase):
...
@@ -45,7 +45,7 @@ class BasicTests(TestCaseMixin, unittest.TestCase):
def
test_template_contents
(
self
):
def
test_template_contents
(
self
):
context
=
{}
context
=
{}
student_fragment
=
self
.
block
.
runtime
.
render
(
self
.
block
,
'student_view'
,
context
)
student_fragment
=
self
.
block
.
runtime
.
render
(
self
.
block
,
'student_view'
,
context
)
self
.
assertIn
(
'<
section
class="themed-xblock xblock--drag-and-drop">'
,
student_fragment
.
content
)
self
.
assertIn
(
'<
div
class="themed-xblock xblock--drag-and-drop">'
,
student_fragment
.
content
)
self
.
assertIn
(
'Loading drag and drop problem.'
,
student_fragment
.
content
)
self
.
assertIn
(
'Loading drag and drop problem.'
,
student_fragment
.
content
)
def
test_get_configuration
(
self
):
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