| as yet unclassified |
| browse
|
self displayItems: self inventory allItems
|
| cart: aCart
|
cart _ aCart.
cartView cart: aCart.
|
| checkout
|
self answer.
|
| children
|
^ Array with: cartView with: main
|
| displayItem: anItem
|
main call: (WAStoreItemView new item: anItem; cart: cart)
|
| displayItems: aCollection
|
| list |
aCollection size = 1 ifTrue: [^ self displayItem: aCollection first].
list _ WABatchSelection
items: aCollection
link: #title
text: #subtitle.
[self displayItem: (main call: list)] repeat
|
| initialize
|
main _ WAStoreInfo new.
cartView _ WAStoreCartView new
|
| inventory
|
^ WAStoreInventory default
|
| renderContentOn: html
|
html table: [
" html tableRowWith: trail span: 3."
html tableRow: [
html cssId: 'nav'; tableData: [self renderNavBarOn: html].
html cssId: 'main'; tableData: main.
html cssId: 'side'; tableData: cartView.
]
]
|
| renderNavBarOn: html
|
html form: [
html bold: 'Search:'.
html space.
html textInputWithValue: '' callback: [:v | self search: v].
].
html anchorWithAction: [self browse] text: 'Browse'.
cart hasItems ifTrue:
[html break.
html anchorWithAction: [self checkout] text: 'Checkout']
|
| search: aString
|
| results |
results _ self inventory findItem: aString.
results isEmpty
ifTrue: [main inform: 'No items match ', aString printString]
ifFalse: [self displayItems: results].
|
| style
|
^ '
#search {vertical-align: bottom}
#main {width: 50%; padding: 10px}
#side {vertical-align: top; }
#cart {border-style: dashed; border-width: 1; padding: 5px}
#nav {background-color: lightgrey; vertical-align: top; padding: 5px; border-width: 1; width: 15%; font-size: 12pt}
#batch {font-size: 10pt}
'
|