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
92d83062
Commit
92d83062
authored
Jun 30, 2014
by
Filippo Valsorda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to set the items width and height
parent
53179a65
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
css/draggable_builder.css
+6
-0
js/draggable_builder.js
+25
-2
No files found.
css/draggable_builder.css
View file @
92d83062
...
...
@@ -284,6 +284,12 @@
margin-bottom
:
20px
;
}
.xblock--drag-and-drop
.items-form
.item-width
,
.xblock--drag-and-drop
.items-form
.item-height
{
width
:
30px
;
margin-right
:
50px
;
}
/** Buttons **/
.xblock--drag-and-drop
.btn
{
...
...
js/draggable_builder.js
View file @
92d83062
...
...
@@ -27,7 +27,14 @@ var dragAndDrop = (function() {
// item template
tpl
:
{
item
:
'<li class="option" data-value="<%= id %>"><%= displayName %></li>'
,
item
:
function
()
{
return
[
'<li class="option" data-value="<%= id %>"'
,
'style="width: <%= size.width %>; height: <%= size.height %>">'
,
'<%= displayName %>'
,
'</li>'
].
join
(
''
);
},
zoneInput
:
function
()
{
return
[
'<div class="zone-row <%= name %>">'
,
...
...
@@ -81,6 +88,12 @@ var dragAndDrop = (function() {
'<label>Error Feedback</label>'
,
'<textarea class="error-feedback"></textarea>'
,
'</div>'
,
'<div class="row">'
,
'<label>Width (px)</label>'
,
'<input type="text" class="item-width" value="190"></input>'
,
'<label>Height (px - 0 for auto)</label>'
,
'<input type="text" class="item-height" value="0"></input>'
,
'</div>'
,
'</div>'
].
join
(
''
);
}
...
...
@@ -396,6 +409,12 @@ var dragAndDrop = (function() {
name
=
$el
.
find
(
'.item-text'
).
val
();
if
(
name
.
length
>
0
)
{
var
width
=
$el
.
find
(
'.item-width'
).
val
()
+
'px'
,
height
=
$el
.
find
(
'.item-height'
).
val
();
if
(
height
===
'0'
)
height
=
'auto'
;
else
height
=
height
+
'px'
;
items
.
push
({
displayName
:
name
,
zone
:
$el
.
find
(
'.zone-select'
).
val
(),
...
...
@@ -403,6 +422,10 @@ var dragAndDrop = (function() {
feedback
:
{
correct
:
$el
.
find
(
'.success-feedback'
).
val
(),
incorrect
:
$el
.
find
(
'.error-feedback'
).
val
()
},
size
:
{
width
:
width
,
height
:
height
}
});
}
...
...
@@ -522,7 +545,7 @@ var dragAndDrop = (function() {
draw
:
function
()
{
var
list
=
[],
items
=
_fn
.
data
.
items
,
tpl
=
_fn
.
tpl
.
item
;
tpl
=
_fn
.
tpl
.
item
()
;
_
.
each
(
items
,
function
(
item
)
{
list
.
push
(
_
.
template
(
tpl
,
item
)
);
...
...
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