WAStoreCartView


Seaside-Examples-Store

Comment:

A component for displaying and modifying a WAStoreCart.  Intended to be embedded rather than called.  The parent must provide a cart instance with #cart:.  Displays a list of items in the cart, and allows individual items to be removed.  Used by WAStoreFillCart.

Hierarchy:

ProtoObject
Object
WAPresenter
WAComponent
WAStoreCartView

Summary:

instance variables:

cart

methods:

instance class
accessing rendering no messages

Detail:

instance variables:

cart

instance methods:

accessing
cart: aCart

	cart _ aCart

rendering
renderContentOn: html

	cart hasItems ifFalse: [^ self].
	html divNamed: 'cart' with: [
		html small: [html bold: 'Your cart:'].
		html table: [
			cart countsAndItems do:
				[:assoc | self renderRowForCount: assoc key of: assoc value on: html ].
			html spacerRow.
			html
				tableRowWith: ''
				with: ''
				with: [html bold: cart totalPrice printStringAsCents].
		]
	]
renderRowForCount: aNumber of: anItem on: html
 
	| countString |
	countString _ (aNumber = 1) ifTrue: [''] ifFalse: ['(', aNumber asString, ') '].
	html
		tableRowWith: [html anchorWithAction: [cart remove: anItem] text: '-']
		with: countString, anItem title 
		with: (aNumber * anItem price) printStringAsCents

class methods:

^top


- made by Dandelion -