all: intial code import

This commit is contained in:
2018-05-12 15:25:36 +02:00
parent 1f20ee2574
commit 9f47b858c3
59 changed files with 375 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
rendering
addContact
(self call: WAContact new)
ifNotNil: [ :contact | contactBook addContact: contact ]

View File

@@ -0,0 +1,3 @@
accessing
contacts
^ contactBook contacts

View File

@@ -0,0 +1,3 @@
operations
contactsDo: aBlock
self contacts do: aBlock

View File

@@ -0,0 +1,4 @@
initialization
initialize
super initialize.
contactBook := ContactBook createDefault

View File

@@ -0,0 +1,7 @@
rendering
renderButtonsForContact: aContact on: html
html tbsButtonGroup: [
self
renderEditButtonForContact: aContact on: html;
renderRemoveButtonForContact: aContact on: html
]

View File

@@ -0,0 +1,9 @@
rendering
renderContact: aContact on: html
html tableRow: [
html
tableData: [ self renderPhotoOf: aContact on: html ];
tableData: aContact fullname;
tableData: aContact email;
tableData: [ self renderButtonsForContact: aContact on: html ]
]

View File

@@ -0,0 +1,12 @@
rendering
renderContactsOn: html
html tbsTable: [
html tableHead: [
html
tableHeading: 'Photo';
tableHeading: 'Name';
tableHeading: 'Email';
tableHeading: 'Actions'
].
self contactsDo: [ :contact | self renderContact: contact on: html ]
]

View File

@@ -0,0 +1,11 @@
rendering
renderContentOn: html
html tbsContainer: [
html heading
level: 1;
with: 'My Contact Book'.
html tbsForm: [
self renderContactsOn: html.
self renderGlobalButtonsOn: html
]
]

View File

@@ -0,0 +1,6 @@
updating
renderEditButtonForContact: aContact on: html
html tbsButton
beSuccess;
callback: [ self call: (WAContact editContact: aContact) ];
with: 'Edit'

View File

@@ -0,0 +1,8 @@
rendering
renderGlobalButtonsOn: html
html tbsButtonGroup: [
html tbsButton
beSuccess;
callback: [ self addContact ];
with: 'New contact'
]

View File

@@ -0,0 +1,3 @@
rendering
renderPhotoOf: aContact on: html
html image url: aContact gravatarUrl

View File

@@ -0,0 +1,6 @@
rendering
renderRemoveButtonForContact: aContact on: html
html tbsButton
beDanger;
callback: [ self contactBook removeContact: aContact ];
with: 'Remove'

View File

@@ -0,0 +1,4 @@
updating
updateRoot: anHtmlRoot
super updateRoot: anHtmlRoot.
anHtmlRoot title: 'Contact Book'