Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
e53680bb
Commit
e53680bb
authored
Oct 09, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make drag_and_drop component work with requirejs and changed static url
parent
4879b06c
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
25 additions
and
25 deletions
+25
-25
common/lib/capa/capa/templates/drag_and_drop_input.html
+1
-1
common/lib/capa/capa/tests/test_inputtypes.py
+7
-7
common/static/js/capa/drag_and_drop.js
+1
-5
common/static/js/capa/drag_and_drop/base_image.js
+1
-1
common/static/js/capa/drag_and_drop/config_parser.js
+1
-1
common/static/js/capa/drag_and_drop/container.js
+1
-1
common/static/js/capa/drag_and_drop/draggable_events.js
+1
-1
common/static/js/capa/drag_and_drop/draggable_logic.js
+1
-1
common/static/js/capa/drag_and_drop/draggables.js
+1
-1
common/static/js/capa/drag_and_drop/main.js
+5
-1
common/static/js/capa/drag_and_drop/scroller.js
+3
-3
common/static/js/capa/drag_and_drop/targets.js
+1
-1
common/static/js/capa/drag_and_drop/update_input.js
+1
-1
No files found.
common/lib/capa/capa/templates/drag_and_drop_input.html
View file @
e53680bb
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<div
class=
"drag_and_drop_problem_json"
id=
"drag_and_drop_json_${id}"
<div
class=
"drag_and_drop_problem_json"
id=
"drag_and_drop_json_${id}"
style=
"display:none;"
>
${drag_and_drop_json}
</div>
style=
"display:none;"
>
${drag_and_drop_json}
</div>
<div
class=
"script_placeholder"
data-src=
"
/static/
js/capa/drag_and_drop.js"
></div>
<div
class=
"script_placeholder"
data-src=
"
${STATIC_URL}
js/capa/drag_and_drop.js"
></div>
% if status == 'unsubmitted':
% if status == 'unsubmitted':
<div
class=
"unanswered"
id=
"status_${id}"
>
<div
class=
"unanswered"
id=
"status_${id}"
>
...
...
common/lib/capa/capa/tests/test_inputtypes.py
View file @
e53680bb
...
@@ -951,7 +951,7 @@ class DragAndDropTest(unittest.TestCase):
...
@@ -951,7 +951,7 @@ class DragAndDropTest(unittest.TestCase):
'''
'''
def
test_rendering
(
self
):
def
test_rendering
(
self
):
path_to_images
=
'/static/images/'
path_to_images
=
'/
dummy-
static/images/'
xml_str
=
"""
xml_str
=
"""
<drag_and_drop_input id="prob_1_2" img="{path}about_1.png" target_outline="false">
<drag_and_drop_input id="prob_1_2" img="{path}about_1.png" target_outline="false">
...
@@ -978,15 +978,15 @@ class DragAndDropTest(unittest.TestCase):
...
@@ -978,15 +978,15 @@ class DragAndDropTest(unittest.TestCase):
user_input
=
{
# order matters, for string comparison
user_input
=
{
# order matters, for string comparison
"target_outline"
:
"false"
,
"target_outline"
:
"false"
,
"base_image"
:
"/static/images/about_1.png"
,
"base_image"
:
"/
dummy-
static/images/about_1.png"
,
"draggables"
:
[
"draggables"
:
[
{
"can_reuse"
:
""
,
"label"
:
"Label 1"
,
"id"
:
"1"
,
"icon"
:
""
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"Label 1"
,
"id"
:
"1"
,
"icon"
:
""
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"cc"
,
"id"
:
"name_with_icon"
,
"icon"
:
"/static/images/cc.jpg"
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"cc"
,
"id"
:
"name_with_icon"
,
"icon"
:
"/
dummy-
static/images/cc.jpg"
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"arrow-left"
,
"id"
:
"with_icon"
,
"icon"
:
"/static/images/arrow-left.png"
,
"can_reuse"
:
""
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"arrow-left"
,
"id"
:
"with_icon"
,
"icon"
:
"/
dummy-
static/images/arrow-left.png"
,
"can_reuse"
:
""
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"Label2"
,
"id"
:
"5"
,
"icon"
:
""
,
"can_reuse"
:
""
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"Label2"
,
"id"
:
"5"
,
"icon"
:
""
,
"can_reuse"
:
""
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"Mute"
,
"id"
:
"2"
,
"icon"
:
"/static/images/mute.png"
,
"can_reuse"
:
""
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"Mute"
,
"id"
:
"2"
,
"icon"
:
"/
dummy-
static/images/mute.png"
,
"can_reuse"
:
""
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"spinner"
,
"id"
:
"name_label_icon3"
,
"icon"
:
"/static/images/spinner.gif"
,
"can_reuse"
:
""
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"spinner"
,
"id"
:
"name_label_icon3"
,
"icon"
:
"/
dummy-
static/images/spinner.gif"
,
"can_reuse"
:
""
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"Star"
,
"id"
:
"name4"
,
"icon"
:
"/static/images/volume.png"
,
"can_reuse"
:
""
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"Star"
,
"id"
:
"name4"
,
"icon"
:
"/
dummy-
static/images/volume.png"
,
"can_reuse"
:
""
,
"target_fields"
:
[]},
{
"can_reuse"
:
""
,
"label"
:
"Label3"
,
"id"
:
"7"
,
"icon"
:
""
,
"can_reuse"
:
""
,
"target_fields"
:
[]}],
{
"can_reuse"
:
""
,
"label"
:
"Label3"
,
"id"
:
"7"
,
"icon"
:
""
,
"can_reuse"
:
""
,
"target_fields"
:
[]}],
"one_per_target"
:
"True"
,
"one_per_target"
:
"True"
,
"targets"
:
[
"targets"
:
[
...
...
common/static/js/capa/drag_and_drop.js
View file @
e53680bb
...
@@ -4,17 +4,13 @@
...
@@ -4,17 +4,13 @@
// See https://edx-wiki.atlassian.net/wiki/display/LMS/Integration+of+Require+JS+into+the+system
// See https://edx-wiki.atlassian.net/wiki/display/LMS/Integration+of+Require+JS+into+the+system
(
function
(
requirejs
,
require
,
define
)
{
(
function
(
requirejs
,
require
,
define
)
{
requirejs
.
config
({
'baseUrl'
:
'/static/js/capa/drag_and_drop/'
});
// The current JS file will be loaded and run each time. It will require a
// The current JS file will be loaded and run each time. It will require a
// single dependency which will be loaded and stored by RequireJS. On
// single dependency which will be loaded and stored by RequireJS. On
// subsequent runs, RequireJS will return the dependency from memory, rather
// subsequent runs, RequireJS will return the dependency from memory, rather
// than loading it again from the server. For that reason, it is a good idea to
// than loading it again from the server. For that reason, it is a good idea to
// keep the current JS file as small as possible, and move everything else into
// keep the current JS file as small as possible, and move everything else into
// RequireJS module dependencies.
// RequireJS module dependencies.
require
js
([
'
main'
],
function
(
Main
)
{
require
([
'js/capa/drag_and_drop/
main'
],
function
(
Main
)
{
Main
();
Main
();
});
});
...
...
common/static/js/capa/drag_and_drop/base_image.js
View file @
e53680bb
(
function
(
requirejs
,
require
,
define
)
{
(
function
(
requirejs
,
require
,
define
)
{
define
([
'logme'
],
function
(
logme
)
{
define
([
'
js/capa/drag_and_drop/
logme'
],
function
(
logme
)
{
return
BaseImage
;
return
BaseImage
;
function
BaseImage
(
state
)
{
function
BaseImage
(
state
)
{
...
...
common/static/js/capa/drag_and_drop/config_parser.js
View file @
e53680bb
(
function
(
requirejs
,
require
,
define
)
{
(
function
(
requirejs
,
require
,
define
)
{
define
([
'logme'
],
function
(
logme
)
{
define
([
'
js/capa/drag_and_drop/
logme'
],
function
(
logme
)
{
return
configParser
;
return
configParser
;
function
configParser
(
state
,
config
)
{
function
configParser
(
state
,
config
)
{
...
...
common/static/js/capa/drag_and_drop/container.js
View file @
e53680bb
(
function
(
requirejs
,
require
,
define
)
{
(
function
(
requirejs
,
require
,
define
)
{
define
([
'logme'
],
function
(
logme
)
{
define
([
'
js/capa/drag_and_drop/
logme'
],
function
(
logme
)
{
return
Container
;
return
Container
;
function
Container
(
state
)
{
function
Container
(
state
)
{
...
...
common/static/js/capa/drag_and_drop/draggable_events.js
View file @
e53680bb
(
function
(
requirejs
,
require
,
define
)
{
(
function
(
requirejs
,
require
,
define
)
{
define
([
'logme'
],
function
(
logme
)
{
define
([
'
js/capa/drag_and_drop/
logme'
],
function
(
logme
)
{
return
{
return
{
'attachMouseEventsTo'
:
function
(
element
)
{
'attachMouseEventsTo'
:
function
(
element
)
{
var
self
;
var
self
;
...
...
common/static/js/capa/drag_and_drop/draggable_logic.js
View file @
e53680bb
(
function
(
requirejs
,
require
,
define
)
{
(
function
(
requirejs
,
require
,
define
)
{
define
([
'
logme'
,
'update_input'
,
'
targets'
],
function
(
logme
,
updateInput
,
Targets
)
{
define
([
'
js/capa/drag_and_drop/logme'
,
'js/capa/drag_and_drop/update_input'
,
'js/capa/drag_and_drop/
targets'
],
function
(
logme
,
updateInput
,
Targets
)
{
return
{
return
{
'moveDraggableTo'
:
function
(
moveType
,
target
,
funcCallback
)
{
'moveDraggableTo'
:
function
(
moveType
,
target
,
funcCallback
)
{
var
self
,
offset
;
var
self
,
offset
;
...
...
common/static/js/capa/drag_and_drop/draggables.js
View file @
e53680bb
(
function
(
requirejs
,
require
,
define
)
{
(
function
(
requirejs
,
require
,
define
)
{
define
([
'
logme'
,
'draggable_events'
,
'
draggable_logic'
],
function
(
logme
,
draggableEvents
,
draggableLogic
)
{
define
([
'
js/capa/drag_and_drop/logme'
,
'js/capa/drag_and_drop/draggable_events'
,
'js/capa/drag_and_drop/
draggable_logic'
],
function
(
logme
,
draggableEvents
,
draggableLogic
)
{
return
{
return
{
'init'
:
init
'init'
:
init
};
};
...
...
common/static/js/capa/drag_and_drop/main.js
View file @
e53680bb
(
function
(
requirejs
,
require
,
define
)
{
(
function
(
requirejs
,
require
,
define
)
{
define
(
define
(
[
'logme'
,
'state'
,
'config_parser'
,
'container'
,
'base_image'
,
'scroller'
,
'draggables'
,
'targets'
,
'update_input'
],
[
'js/capa/drag_and_drop/logme'
,
'js/capa/drag_and_drop/state'
,
'js/capa/drag_and_drop/config_parser'
,
'js/capa/drag_and_drop/container'
,
'js/capa/drag_and_drop/base_image'
,
'js/capa/drag_and_drop/scroller'
,
'js/capa/drag_and_drop/draggables'
,
'js/capa/drag_and_drop/targets'
,
'js/capa/drag_and_drop/update_input'
],
function
(
logme
,
State
,
configParser
,
Container
,
BaseImage
,
Scroller
,
Draggables
,
Targets
,
updateInput
)
{
function
(
logme
,
State
,
configParser
,
Container
,
BaseImage
,
Scroller
,
Draggables
,
Targets
,
updateInput
)
{
return
Main
;
return
Main
;
...
...
common/static/js/capa/drag_and_drop/scroller.js
View file @
e53680bb
(
function
(
requirejs
,
require
,
define
)
{
(
function
(
requirejs
,
require
,
define
)
{
define
([
'logme'
],
function
(
logme
)
{
define
([
'
js/capa/drag_and_drop/
logme'
],
function
(
logme
)
{
return
Scroller
;
return
Scroller
;
function
Scroller
(
state
)
{
function
Scroller
(
state
)
{
...
@@ -40,7 +40,7 @@ define(['logme'], function (logme) {
...
@@ -40,7 +40,7 @@ define(['logme'], function (logme) {
'-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset; '
+
'-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset; '
+
'box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset; '
+
'box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset; '
+
'background-image: url(
\'
/static/images/arrow-left.png
\'
); '
+
"background-image: url('"
+
baseUrl
+
"images/arrow-left.png'); "
+
'background-position: center center; '
+
'background-position: center center; '
+
'background-repeat: no-repeat; '
+
'background-repeat: no-repeat; '
+
'" '
+
'" '
+
...
@@ -136,7 +136,7 @@ define(['logme'], function (logme) {
...
@@ -136,7 +136,7 @@ define(['logme'], function (logme) {
'-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset; '
+
'-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset; '
+
'box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset; '
+
'box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset; '
+
'background-image: url(
\'
/static/images/arrow-right.png
\'
); '
+
"background-image: url('"
+
baseUrl
+
"images/arrow-right.png'); "
+
'background-position: center center; '
+
'background-position: center center; '
+
'background-repeat: no-repeat; '
+
'background-repeat: no-repeat; '
+
'" '
+
'" '
+
...
...
common/static/js/capa/drag_and_drop/targets.js
View file @
e53680bb
(
function
(
requirejs
,
require
,
define
)
{
(
function
(
requirejs
,
require
,
define
)
{
define
([
'logme'
],
function
(
logme
)
{
define
([
'
js/capa/drag_and_drop/
logme'
],
function
(
logme
)
{
return
{
return
{
'initializeBaseTargets'
:
initializeBaseTargets
,
'initializeBaseTargets'
:
initializeBaseTargets
,
'initializeTargetField'
:
initializeTargetField
,
'initializeTargetField'
:
initializeTargetField
,
...
...
common/static/js/capa/drag_and_drop/update_input.js
View file @
e53680bb
(
function
(
requirejs
,
require
,
define
)
{
(
function
(
requirejs
,
require
,
define
)
{
define
([
'logme'
],
function
(
logme
)
{
define
([
'
js/capa/drag_and_drop/
logme'
],
function
(
logme
)
{
return
{
return
{
'check'
:
check
,
'check'
:
check
,
'update'
:
update
'update'
:
update
...
...
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