Skip to content

Commit

Permalink
Overlay-style spinner for items with images
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kolpakov committed Dec 22, 2015
1 parent 7fb5cfc commit 87116ea
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
22 changes: 22 additions & 0 deletions drag_and_drop_v2/public/css/drag_and_drop.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,28 @@
float: left;
}

.xblock--drag-and-drop .drag-container .option.option-with-image .spinner-wrapper {
position: absolute;
float: none;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: #000;
opacity: 0.6;
color: #fff;
margin: 0;
display: flex;
justify-content: center; /* align horizontal */
align-items: center; /* align vertical */
}

/*.xblock--drag-and-drop .drag-container .option.option-with-image .spinner-wrapper .fa-spinner {*/
/*margin: auto;*/
/*position: absolute;*/
/*left: 0; right: 0; top: 0; bottom: 0;*/
/*}*/

This comment has been minimized.

Copy link
@itsjeyd

itsjeyd Dec 22, 2015

Contributor

@e-kolpakov Leftover comment


.xblock--drag-and-drop .drag-container .option .item-content {
display: inline-block;
}
Expand Down
3 changes: 2 additions & 1 deletion drag_and_drop_v2/public/js/drag_and_drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ function DragAndDropBlock(runtime, element, configuration) {
class_name: item_user_state && ('input' in item_user_state || item_user_state.correct_input) ? 'fade': undefined,
xhr_active: (item_user_state && item_user_state.submitting_location),
input: input,
content_html: item.backgroundImage ? '<img src="' + item.backgroundImage + '"/>' : item.displayName
content_html: item.backgroundImage ? '<img src="' + item.backgroundImage + '"/>' : item.displayName,
has_image: !!item.backgroundImage
};
if (item_user_state) {
itemProperties.is_placed = true;
Expand Down
6 changes: 5 additions & 1 deletion drag_and_drop_v2/public/js/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

var itemTemplate = function(item) {
var style = {};
var className = (item.class_name) ? item.class_name : "";
if (item.background_color) {
style['background-color'] = item.background_color;
}
Expand All @@ -64,11 +65,14 @@
style.left = item.x_percent + "%";
style.top = item.y_percent + "%";
}
if (item.has_image) {
className += " " + "option-with-image";
}
return (
h('div.option',
{
key: item.value,
className: item.class_name,
className: className,
attributes: {'data-value': item.value, 'data-drag-disabled': item.drag_disabled},
style: style
}, [
Expand Down

0 comments on commit 87116ea

Please sign in to comment.