Commit 148dea11 by E. Kolpakov

Fixed the following errors:

* Missing image on edit
* Saving error when labels are displayed
* Setting first zone for items with no zone configured
parent e6743a57
...@@ -38,6 +38,9 @@ function DragAndDropEditBlock(runtime, element) { ...@@ -38,6 +38,9 @@ function DragAndDropEditBlock(runtime, element) {
// Compile templates // Compile templates
_fn.tpl.init(); _fn.tpl.init();
// Display target image
_fn.$target.show();
_fn.build.clickHandlers(); _fn.build.clickHandlers();
}, },
clickHandlers: function() { clickHandlers: function() {
...@@ -62,7 +65,7 @@ function DragAndDropEditBlock(runtime, element) { ...@@ -62,7 +65,7 @@ function DragAndDropEditBlock(runtime, element) {
} }
if (_fn.data.displayLabels) { if (_fn.data.displayLabels) {
_fn.data.displayLabels = $('.display-labels-form input', element).prop('checked', true); $('.display-labels-form input', element).prop('checked', true);
} }
$fbkTab.addClass('hidden'); $fbkTab.addClass('hidden');
...@@ -73,7 +76,6 @@ function DragAndDropEditBlock(runtime, element) { ...@@ -73,7 +76,6 @@ function DragAndDropEditBlock(runtime, element) {
$(this).one('click', function(e) { $(this).one('click', function(e) {
// $zoneTab -> $itemTab // $zoneTab -> $itemTab
e.preventDefault(); e.preventDefault();
_fn.build.form.zone.setAll(); _fn.build.form.zone.setAll();
for (var i = 0; i < _fn.data.items.length; i++) { for (var i = 0; i < _fn.data.items.length; i++) {
...@@ -272,17 +274,14 @@ function DragAndDropEditBlock(runtime, element) { ...@@ -272,17 +274,14 @@ function DragAndDropEditBlock(runtime, element) {
is_sel, is_sel,
arr = _fn.build.form.zone.list, arr = _fn.build.form.zone.list,
dropdown = [], dropdown = [],
html; html,
dropdown_items = arr.concat('none');
for (i=0; i<arr.length; i++) { for (i=0; i<dropdown_items.length; i++) {
if (arr[i] == selected) is_sel = 'selected'; is_sel = (dropdown_items[i] == selected) ? 'selected' : '';
else is_sel = ''; dropdown.push(tpl({ value: dropdown_items[i], selected: is_sel }));
dropdown.push(tpl({ value: arr[i], selected: is_sel }));
} }
// Add option to include dummy answers
dropdown.push(tpl({ value: 'none' }));
html = dropdown.join(''); html = dropdown.join('');
return new Handlebars.SafeString(html); return new Handlebars.SafeString(html);
}, },
......
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