diff --git a/package.json b/package.json index 991feaf..8a60b87 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "scrummy", "description": "A Scrum planning and estimation game from Four Kitchens", - "version": "1.6.0", + "version": "1.7.0", "scripts": { "start": "node scrum_cards_server.js" }, diff --git a/web/config.rb b/web/config.rb index 7717829..9900c84 100644 --- a/web/config.rb +++ b/web/config.rb @@ -1,5 +1,6 @@ # Require any additional compass plugins here. require 'breakpoint' +require 'singularitygs' # Set this to the root of your project when deployed: http_path = "/" diff --git a/web/css/main.css b/web/css/main.css index b1e82be..d65ebcd 100644 --- a/web/css/main.css +++ b/web/css/main.css @@ -786,22 +786,60 @@ input[type="text"]:focus { * Login Form */ #loginActions { + *zoom: 1; text-align: center; } -#loginActions input { - width: 23.5%; - margin: 6px 0.5%; +#loginActions:before, #loginActions:after { + content: " "; + display: table; +} +#loginActions:after { + clear: both; +} +@media (max-width: 679px) { + #loginActions input { + width: 48.93617%; + clear: right; + float: left; + margin-right: 2.12766%; + } + #loginActions input:nth-child(2n+0) { + margin-right: 0; + } +} +@media (min-width: 680px) { + #loginActions input { + width: 23.40426%; + clear: right; + float: left; + margin-right: 2.12766%; + } + #loginActions input:nth-child(4n+0) { + margin-right: 0; + } } /** * Voting Actions & Results Section */ +#votingActions { + *zoom: 1; +} +#votingActions:before, #votingActions:after { + content: " "; + display: table; +} +#votingActions:after { + clear: both; +} #votingActions input { - width: 32%; - margin-left: 1%; + width: 31.42857%; + clear: right; + float: left; + margin-right: 2.85714%; } -#votingActions input#btnReveal { - margin-left: 0; +#votingActions input:nth-child(3n+0) { + margin-right: 0; } #votingResult.reveal #votingActions #btnReveal { text-shadow: #230800 1px 1px 0; @@ -833,15 +871,22 @@ input[type="text"]:focus { * The shared game link box (inside the Voting actions box) */ #gameLink { + *zoom: 1; display: none; width: 100%; margin-top: 3px; border-top: 1px solid #473c3a; padding-top: 3px; } +#gameLink:before, #gameLink:after { + content: " "; + display: table; +} +#gameLink:after { + clear: both; +} #gameLink input { - width: 99%; - margin-left: 0; + width: 100%; } #readme .text { diff --git a/web/index.html b/web/index.html index 3f9e1a7..fb45143 100644 --- a/web/index.html +++ b/web/index.html @@ -85,6 +85,10 @@

What's scrummy?

+
+ Average: + ? +
diff --git a/web/js/scrum_cards_client.js b/web/js/scrum_cards_client.js index 501cfb7..257a04f 100644 --- a/web/js/scrum_cards_client.js +++ b/web/js/scrum_cards_client.js @@ -215,6 +215,7 @@ function clientReset(e){ $('#votingResult .vote').text(''); $('#votingResult .client').removeClass('voted'); $('#votingResult').removeClass('reveal'); + refreshAverage(); } /** @@ -224,6 +225,7 @@ function clientRevoke(e){ $('#votingResult .card-text'); $('#' + e.sid + ' .vote').text(''); $('#' + e.sid ).removeClass('voted'); + refreshAverage(); } /** @@ -231,6 +233,7 @@ function clientRevoke(e){ */ function clientReveal(e){ $('#votingResult').addClass('reveal'); + refreshAverage(); } /** @@ -238,6 +241,7 @@ function clientReveal(e){ */ function voteOccured(e){ addVote(e.sid,e.number); + refreshAverage(); } /** @@ -266,6 +270,36 @@ function userSignedIn(e){ function clientDisconnected(e){ $('#'+e.sid).remove(); + refreshAverage(); +} + +function refreshAverage() { + var $averageResult = $('#averageResult'); + if (!($('#votingResult').hasClass('reveal'))) { + $averageResult.text('?'); + return; + } + + var sum = 0; + var count = 0; + + $('#clients .vote').each(function() { + var value = $(this).text(); + if ($.isNumeric(value)) { + var floatValue = parseFloat(value); + if (!isNaN(floatValue)) { + sum += floatValue; + count++; + } + } + }); + + if (count > 0) { + var average = sum / count; + $averageResult.text(average.toFixed(2)); + } else { + $averageResult.text('?'); + } } /******************************************************************************* diff --git a/web/scss/main.scss b/web/scss/main.scss index ac06010..06a397c 100644 --- a/web/scss/main.scss +++ b/web/scss/main.scss @@ -25,6 +25,7 @@ $red: #D71414; // Include Compass Helpers @import "compass/css3"; @import "breakpoint"; +@import "singularitygs"; @-ms-viewport{ width: device-width; @@ -246,11 +247,18 @@ input { * Login Form */ #loginActions { + @include clearfix(); text-align: center; - input { - width: 23.5%; - margin: 6px 0.5%; + input { + @include respond-to('handheld-only') { + @include grid-span(8,0,16, $gutter: 1/2, $output-style: 'float'); + &:nth-child(2n+0) { margin-right: 0; } + } + @include respond-to('narrow') { + @include grid-span(4,0,16, $gutter: 1/2, $output-style: 'float'); + &:nth-child(4n+0) { margin-right: 0; } + } } } @@ -258,10 +266,11 @@ input { * Voting Actions & Results Section */ #votingActions { + @include clearfix(); + input { - width: 32%; - margin-left: 1%; - &#btnReveal { margin-left: 0; } + @include grid-span(4,0,12, $gutter: 1/2, $output-style: 'float'); + &:nth-child(3n+0) { margin-right: 0; } } #votingResult.reveal & #btnReveal { @@ -297,6 +306,8 @@ input { * The shared game link box (inside the Voting actions box) */ #gameLink { + @include clearfix(); + display: none; width: 100%; @@ -305,8 +316,7 @@ input { padding-top: 3px; input { - width: 99%; - margin-left: 0; + width: 100%; } }