From 71b25a8a16360f067984343c841dca537d712930 Mon Sep 17 00:00:00 2001 From: Andrew Miner Date: Wed, 28 Jan 2015 11:17:30 -0800 Subject: [PATCH] Move images in inventory to the left --- src/css/reset.scss | 2 +- src/css/templates/inventory.scss | 66 +++++++++++-------- src/css/templates/stack.scss | 12 +--- .../controllers/stack_controller.coffee | 6 +- src/templates/inventory.jade | 7 +- src/templates/stack.jade | 7 +- 6 files changed, 53 insertions(+), 47 deletions(-) diff --git a/src/css/reset.scss b/src/css/reset.scss index eaaaa4f61..ea6465056 100644 --- a/src/css/reset.scss +++ b/src/css/reset.scss @@ -1,4 +1,4 @@ -a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,dialog,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,meter,nav,object,ol,output,p,pre,progress,q,rp,rt,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,time,tr,tt,u,ul,var,video,xmp { +a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,dialog,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,meter,nav,object,ol,output,p,pre,progress,q,rp,rt,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,time,td,tr,tt,u,ul,var,video,xmp { border: 0; margin: 0; padding: 0; diff --git a/src/css/templates/inventory.scss b/src/css/templates/inventory.scss index 821e5e8c6..820cc7f7e 100644 --- a/src/css/templates/inventory.scss +++ b/src/css/templates/inventory.scss @@ -45,44 +45,54 @@ All rights reserved. td { height: 2.4em; - padding-bottom: 0.25em; + vertical-align: middle; + } - &:nth-child(1) { - width: 2.4em; + td.quantity { + position: relative; + width: 2.4em; - input { - border-radius: 0.75em; - margin: 0 auto; - text-align: center; - width: 90%; - } + input { + position: absolute; top: 50%; height: $font-size-small; width: 100%; + @include transform(translateY(-50%)); + border-radius: 0.75em; + margin: 0 auto; + text-align: center; + max-width: 2.8em; } + } - &:nth-child(2) { - @include box-sizing(content-box); - padding: 0 2.0em 0 1.0em; + td.icon { + width: 4.8em; + padding: 0 1em; - input { - height: 100%; width: 100%; - border: 0; - border-bottom: 1px dashed $color-gray-light; - outline: 0; - - &:focus { - border: 1px solid $color-gray-light; - } - } + img { + width: 100%; height: auto; + max-height: 4.8em; } + } - &:nth-child(3) { - width: 2.4em; - text-align: right; + td.name { + text-align: left; + padding-right: 1em; - img { width: 2.4em; height: 2.4em; } + input { + width: 100%; + border: 0; + border-bottom: 1px dashed $color-gray-light; + outline: 0; - button { - width: 100%; + &:focus { + border: 1px solid $color-gray-light; } } } + + td.action { + width: 4em; + + button { + width: 4em; + } + } } diff --git a/src/css/templates/stack.scss b/src/css/templates/stack.scss index 20f4dcec5..e72e81234 100644 --- a/src/css/templates/stack.scss +++ b/src/css/templates/stack.scss @@ -7,9 +7,8 @@ All rights reserved. .view__stack { font-family: $font-family-normal; - td { vertical-align: middle; } - .quantity { + .quantity p { border-radius: 0.75em; background: $color-ice; color: $color-background-panel; @@ -17,17 +16,12 @@ All rights reserved. font-weight: bold; text-align: center; min-width: 3em; - padding: 0.1em 0.5em; + padding: 0.2em 0.5em 0.1em 0.5em; height: $font-size-small + 0.2em; } - .name { + .name p { display: inline; font-size: $font-size-normal; } - - img { - width: 100%; height: auto; - max-height: 4.8em; - } } diff --git a/src/scripts/controllers/stack_controller.coffee b/src/scripts/controllers/stack_controller.coffee index aabb6ca59..ec5015409 100644 --- a/src/scripts/controllers/stack_controller.coffee +++ b/src/scripts/controllers/stack_controller.coffee @@ -25,9 +25,9 @@ module.exports = class StackController extends BaseController # BaseController Overrides ##################################################################### onDidRender: -> - @$image = @$('img') - @$nameField = @$('.name') - @$quantityField = @$('.quantity') + @$image = @$('.icon img') + @$nameField = @$('.name p') + @$quantityField = @$('.quantity p') super refresh: -> diff --git a/src/templates/inventory.jade b/src/templates/inventory.jade index ca88ac795..226a14f5f 100644 --- a/src/templates/inventory.jade +++ b/src/templates/inventory.jade @@ -13,8 +13,9 @@ .scrollbox table tr.edit - td: input(name="quantity") - td(width="*"): input(name="name") - td: button(name="add") add + td.quantity: input(name="quantity") + td.icon: img(src="/images/unknown.png") + td.name(width="*"): input(name="name") + td.action: button(name="add") add .toolbar button(name="clear") clear diff --git a/src/templates/stack.jade b/src/templates/stack.jade index 4d6066228..eae820eaf 100644 --- a/src/templates/stack.jade +++ b/src/templates/stack.jade @@ -6,6 +6,7 @@ //- tr.view__stack - td: p.quantity - td: p.name - td: img(src='') + td.quantity: p + td.icon: img(src='') + td.name: p + td.action