Commit 67361cf3 by Xavier Antoviaque

Merge pull request #18 from edx-solutions/hide-zone-labels

Hide zone labels
parents 0ff439f2 49b74397
...@@ -236,7 +236,7 @@ class DragAndDropBlock(XBlock): ...@@ -236,7 +236,7 @@ class DragAndDropBlock(XBlock):
unique_id = self.location.name unique_id = self.location.name
except AttributeError: except AttributeError:
# workaround for xblock workbench # workaround for xblock workbench
unique_id = self.parent.replace('.', '-') unique_id = self.parent and self.parent.replace('.', '-')
return unique_id return unique_id
@staticmethod @staticmethod
......
...@@ -83,7 +83,6 @@ ...@@ -83,7 +83,6 @@
float: left; float: left;
margin: 10px 0 15px 5px; margin: 10px 0 15px 5px;
background: #fff; background: #fff;
z-index: 1;
} }
.xblock--drag-and-drop .target-img { .xblock--drag-and-drop .target-img {
...@@ -120,6 +119,7 @@ ...@@ -120,6 +119,7 @@
} }
.xblock--drag-and-drop .zone p { .xblock--drag-and-drop .zone p {
visibility: hidden;
width: 100%; width: 100%;
font-family: Arial; font-family: Arial;
font-size: 16px; font-size: 16px;
...@@ -153,7 +153,6 @@ ...@@ -153,7 +153,6 @@
top: 5%; top: 5%;
right: 5%; right: 5%;
background: none repeat scroll 0 0 #66A5B5; background: none repeat scroll 0 0 #66A5B5;
opacity: 0.9;
width: 500px; width: 500px;
max-width: 90%; max-width: 90%;
min-height: 50px; min-height: 50px;
......
...@@ -73,6 +73,11 @@ function DragAndDropBlock(runtime, element) { ...@@ -73,6 +73,11 @@ function DragAndDropBlock(runtime, element) {
// Set the target image // Set the target image
if (_fn.data.targetImg) if (_fn.data.targetImg)
_fn.$target.css('background', 'url(' + _fn.data.targetImg + ') no-repeat'); _fn.$target.css('background', 'url(' + _fn.data.targetImg + ') no-repeat');
// Display the zone names if required
if (_fn.data.displayLabels) {
$('p', _fn.$zones).css('visibility', 'visible');
}
}, },
finish: function(final_feedback) { finish: function(final_feedback) {
......
...@@ -61,6 +61,10 @@ function DragAndDropEditBlock(runtime, element) { ...@@ -61,6 +61,10 @@ function DragAndDropEditBlock(runtime, element) {
_fn.$target.css('background', 'url(' + _fn.data.targetImg + ') no-repeat'); _fn.$target.css('background', 'url(' + _fn.data.targetImg + ') no-repeat');
} }
if (_fn.data.displayLabels) {
_fn.data.displayLabels = $('.display-labels-form input', element).prop('checked', true);
}
$fbkTab.addClass('hidden'); $fbkTab.addClass('hidden');
$zoneTab.removeClass('hidden'); $zoneTab.removeClass('hidden');
...@@ -110,6 +114,9 @@ function DragAndDropEditBlock(runtime, element) { ...@@ -110,6 +114,9 @@ function DragAndDropEditBlock(runtime, element) {
// Placeholder shim for IE9 // Placeholder shim for IE9
$.placeholder.shim(); $.placeholder.shim();
})
.on('click', '.display-labels-form input', function(e) {
_fn.data.displayLabels = $('.display-labels-form input', element).is(':checked');
}); });
$itemTab $itemTab
......
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
<input type="text"> <input type="text">
<button class="btn">Change background</button> <button class="btn">Change background</button>
</section> </section>
<section class="tab-content display-labels-form">
<label for="display-labels">Display label names on the image:</label>
<input name="display-labels" id="display-labels" type="checkbox" />
</section>
<div class="items"> <div class="items">
<form class="zones-form"></form> <form class="zones-form"></form>
<a href="#" class="add-zone add-element"><div class="icon add"></div>Add a zone</a> <a href="#" class="add-zone add-element"><div class="icon add"></div>Add a zone</a>
......
import logging import logging
import json import json
import re
import datetime
import time
import json
from webob import Request from webob import Request
from mock import Mock, patch from mock import Mock
from workbench.runtime import WorkbenchRuntime from workbench.runtime import WorkbenchRuntime
from xblock.runtime import KvsFieldData, DictKeyValueStore from xblock.runtime import KvsFieldData, DictKeyValueStore
from nose.tools import ( from nose.tools import (
assert_equals, assert_true, assert_false, assert_equals, assert_true, assert_false,
assert_in, assert_regexp_matches assert_in
) )
import drag_and_drop_v2 import drag_and_drop_v2
...@@ -22,10 +18,11 @@ import drag_and_drop_v2 ...@@ -22,10 +18,11 @@ import drag_and_drop_v2
logging.disable(logging.DEBUG) logging.disable(logging.DEBUG)
def make_request(body): def make_request(body, method='POST'):
request = Request.blank('/') request = Request.blank('/')
request.method = 'POST' request.method = 'POST'
request.body = body.encode('utf-8') request.body = body.encode('utf-8')
request.method = method
return request return request
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment