Commit e4ab6dc2 by Adam Committed by Adam Palay

Revert "Calculator layout and help popup fixes"

parent 95434f7b
...@@ -7,6 +7,18 @@ ...@@ -7,6 +7,18 @@
<input type="text" id="calculator_input" tabindex="-1" /> <input type="text" id="calculator_input" tabindex="-1" />
<div class="help-wrapper"> <div class="help-wrapper">
<a id="calculator_hint" href="#" role="button" aria-haspopup="true" tabindex="-1">Hints</a> <a id="calculator_hint" href="#" role="button" aria-haspopup="true" tabindex="-1">Hints</a>
<ul id="calculator_input_help" class="help" aria-activedescendant="hint-integers" role="tooltip" aria-hidden="true">
<li class="hint-item" id="hint-moreinfo" tabindex="-1">
<p>
<span class="bold">For detailed information, see
<a id="hint-link-first" href="http://edx-guide-for-students.readthedocs.org/en/latest/SFD_mathformatting.html">Entering Mathematical and Scientific Expressions</a>in the
<a id="hint-link-second" href="http://edx-guide-for-students.readthedocs.org/en/latest/index.html">edX Guide for Students </a> format
</span>
</p>
</li>
<li class="hint-item" id="hint-integers" tabindex="-1"><p><span class="bold">Integers:</span> 2520</p></li>
<li class="hint-item" id="hint-decimals" tabindex="-1"><p><span class="bold">Decimals:</span> 3.14 or .98</p></li>
</ul>
</div> </div>
</div> </div>
<input id="calculator_button" type="submit" title="Calculate" arial-label="Calculate" value="=" tabindex="-1" /> <input id="calculator_button" type="submit" title="Calculate" arial-label="Calculate" value="=" tabindex="-1" />
...@@ -14,18 +26,4 @@ ...@@ -14,18 +26,4 @@
</form> </form>
</div> </div>
</li> </li>
<li>
<ul id="calculator_input_help" class="calc-help-popup" aria-activedescendant="hint-integers" role="tooltip" aria-hidden="true">
<li class="hint-item" id="hint-moreinfo" tabindex="-1">
<p>
<span class="bold">For detailed information, see
<a id="hint-link-first" href="http://edx-guide-for-students.readthedocs.org/en/latest/SFD_mathformatting.html">Entering Mathematical and Scientific Expressions</a>in the
<a id="hint-link-second" href="http://edx-guide-for-students.readthedocs.org/en/latest/index.html">edX Guide for Students </a> format
</span>
</p>
</li>
<li class="hint-item" id="hint-integers" tabindex="-1"><p><span class="bold">Integers:</span> 2520</p></li>
<li class="hint-item" id="hint-decimals" tabindex="-1"><p><span class="bold">Decimals:</span> 3.14 or .98</p></li>
</ul>
</li>
</ul> </ul>
...@@ -61,35 +61,35 @@ describe 'Calculator', -> ...@@ -61,35 +61,35 @@ describe 'Calculator', ->
describe 'showHint', -> describe 'showHint', ->
it 'show the help overlay', -> it 'show the help overlay', ->
@calculator.showHint() @calculator.showHint()
expect($('.calc-help-popup')).toHaveClass('shown') expect($('.help')).toHaveClass('shown')
expect($('.calc-help-popup')).toHaveAttr('aria-hidden', 'false') expect($('.help')).toHaveAttr('aria-hidden', 'false')
describe 'hideHint', -> describe 'hideHint', ->
it 'show the help overlay', -> it 'show the help overlay', ->
@calculator.hideHint() @calculator.hideHint()
expect($('.calc-help-popup')).not.toHaveClass('shown') expect($('.help')).not.toHaveClass('shown')
expect($('.calc-help-popup')).toHaveAttr('aria-hidden', 'true') expect($('.help')).toHaveAttr('aria-hidden', 'true')
describe 'handleClickOnHintButton', -> describe 'handleClickOnHintButton', ->
it 'on click hint button hint popup becomes visible ', -> it 'on click hint button hint popup becomes visible ', ->
e = jQuery.Event('click'); e = jQuery.Event('click');
$('#calculator_hint').trigger(e); $('#calculator_hint').trigger(e);
expect($('.calc-help-popup')).toHaveClass 'shown' expect($('.help')).toHaveClass 'shown'
describe 'handleClickOnDocument', -> describe 'handleClickOnDocument', ->
it 'on click out of the hint popup it becomes hidden', -> it 'on click out of the hint popup it becomes hidden', ->
@calculator.showHint() @calculator.showHint()
e = jQuery.Event('click'); e = jQuery.Event('click');
$(document).trigger(e); $(document).trigger(e);
expect($('.calc-help-popup')).not.toHaveClass 'shown' expect($('.help')).not.toHaveClass 'shown'
describe 'handleClickOnHintPopup', -> describe 'handleClickOnHintPopup', ->
it 'on click of hint popup it remains visible', -> it 'on click of hint popup it remains visible', ->
@calculator.showHint() @calculator.showHint()
e = jQuery.Event('click'); e = jQuery.Event('click');
$('#calculator_input_help').trigger(e); $('#calculator_input_help').trigger(e);
expect($('.calc-help-popup')).toHaveClass 'shown' expect($('.help')).toHaveClass 'shown'
describe 'selectHint', -> describe 'selectHint', ->
it 'select correct hint item', -> it 'select correct hint item', ->
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
class @Calculator class @Calculator
constructor: -> constructor: ->
@hintButton = $('#calculator_hint') @hintButton = $('#calculator_hint')
@hintPopup = $('.calc-help-popup') @hintPopup = $('.help')
@hintsList = @hintPopup.find('.hint-item') @hintsList = @hintPopup.find('.hint-item')
@selectHint($('#' + @hintPopup.attr('aria-activedescendant'))); @selectHint($('#' + @hintPopup.attr('aria-activedescendant')));
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
@include transition(bottom $tmg-avg linear 0s); @include transition(bottom $tmg-avg linear 0s);
-webkit-appearance: none; -webkit-appearance: none;
width: 100%; width: 100%;
direction: ltr;
&.open { &.open {
bottom: -36px; bottom: -36px;
...@@ -53,6 +52,17 @@ ...@@ -53,6 +52,17 @@
background: $black; background: $black;
color: $white; color: $white;
// UI: input help table
.calculator-input-help-table {
margin: ($baseline/2) 0;
tr th, tr td {
vertical-align: top;
border: 1px solid $gray-l4;
padding: ($baseline/2);
}
}
form { form {
@extend .clearfix; @extend .clearfix;
@include box-sizing(border-box); @include box-sizing(border-box);
...@@ -147,7 +157,6 @@ ...@@ -147,7 +157,6 @@
border: none; border: none;
background: url("#{$static-path}/images/info-icon.png") center center no-repeat; background: url("#{$static-path}/images/info-icon.png") center center no-repeat;
color: $white; color: $white;
cursor: pointer;
&:focus { &:focus {
outline: 5px auto #5b9dd9; outline: 5px auto #5b9dd9;
...@@ -160,85 +169,47 @@ ...@@ -160,85 +169,47 @@
color: $white; color: $white;
} }
} }
}
}
}
}
}
.calc-help-popup {
@include transition(none);
position: fixed; .help {
left: 180px; @include transition(none);
right: 180px; background: $white;
top: 70px; border-radius: 3px;
bottom: 90px; box-shadow: 0 0 3px #999;
overflow: auto; color: #333;
padding: 10px;
background: $white; position: absolute;
border-radius: 3px; right: -40px;
box-shadow: // Standard 3px black shadow. bottom: 57px;
0 0 3px #999, width: 600px;
// Places a overlay black transparent popup background. overflow: hidden;
0 0 0 4000em rgba(0, 0, 0, 0.20); pointer-events: none;
display: none;
color: #333; margin: 0;
padding: 10px; list-style: none;
pointer-events: none; &.shown {
display: none; display: block;
margin: 0; pointer-events: auto;
list-style: none; }
// UI: input help table
.calculator-input-help-table {
margin: ($baseline/2) auto;
tr th, tr td {
vertical-align: top;
border: 1px solid $gray-l4;
padding: ($baseline/2);
}
}
&.shown {
display: block;
pointer-events: auto;
}
.bold { .bold {
font-weight: bold; font-weight: bold;
} }
p, p+p { p, p+p {
margin: 0; margin: 0;
} }
.calc-postfixes { .calc-postfixes {
margin: 10px auto; margin: 10px auto;
td, th { td, th {
padding: 2px 15px; padding: 2px 15px;
}
}
}
}
}
} }
} }
@media screen and (max-width: 990px) {
left: 20px;
right: 20px;
}
@media screen and (min-width: 991px) and (max-width: 1999px) {
left: 20%;
right: 20%;
}
@media screen and (min-width: 2000px) {
left: 35%;
right: 35%;
padding-bottom: 40px;
bottom: auto;
}
} }
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