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
883e332e
Commit
883e332e
authored
Aug 05, 2016
by
Matjaz Gregoric
Committed by
Tim Krones
Aug 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address review notes.
parent
17334d9b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
47 deletions
+38
-47
drag_and_drop_v2/drag_and_drop_v2.py
+1
-10
drag_and_drop_v2/public/css/drag_and_drop_edit.css
+2
-2
drag_and_drop_v2/public/js/drag_and_drop_edit.js
+7
-7
drag_and_drop_v2/templates/html/drag_and_drop_edit.html
+20
-20
drag_and_drop_v2/templates/html/js_templates.html
+8
-8
No files found.
drag_and_drop_v2/drag_and_drop_v2.py
View file @
883e332e
...
...
@@ -255,19 +255,10 @@ class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin):
# connect 'for' and 'aria-describedby' attributes to the associated elements.
id_suffix
=
uuid
.
uuid4
()
.
hex
[:
16
]
js_templates
=
js_templates
.
replace
(
'{{id_suffix}}'
,
id_suffix
)
help_texts
=
{
field_name
:
self
.
ugettext
(
field
.
help
)
for
field_name
,
field
in
self
.
fields
.
viewitems
()
if
hasattr
(
field
,
"help"
)
}
field_values
=
{
field_name
:
field
.
values
for
field_name
,
field
in
self
.
fields
.
viewitems
()
if
hasattr
(
field
,
"values"
)
}
context
=
{
'js_templates'
:
js_templates
,
'help_texts'
:
help_texts
,
'field_values'
:
field_values
,
'id_suffix'
:
id_suffix
,
'fields'
:
self
.
fields
,
'self'
:
self
,
'data'
:
urllib
.
quote
(
json
.
dumps
(
self
.
data
)),
}
...
...
drag_and_drop_v2/public/css/drag_and_drop_edit.css
View file @
883e332e
...
...
@@ -176,8 +176,8 @@
width
:
40%
;
}
.xblock--drag-and-drop--editor
.zones-form
.zone-row
.layout
.size
,
.xblock--drag-and-drop--editor
.zones-form
.zone-row
.layout
.coord
{
.xblock--drag-and-drop--editor
.zones-form
.zone-row
.layout
.
zone-
size
,
.xblock--drag-and-drop--editor
.zones-form
.zone-row
.layout
.
zone-
coord
{
width
:
35%
;
margin
:
0
19px
5px
0
;
line-height
:
inherit
;
...
...
drag_and_drop_v2/public/js/drag_and_drop_edit.js
View file @
883e332e
...
...
@@ -354,19 +354,19 @@ function DragAndDropEditBlock(runtime, element, params) {
var
$changedInput
=
$
(
ev
.
currentTarget
);
var
$row
=
$changedInput
.
closest
(
'.zone-row'
);
var
record
=
_fn
.
build
.
form
.
zone
.
getZoneObjByUID
(
String
(
$row
.
data
(
'uid'
)));
if
(
$changedInput
.
hasClass
(
'title'
))
{
if
(
$changedInput
.
hasClass
(
'
zone-
title'
))
{
record
.
title
=
$changedInput
.
val
();
}
else
if
(
$changedInput
.
hasClass
(
'width'
))
{
}
else
if
(
$changedInput
.
hasClass
(
'
zone-
width'
))
{
record
.
width
=
$changedInput
.
val
();
}
else
if
(
$changedInput
.
hasClass
(
'description'
))
{
}
else
if
(
$changedInput
.
hasClass
(
'
zone-
description'
))
{
record
.
description
=
$changedInput
.
val
();
}
else
if
(
$changedInput
.
hasClass
(
'height'
))
{
}
else
if
(
$changedInput
.
hasClass
(
'
zone-
height'
))
{
record
.
height
=
$changedInput
.
val
();
}
else
if
(
$changedInput
.
hasClass
(
'x'
))
{
}
else
if
(
$changedInput
.
hasClass
(
'
zone-
x'
))
{
record
.
x
=
$changedInput
.
val
();
}
else
if
(
$changedInput
.
hasClass
(
'y'
))
{
}
else
if
(
$changedInput
.
hasClass
(
'
zone-
y'
))
{
record
.
y
=
$changedInput
.
val
();
}
else
if
(
$changedInput
.
hasClass
(
'align-select'
))
{
}
else
if
(
$changedInput
.
hasClass
(
'
zone-
align-select'
))
{
record
.
align
=
$changedInput
.
val
();
}
_fn
.
build
.
form
.
zone
.
renderZonesPreview
();
...
...
drag_and_drop_v2/templates/html/drag_and_drop_edit.html
View file @
883e332e
...
...
@@ -13,32 +13,32 @@
<section
class=
"tab-content"
>
<form
class=
"feedback-form"
>
<label
class=
"h3"
>
<span>
{% trans
self.
fields.display_name.display_name %}
</span>
<span>
{% trans fields.display_name.display_name %}
</span>
<input
class=
"display-name"
value=
"{{ self.display_name }}"
/>
</label>
<label
title=
"{
{ help_texts.show_title }
}"
>
<label
title=
"{
% trans fields.show_title.help %
}"
>
<input
class=
"show-title"
type=
"checkbox"
{%
if
self
.
show_title
%}
checked=
"checked"
{%
endif
%}
>
{% trans
self.
fields.show_title.display_name %}
<span
class=
"sr"
>
{
{ help_texts.show_title }
}
</span>
{% trans fields.show_title.display_name %}
<span
class=
"sr"
>
{
% trans fields.show_title.help %
}
</span>
</label>
<label
class=
"h3"
>
<span>
{% trans
self.
fields.mode.display_name %}
</span>
<span>
{% trans fields.mode.display_name %}
</span>
<select
class=
"problem-mode"
aria-describedby=
"problem-mode-description-{{id_suffix}}"
>
{% for field_value in field
_values.mode
%}
{% for field_value in field
s.mode.values
%}
<option
value=
"{{ field_value.value }}"
{%
if
self
.
mode =
=
field_value
.
value
%}
selected
{%
endif
%}
>
{
{ field_value.display_name }
}
{
% trans field_value.display_name %
}
</option>
{% endfor %}
</select>
</label>
<div
id=
"problem-mode-description-{{id_suffix}}"
class=
"form-help"
>
{
{ help_texts.mode }
}
{
% trans fields.mode.help %
}
</div>
<label
class=
"h3 assessment-setting"
>
{% trans
self.
fields.max_attempts.display_name %}
{% trans fields.max_attempts.display_name %}
<input
class=
"max-attempts"
type=
"number"
min=
"1"
...
...
@@ -47,16 +47,16 @@
{%
if
self
.
max_attempts
%}
value=
"{{ self.max_attempts }}"
{%
endif
%}
/>
</label>
<div
id=
"max-attempts-description-{{id_suffix}}"
class=
"assessment-setting form-help"
>
{
{ help_texts.max_attempts }
}
{
% trans fields.max_attempts.help %
}
</div>
<label
class=
"h3"
>
<span>
{% trans
self.
fields.weight.display_name %}
</span>
<span>
{% trans fields.weight.display_name %}
</span>
<input
class=
"weight"
type=
"number"
step=
"0.1"
value=
"{{ self.weight|unlocalize }}"
/>
</label>
<label
class=
"h3"
>
<span>
{% trans
self.
fields.question_text.display_name %}
</span>
<span>
{% trans fields.question_text.display_name %}
</span>
<textarea
class=
"problem-text"
>
{{ self.question_text }}
</textarea>
</label>
<label>
...
...
@@ -64,10 +64,10 @@
type=
"checkbox"
aria-describedby=
"show-problem-header-description-{{id_suffix}}"
{%
if
self
.
show_question_header
%}
checked=
"checked"
{%
endif
%}
>
{% trans
self.
fields.show_question_header.display_name %}
{% trans fields.show_question_header.display_name %}
</label>
<div
id=
"show-problem-header-description-{{id_suffix}}"
class=
"form-help"
>
{
{ help_texts.show_question_header }
}
{
% trans fields.show_question_header.help %
}
</div>
<label
class=
"h3"
>
...
...
@@ -150,24 +150,24 @@
<section
class=
"tab-content"
>
<form
class=
"item-styles-form"
>
<label
class=
"h3"
>
<span>
{% trans
self.
fields.item_background_color.display_name %}
</span>
<span>
{% trans fields.item_background_color.display_name %}
</span>
<input
class=
"item-background-color"
placeholder=
"
e.g. blue or #0000ff
"
placeholder=
"
{% blocktrans with example1='blue' example2='#0000ff' %}e.g. {{example1}} or {{example2}}{% endblocktrans %}
"
value=
"{{ self.item_background_color }}"
aria-describedby=
"item-background-color-description-{{id_suffix}}"
>
</label>
<div
id=
"item-background-color-description-{{id_suffix}}"
class=
"form-help"
>
{
{ help_texts.item_background_color }
}
{
% trans fields.item_background_color.help %
}
</div>
<label
class=
"h3"
>
<span>
{% trans
self.
fields.item_text_color.display_name %}
</span>
<span>
{% trans fields.item_text_color.display_name %}
</span>
<input
class=
"item-text-color"
placeholder=
"
e.g. white or #ffffff
"
placeholder=
"
{% blocktrans with example1='white' example2='#ffffff' %}e.g. {{example1}} or {{example2}}{% endblocktrans %}
"
value=
"{{ self.item_text_color}}"
aria-describedby=
"item-text-color-description-{{id_suffix}}"
>
</label>
<div
id=
"item-text-color-description-{{id_suffix}}"
class=
"form-help"
>
{
{ help_texts.item_text_color }
}
{
% trans fields.item_text_color.help %
}
</div>
</form>
</section>
...
...
drag_and_drop_v2/templates/html/js_templates.html
View file @
883e332e
...
...
@@ -15,16 +15,16 @@
<
div
class
=
"icon remove"
><
/div
>
<
/a
>
<
label
>
<
span
>
{{
i18n
"T
ext
"
}}
<
/span
>
<
span
>
{{
i18n
"T
itle
"
}}
<
/span
>
<
input
type
=
"text"
class
=
"title"
class
=
"
zone-
title"
value
=
"{{ zone.title }}"
required
/>
<
/label
>
<
label
>
<
span
>
{{
i18n
"Description"
}}
<
/span
>
<
input
type
=
"text"
class
=
"description"
class
=
"
zone-
description"
value
=
"{{ zone.description }}"
placeholder
=
"{{i18n 'Describe this zone to non-visual users'}}"
required
/>
...
...
@@ -33,33 +33,33 @@
<
label
>
<
span
>
{{
i18n
"width"
}}
<
/span
>
<
input
type
=
"text"
class
=
"
size
width"
class
=
"
zone-size zone-
width"
value
=
"{{ zone.width }}"
/>
<
/label
>
<
label
>
<
span
>
{{
i18n
"height"
}}
<
/span
>
<
input
type
=
"text"
class
=
"
size
height"
class
=
"
zone-size zone-
height"
value
=
"{{ zone.height }}"
/>
<
/label
>
<
br
/>
<
label
>
<
span
>
x
<
/span
>
<
input
type
=
"text"
class
=
"
coord
x"
class
=
"
zone-coord zone-
x"
value
=
"{{ zone.x }}"
/>
<
/label
>
<
label
>
<
span
>
y
<
/span
>
<
input
type
=
"text"
class
=
"
coord
y"
class
=
"
zone-coord zone-
y"
value
=
"{{ zone.y }}"
/>
<
/label
>
<
/div
>
<
div
class
=
"alignment"
>
<
label
>
<
span
>
{{
i18n
"Alignment"
}}
<
/span
>
<
select
class
=
"align-select"
<
select
class
=
"
zone-
align-select"
aria
-
describedby
=
"zone-align-description-{{zone.uid}}-{{id_suffix}}"
>
<
option
value
=
""
{{
#
ifeq
zone
.
align
""
}}
selected
{{
/
ifeq
}}
>
...
...
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