Added keyboard selection for rewards and habits

This commit is contained in:
TheHollidayInn 2015-07-08 08:34:35 -05:00
parent 0089a260c7
commit 6e7d94a317
4 changed files with 29 additions and 2 deletions

View file

@ -22,6 +22,13 @@
background-color: $bad
text-decoration: none
.btn-buy input:focus
opacity:0
input:focus + a.btn-buy
background-color: $bad
text-decoration: none
//Hide interativity if reward is locked (i.e. is a challenge reward)
.locked-task
.btn-buy

View file

@ -44,7 +44,7 @@ for $stage in $stages
background-color: darken($stage[1], 30%)
&:hover, &:focus
background-color: darken($stage[1], 40%)
input[type=checkbox]:focus + label
input[type=checkbox]:focus + label, input.habit:focus + a
background-color: darken($stage[1], 40%)
.task-actions a:nth-of-type(2)
border-top: 1px solid darken($stage[1],50%) // If there are two habit buttons (+ -), add a border to separate them
@ -281,7 +281,8 @@ for $stage in $stages
text-decoration: none
// checkbox
.task-checker input[type=checkbox], .task-checker input[type=checkbox]:focus
.task-checker input[type=checkbox], .task-checker input[type=checkbox]:focus,
input.habit, input.habit:focus, input.reward, input.reward:focus
margin: 0
padding: 0
height: 0px

View file

@ -4,13 +4,28 @@
// Habits
.task-actions(ng-if='::task.type=="habit"')
// score() is overridden in challengesCtrl to do nothing
input.visuallyhidden(
class="habit",
ng-if='task.up',
type='checkbox',
ui-keypress='{13:"score(task, up)"}')
a(ng-if='task.up', ng-click='applyingAction || score(task,"up")')
span.glyphicon.glyphicon-plus
input.visuallyhidden(
class="habit",
ng-if='task.down',
type='checkbox',
ng-init='direction = "down"'
ui-keypress='{13:"score(task, direction)"}' )
a(ng-if='task.down', ng-click='applyingAction || score(task,"down")')
span.glyphicon.glyphicon-minus
// Rewards
span(ng-if='::task.type=="reward"')
input.visuallyhidden(
class="reward",
type='checkbox',
ui-keypress='{ 13:"score(task, down)" }')
a.money.btn-buy(ng-class='{highValue: task.value >= 1000}', ng-click='score(task, "down")')
span.shop_gold
span.reward-cost {{task.value}}

View file

@ -6,6 +6,10 @@ ul.items.rewards(ng-if='main && list.type=="reward"')
span.glyphicon.glyphicon-comment
//left-hand size commands
.task-controls.task-primary
input.visuallyhidden(
class="reward",
type='checkbox',
ui-keypress='{13:"buy(item)"}')
a.money.btn-buy.item-btn(ng-class='{highValue: item.value >= 1000}', ng-click='buy(item)')
span.shop_gold
span.reward-cost {{item.value}}