Commit dac6ba40 by Matjaz Gregoric Committed by GitHub

Merge pull request #132 from open-craft/cgopalan/adjust-feedback-popup-styles

[MCKIN-5772] Adjust feedback popup styles
parents 86e70248 969d5441
...@@ -12,7 +12,7 @@ install: ...@@ -12,7 +12,7 @@ install:
- "pip install selenium==2.53.0" - "pip install selenium==2.53.0"
- "pip uninstall -y xblock-drag-and-drop-v2" - "pip uninstall -y xblock-drag-and-drop-v2"
- "python setup.py sdist" - "python setup.py sdist"
- "pip install dist/xblock-drag-and-drop-v2-2.0.18.tar.gz" - "pip install dist/xblock-drag-and-drop-v2-2.1.1.tar.gz"
script: script:
- pep8 drag_and_drop_v2 tests --max-line-length=120 - pep8 drag_and_drop_v2 tests --max-line-length=120
- pylint drag_and_drop_v2 - pylint drag_and_drop_v2
......
Version 2.1.1 (2017-09-26)
---------------------------
* Enforce XBlock variable types (PR #104)
* Improvements for mobile (PRs #132, #133, #134)
Version 2.0.14 (2017-01-17) Version 2.0.14 (2017-01-17)
--------------------------- ---------------------------
......
...@@ -112,6 +112,19 @@ ...@@ -112,6 +112,19 @@
z-index: 10 !important; z-index: 10 !important;
} }
@media screen and (max-width: 480px) {
/* Horizontal scroll for item bank on mobile */
.xblock--drag-and-drop .item-bank {
-ms-flex-flow: row nowrap;
flex-flow: row nowrap;
overflow-x: auto;
}
.xblock--drag-and-drop .drag-container .item-bank .option {
flex-shrink: 0;
}
}
.xblock--drag-and-drop .drag-container .option.specified-width img { .xblock--drag-and-drop .drag-container .option.specified-width img {
width: 100%; /* If the image is smaller than the specified width, make it larger */ width: 100%; /* If the image is smaller than the specified width, make it larger */
} }
...@@ -405,7 +418,7 @@ ...@@ -405,7 +418,7 @@
max-width: 100%; max-width: 100%;
} }
.xblock--drag-and-drop .popup .close-feedback-popup-button { .xblock--drag-and-drop .popup .close-feedback-popup-desktop-button {
cursor: pointer; cursor: pointer;
margin-top: 8px; margin-top: 8px;
color: #ffffff; color: #ffffff;
...@@ -413,22 +426,110 @@ ...@@ -413,22 +426,110 @@
font-size: 18pt; font-size: 18pt;
} }
.ltr .xblock--drag-and-drop .popup .close-feedback-popup-button { .xblock--drag-and-drop .popup .close-feedback-popup-mobile-button {
display: none;
}
.xblock--drag-and-drop .popup .popup-header-icon {
display: none;
}
.xblock--drag-and-drop .popup .popup-header-text {
display: none;
}
.xblock--drag-and-drop .popup .popup-header-icon.popup-header-icon-incorrect {
color: #ff143e;
}
.ltr .xblock--drag-and-drop .popup .close-feedback-popup-desktop-button {
float: right; float: right;
margin-right: 8px; margin-right: 8px;
margin-left: 20px; margin-left: 20px;
} }
.rtl .xblock--drag-and-drop .popup .close-feedback-popup-button { .rtl .xblock--drag-and-drop .popup .close-feedback-popup-desktop-button {
float: left; float: left;
margin-right: 20px; margin-right: 20px;
margin-left: 8px; margin-left: 8px;
} }
.xblock--drag-and-drop .popup .close-feedback-popup-button:focus { .xblock--drag-and-drop .popup .close-feedback-popup-desktop-button:focus {
outline: 2px dotted white; outline: 2px dotted white;
} }
@media screen and (max-width: 480px) {
.xblock--drag-and-drop .popup .popup-content p {
text-align: center;
}
.xblock--drag-and-drop .popup {
background-color: #fff;
border-radius: 10px;
text-align: center;
box-shadow: 0 0 100px rgba(0,0,0,0.4);
border: none;
max-height: 90vh;
}
.xblock--drag-and-drop .popup .close-feedback-popup-desktop-button {
display: none;
}
.xblock--drag-and-drop .popup.popup-incorrect {
background-color: #fff;
}
.xblock--drag-and-drop .popup .popup-header-icon {
display: inline-block;
margin-top: 10px;
color: #629a2c;
font-size: 20pt;
}
.xblock--drag-and-drop .popup .popup-header-icon.popup-header-icon-incorrect {
color: #ff143e;
}
.xblock--drag-and-drop .popup .popup-header-text {
display: block;
padding: 2px 0 8px;
font-weight: 600;
}
.xblock--drag-and-drop .popup .popup-content {
color: #629a2c;
margin: 10px 0px 0px 0px;
font-size: 14px;
background-color: #f4ffe7;
padding: 20px;
border-color: #eee;
border-style: solid;
border-width: 1px 0 1px 0;
}
.xblock--drag-and-drop .popup .popup-content ul {
list-style-position: inside;
padding: 0;
}
.xblock--drag-and-drop .popup .popup-content.popup-content-incorrect {
color: #ff143e;
background-color: #ffe8ec;
}
.xblock--drag-and-drop .popup .close-feedback-popup-mobile-button {
display: inline;
cursor: pointer;
margin-top: 10px;
margin-bottom: 10px;
color: #3384ca;
font-size: 12pt;
padding: 10px;
}
}
/*** edX pattern library components ***/ /*** edX pattern library components ***/
/* reset stock edx-platform button styles */ /* reset stock edx-platform button styles */
...@@ -586,19 +687,6 @@ ...@@ -586,19 +687,6 @@
} }
} }
@media screen and (max-width: 480px) {
/* Horizontal scroll for item bank on mobile */
.xblock--drag-and-drop .drag-container .item-bank .option {
flex-shrink: 0;
}
.xblock--drag-and-drop .item-bank {
-ms-flex-flow: row nowrap;
flex-flow: row nowrap;
overflow-x: auto;
}
}
.xblock--drag-and-drop .sidebar-buttons .sidebar-button-wrapper { .xblock--drag-and-drop .sidebar-buttons .sidebar-button-wrapper {
border-collapse: collapse; border-collapse: collapse;
padding: 0 5px; padding: 0 5px;
......
...@@ -427,11 +427,19 @@ function DragAndDropTemplates(configuration) { ...@@ -427,11 +427,19 @@ function DragAndDropTemplates(configuration) {
return h("li", {innerHTML: message.message}); return h("li", {innerHTML: message.message});
})) }))
]; ];
popup_content = h("div.popup-content", {}, have_messages ? content_items : []); popup_content = h(
ctx.last_action_correct ? "div.popup-content" : "div.popup-content.popup-content-incorrect",
{},
have_messages ? content_items : []
);
} else { } else {
popup_content = h("div.popup-content", {}, msgs.map(function(message) { popup_content = h(
return h("p", {innerHTML: message.message}); ctx.last_action_correct ? "div.popup-content" : "div.popup-content.popup-content-incorrect",
})) {},
msgs.map(function(message) {
return h("p", {innerHTML: message.message});
})
);
} }
return h( return h(
...@@ -441,7 +449,7 @@ function DragAndDropTemplates(configuration) { ...@@ -441,7 +449,7 @@ function DragAndDropTemplates(configuration) {
}, },
[ [
h( h(
'button.unbutton.close-feedback-popup-button', 'button.unbutton.close-feedback-popup-button.close-feedback-popup-desktop-button',
{}, {},
[ [
h( h(
...@@ -460,7 +468,37 @@ function DragAndDropTemplates(configuration) { ...@@ -460,7 +468,37 @@ function DragAndDropTemplates(configuration) {
) )
] ]
), ),
popup_content h(
ctx.last_action_correct ? 'div.popup-header-icon' : 'div.popup-header-icon.popup-header-icon-incorrect',
{},
[
h(
ctx.last_action_correct ? 'span.icon.fa.fa-check-circle' : 'span.icon.fa.fa-exclamation-circle',
{
attributes: {
'aria-hidden': true
}
}
)
]
),
h(
'div.popup-header-text',
{},
ctx.last_action_correct ? gettext("Correct") : gettext("Incorrect")
),
popup_content,
h(
'button.unbutton.close-feedback-popup-button.close-feedback-popup-mobile-button',
{},
[
h(
'span',
{},
gettext("Close")
)
]
)
] ]
) )
}; };
...@@ -1092,7 +1130,7 @@ function DragAndDropBlock(runtime, element, configuration) { ...@@ -1092,7 +1130,7 @@ function DragAndDropBlock(runtime, element, configuration) {
var focusItemFeedbackPopup = function() { var focusItemFeedbackPopup = function() {
var popup = $root.find('.item-feedback-popup'); var popup = $root.find('.item-feedback-popup');
if (popup.length && popup.is(":visible")) { if (popup.length && popup.is(":visible")) {
popup.find('.close-feedback-popup-button').focus(); popup.find('.close-feedback-popup-button:visible').focus();
return true; return true;
} }
return false; return false;
......
...@@ -23,7 +23,7 @@ def package_data(pkg, root_list): ...@@ -23,7 +23,7 @@ def package_data(pkg, root_list):
setup( setup(
name='xblock-drag-and-drop-v2', name='xblock-drag-and-drop-v2',
version='2.0.18', version='2.1.1',
description='XBlock - Drag-and-Drop v2', description='XBlock - Drag-and-Drop v2',
packages=['drag_and_drop_v2'], packages=['drag_and_drop_v2'],
install_requires=[ install_requires=[
......
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