Add "clear" button to the inventory UI
This commit is contained in:
@@ -83,7 +83,7 @@ module.exports = class InventoryController extends BaseController
|
|||||||
modPack: @modPack,
|
modPack: @modPack,
|
||||||
onChoseItem: (itemSlug)=> @onItemChosen(itemSlug)
|
onChoseItem: (itemSlug)=> @onItemChosen(itemSlug)
|
||||||
|
|
||||||
@$clearButton = @$('button.clear')
|
@$clearButton = @$('.button.clear')
|
||||||
@$emptyPlaceholder = @$('.empty_placeholder')
|
@$emptyPlaceholder = @$('.empty_placeholder')
|
||||||
@$icon = @$('.icon')
|
@$icon = @$('.icon')
|
||||||
@$itemContainer = @$('.item_container')
|
@$itemContainer = @$('.item_container')
|
||||||
@@ -93,8 +93,10 @@ module.exports = class InventoryController extends BaseController
|
|||||||
refresh: ->
|
refresh: ->
|
||||||
if @editable
|
if @editable
|
||||||
@selector.show()
|
@selector.show()
|
||||||
|
@show @$clearButton
|
||||||
else
|
else
|
||||||
@selector.hide()
|
@selector.hide()
|
||||||
|
@hide @$clearButton
|
||||||
|
|
||||||
@$icon.attr 'src', @icon
|
@$icon.attr 'src', @icon
|
||||||
@$title.html @title
|
@$title.html @title
|
||||||
@@ -114,8 +116,8 @@ module.exports = class InventoryController extends BaseController
|
|||||||
|
|
||||||
events: ->
|
events: ->
|
||||||
return _.extend super,
|
return _.extend super,
|
||||||
'click button.clear': 'onClearButtonClicked'
|
'click .button.clear': 'onClearButtonClicked'
|
||||||
'click button.first': 'onFirstButtonClicked'
|
'click button.first': 'onFirstButtonClicked'
|
||||||
'click button.second': 'onSecondButtonClicked'
|
'click button.second': 'onSecondButtonClicked'
|
||||||
|
|
||||||
# Private Methods ##############################################################################
|
# Private Methods ##############################################################################
|
||||||
|
|||||||
@@ -8,4 +8,6 @@
|
|||||||
.view__inventory
|
.view__inventory
|
||||||
.item_container
|
.item_container
|
||||||
.empty_placeholder.hideable.hidden nothing
|
.empty_placeholder.hideable.hidden nothing
|
||||||
.view__item_selector.hideable.hidden.button: p add an item...
|
.buttons
|
||||||
|
.view__item_selector.hideable.hidden.button: p add an item...
|
||||||
|
.button.clear: p clear
|
||||||
|
|||||||
@@ -5,6 +5,36 @@ Copyright (C) 2015 by Redwood Labs
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
.button {
|
||||||
|
background: $color-gray-faint;
|
||||||
|
border: 0.1em solid $color-gray-medium;
|
||||||
|
border-radius: 1.5em;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0.5em 0.75em;
|
||||||
|
margin: 0 1em;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: $color-background-panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
background: $color-background-panel;
|
||||||
|
border: 0.1em solid $color-gray-light;
|
||||||
|
cursor: inherit;
|
||||||
|
|
||||||
|
p {
|
||||||
|
color: $color-gray-light;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
color: $color-active;
|
||||||
|
font-family: $font-family-normal;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.byline {
|
.byline {
|
||||||
margin: 0.25em 0 2em 0;
|
margin: 0.25em 0 2em 0;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,15 @@ All rights reserved.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
.view__inventory {
|
.view__inventory {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
&.large {
|
||||||
|
.item_container {
|
||||||
|
font-size: 1.5em;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.empty_placeholder {
|
.empty_placeholder {
|
||||||
color: $color-gray-light;
|
color: $color-gray-light;
|
||||||
@@ -13,74 +22,26 @@ All rights reserved.
|
|||||||
font-size: $font-size-large;
|
font-size: $font-size-large;
|
||||||
margin: 2em 0;
|
margin: 2em 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.item_container {
|
.item_container {
|
||||||
position: relative; width: 100%;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
.view__stack > div {
|
|
||||||
height: 4.2em;
|
|
||||||
padding: 0 1em 0.5em 0;
|
|
||||||
vertical-align: middle;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
padding: 0 0 0.5em 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
img {
|
|
||||||
height: 3.6em; width: 3.6em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.name {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.action {
|
|
||||||
white-space: nowrap;
|
|
||||||
|
|
||||||
button:first-child {
|
|
||||||
margin-right: 0.5em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.view__item_selector {
|
.buttons {
|
||||||
position: relative; width: 80%;
|
display: flex;
|
||||||
margin: 1em auto;
|
flex-direction: row;
|
||||||
}
|
|
||||||
|
|
||||||
&.large {
|
margin: 1em 2em;
|
||||||
.item_container {
|
|
||||||
.view__stack > div {
|
|
||||||
height: 5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.quantity {
|
.view__item_selector {
|
||||||
.bubble {
|
flex: 85%;
|
||||||
border-radius: 3em;
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
input {
|
.button.clear {
|
||||||
font-size: $font-size-large;
|
flex: 15%;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
img {
|
|
||||||
height: 4.8em; width: 4.8em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.name {
|
|
||||||
a {
|
|
||||||
font-size: $font-size-large;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,21 +22,6 @@ All rights reserved.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.button {
|
|
||||||
background: $color-gray-faint;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: $color-background-panel;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
color: $color-active;
|
|
||||||
font-family: $font-family-normal;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
p {
|
||||||
position: absolute; top: 50%; width: 100%;
|
position: absolute; top: 50%; width: 100%;
|
||||||
@include transform(translateY(-50%));
|
@include transform(translateY(-50%));
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ All rights reserved.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
.view__stack {
|
.view__stack {
|
||||||
font-family: $font-family-normal;
|
display: flex;
|
||||||
display: table-row;
|
flex-direction: row;
|
||||||
|
align-items: baseline;
|
||||||
|
|
||||||
& > div {
|
font-family: $font-family-normal;
|
||||||
display: table-cell;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
.quantity {
|
.quantity {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
|
||||||
.bubble {
|
.bubble {
|
||||||
border: 0.1em solid $color-gray-light;
|
border: 0.1em solid $color-gray-light;
|
||||||
border-radius: 1.5em;
|
border-radius: 1.5em;
|
||||||
@@ -46,14 +46,19 @@ All rights reserved.
|
|||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin: 0 0.5em;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 100%; height: auto;
|
width: 100%; height: auto;
|
||||||
max-height: 4.8em;
|
max-width: 3.6em;
|
||||||
@include pixel-image;
|
@include pixel-image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
|
flex: 1 0 auto;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: $color-text;
|
color: $color-text;
|
||||||
font-size: $font-size-normal;
|
font-size: $font-size-normal;
|
||||||
@@ -67,11 +72,12 @@ All rights reserved.
|
|||||||
}
|
}
|
||||||
|
|
||||||
.action {
|
.action {
|
||||||
text-align: right;
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-end;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
position: relative; width: 3.0em; height: 3.0em;
|
position: relative; width: 3.0em; height: 3.0em;
|
||||||
display: inline-block;
|
|
||||||
|
|
||||||
border: 0;
|
border: 0;
|
||||||
font-size: $font-size-small;
|
font-size: $font-size-small;
|
||||||
|
|||||||
@@ -46,34 +46,6 @@ All rights reserved.
|
|||||||
|
|
||||||
.button {
|
.button {
|
||||||
flex: 50%;
|
flex: 50%;
|
||||||
|
|
||||||
background: $color-gray-faint;
|
|
||||||
border: 0.1em solid $color-gray-medium;
|
|
||||||
border-radius: 1.5em;
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 0.25em 0.75em;
|
|
||||||
margin: 0 1em;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: $color-background-panel;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.disabled {
|
|
||||||
background: $color-background-panel;
|
|
||||||
border: 0.1em solid $color-gray-light;
|
|
||||||
cursor: inherit;
|
|
||||||
|
|
||||||
p {
|
|
||||||
color: $color-gray-light;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
color: $color-active;
|
|
||||||
font-family: $font-family-normal;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user