all: intial code import
This commit is contained in:
4
ContactBook.package/.filetree
Normal file
4
ContactBook.package/.filetree
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"noMethodMetaData" : true,
|
||||
"separateMethodMetaAndSource" : false,
|
||||
"useCypressPropertiesFile" : true }
|
17
ContactBook.package/Contact.class/README.md
Normal file
17
ContactBook.package/Contact.class/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
I represent a contact.
|
||||
|
||||
I know about my name and email.
|
||||
|
||||
Collaborators:
|
||||
- Veit Heller <veit@veitheller.de
|
||||
|
||||
Public API and Key Messages
|
||||
|
||||
- there are accessors for both fullname and email.
|
||||
- you can create new instances using the newNamed:email: message.
|
||||
|
||||
Internal Representation and Key Implementation Points.
|
||||
|
||||
Instance Variables
|
||||
email: a String
|
||||
fullname: a String
|
@@ -0,0 +1,6 @@
|
||||
instance creation
|
||||
newNamed: aNameString email: anEmailString
|
||||
^ self new
|
||||
fullname: aNameString;
|
||||
email: anEmailString;
|
||||
yourself
|
3
ContactBook.package/Contact.class/instance/email..st
Normal file
3
ContactBook.package/Contact.class/instance/email..st
Normal file
@@ -0,0 +1,3 @@
|
||||
accessing
|
||||
email: aString
|
||||
email := aString
|
3
ContactBook.package/Contact.class/instance/email.st
Normal file
3
ContactBook.package/Contact.class/instance/email.st
Normal file
@@ -0,0 +1,3 @@
|
||||
accessing
|
||||
email
|
||||
^ email
|
3
ContactBook.package/Contact.class/instance/fullname..st
Normal file
3
ContactBook.package/Contact.class/instance/fullname..st
Normal file
@@ -0,0 +1,3 @@
|
||||
accessing
|
||||
fullname: aString
|
||||
fullname := aString trimBoth
|
3
ContactBook.package/Contact.class/instance/fullname.st
Normal file
3
ContactBook.package/Contact.class/instance/fullname.st
Normal file
@@ -0,0 +1,3 @@
|
||||
accessing
|
||||
fullname
|
||||
^ fullname
|
@@ -0,0 +1,3 @@
|
||||
accessing
|
||||
gravatarUrl
|
||||
^ 'http://www.gravatar.com/avatar/', (MD5 hashMessage: email trimBoth asLowercase) hex, '.jpg'
|
7
ContactBook.package/Contact.class/instance/printOn..st
Normal file
7
ContactBook.package/Contact.class/instance/printOn..st
Normal file
@@ -0,0 +1,7 @@
|
||||
printing
|
||||
printOn: aStream
|
||||
aStream
|
||||
nextPutAll: self fullname;
|
||||
nextPutAll: ' <';
|
||||
nextPutAll: self email;
|
||||
nextPutAll: '>'
|
15
ContactBook.package/Contact.class/properties.json
Normal file
15
ContactBook.package/Contact.class/properties.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"category" : "ContactBook",
|
||||
"classinstvars" : [
|
||||
],
|
||||
"classvars" : [
|
||||
],
|
||||
"commentStamp" : "VeitHeller 5/12/2018 14:05",
|
||||
"instvars" : [
|
||||
"fullname",
|
||||
"email" ],
|
||||
"name" : "Contact",
|
||||
"pools" : [
|
||||
],
|
||||
"super" : "Object",
|
||||
"type" : "normal" }
|
9
ContactBook.package/ContactBook.class/README.md
Normal file
9
ContactBook.package/ContactBook.class/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
I represent a contact book.
|
||||
|
||||
I have contacts.
|
||||
|
||||
Collaborators:
|
||||
- Veit Heller <veit@veitheller.de>
|
||||
|
||||
Instance Variables
|
||||
contacts: a List of Contacts
|
16
ContactBook.package/ContactBook.class/class/createDefault.st
Normal file
16
ContactBook.package/ContactBook.class/class/createDefault.st
Normal file
@@ -0,0 +1,16 @@
|
||||
instance creation
|
||||
createDefault
|
||||
^ self new
|
||||
addContact: (Contact
|
||||
newNamed: 'Damien Cassou'
|
||||
email: 'damien@cassou.me');
|
||||
addContact: (Contact
|
||||
newNamed: 'Marcus Denker'
|
||||
email: 'marcus.denker@inria.fr');
|
||||
addContact: (Contact
|
||||
newNamed: 'Tudor Girba'
|
||||
email: 'tudor@tudorgirba.com');
|
||||
addContact: (Contact
|
||||
newNamed: 'Clara Allende'
|
||||
email: 'clari.allende@gmail.com');
|
||||
yourself
|
@@ -0,0 +1,3 @@
|
||||
accessing
|
||||
addContact: aContact
|
||||
contacts add: aContact
|
@@ -0,0 +1,3 @@
|
||||
accessing
|
||||
contacts
|
||||
^ contacts
|
@@ -0,0 +1,3 @@
|
||||
initialization
|
||||
initialize
|
||||
contacts := OrderedCollection new.
|
@@ -0,0 +1,3 @@
|
||||
accessing
|
||||
removeContact: aContact
|
||||
contacts remove: aContact
|
14
ContactBook.package/ContactBook.class/properties.json
Normal file
14
ContactBook.package/ContactBook.class/properties.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"category" : "ContactBook",
|
||||
"classinstvars" : [
|
||||
],
|
||||
"classvars" : [
|
||||
],
|
||||
"commentStamp" : "VeitHeller 5/12/2018 14:19",
|
||||
"instvars" : [
|
||||
"contacts" ],
|
||||
"name" : "ContactBook",
|
||||
"pools" : [
|
||||
],
|
||||
"super" : "Object",
|
||||
"type" : "normal" }
|
0
ContactBook.package/ContactBookTest.class/README.md
Normal file
0
ContactBook.package/ContactBookTest.class/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
testing
|
||||
testContactManagement
|
||||
| book contact |
|
||||
book := ContactBook new.
|
||||
contact := Contact newNamed: 'Veit Heller' email: 'veit@veitheller.de'.
|
||||
book addContact: contact.
|
||||
self assert: book contacts size equals: 1.
|
||||
book removeContact: contact.
|
||||
self assert: book contacts size equals: 0.
|
||||
|
@@ -0,0 +1,5 @@
|
||||
testing
|
||||
testCreation
|
||||
| book |
|
||||
book := ContactBook new.
|
||||
self assert: book contacts size equals: 0.
|
14
ContactBook.package/ContactBookTest.class/properties.json
Normal file
14
ContactBook.package/ContactBookTest.class/properties.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"category" : "ContactBook",
|
||||
"classinstvars" : [
|
||||
],
|
||||
"classvars" : [
|
||||
],
|
||||
"commentStamp" : "",
|
||||
"instvars" : [
|
||||
],
|
||||
"name" : "ContactBookTest",
|
||||
"pools" : [
|
||||
],
|
||||
"super" : "TestCase",
|
||||
"type" : "normal" }
|
0
ContactBook.package/ContactTest.class/README.md
Normal file
0
ContactBook.package/ContactTest.class/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
testing
|
||||
testInstanceCreation
|
||||
| contact |
|
||||
contact := Contact newNamed: 'Marcus Denker' email: 'marcus.denker@inria.fr'.
|
||||
self assert: contact fullname equals: 'Marcus Denker'.
|
||||
self assert: contact email equals: 'marcus.denker@inria.fr'.
|
@@ -0,0 +1,5 @@
|
||||
testing
|
||||
testNameTrimmed
|
||||
| contact |
|
||||
contact := Contact newNamed: ' Veit Heller ' email: 'veit@veitheller.de'.
|
||||
self assert: contact fullname equals: 'Veit Heller'.
|
@@ -0,0 +1,5 @@
|
||||
testing
|
||||
testString
|
||||
| contact |
|
||||
contact := Contact newNamed: ' Veit Heller ' email: 'veit@veitheller.de'.
|
||||
self assert: contact asString equals: 'Veit Heller <veit@veitheller.de>'.
|
14
ContactBook.package/ContactTest.class/properties.json
Normal file
14
ContactBook.package/ContactTest.class/properties.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"category" : "ContactBook",
|
||||
"classinstvars" : [
|
||||
],
|
||||
"classvars" : [
|
||||
],
|
||||
"commentStamp" : "",
|
||||
"instvars" : [
|
||||
],
|
||||
"name" : "ContactTest",
|
||||
"pools" : [
|
||||
],
|
||||
"super" : "TestCase",
|
||||
"type" : "normal" }
|
0
ContactBook.package/WAContact.class/README.md
Normal file
0
ContactBook.package/WAContact.class/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
operations
|
||||
editContact: aContact
|
||||
^ self new
|
||||
setContact: aContact;
|
||||
yourself
|
3
ContactBook.package/WAContact.class/instance/contact.st
Normal file
3
ContactBook.package/WAContact.class/instance/contact.st
Normal file
@@ -0,0 +1,3 @@
|
||||
accessing
|
||||
contact
|
||||
^ contact
|
@@ -0,0 +1,4 @@
|
||||
initialize
|
||||
initialize
|
||||
super initialize.
|
||||
contact := Contact new.
|
@@ -0,0 +1,9 @@
|
||||
rendering
|
||||
renderButtonsOn: html
|
||||
html tbsFormGroup: [
|
||||
html tbsButtonGroup: [
|
||||
self
|
||||
renderSubmitButtonOn: html;
|
||||
renderCancelButtonOn: html
|
||||
]
|
||||
]
|
@@ -0,0 +1,6 @@
|
||||
rendering
|
||||
renderCancelButtonOn: html
|
||||
html tbsButton
|
||||
beDanger;
|
||||
cancelCallback: [ self answer: nil ];
|
||||
with: 'Cancel'
|
@@ -0,0 +1,9 @@
|
||||
rendering
|
||||
renderContentOn: html
|
||||
html tbsContainer: [
|
||||
html heading with: 'Contact Editing'.
|
||||
html tbsForm with: [
|
||||
self renderFieldsOn: html.
|
||||
self renderButtonsOn: html
|
||||
]
|
||||
]
|
@@ -0,0 +1,10 @@
|
||||
rendering
|
||||
renderEmailFieldOn: html
|
||||
html tbsFormGroup: [
|
||||
html label: 'Email'.
|
||||
html emailInput
|
||||
tbsFormControl;
|
||||
placeholder: 'your@email.eu';
|
||||
callback: [ :email | self contact email: email address ];
|
||||
value: (self contact email ifNil: '')
|
||||
]
|
@@ -0,0 +1,4 @@
|
||||
rendering
|
||||
renderFieldsOn: html
|
||||
self renderFullnameFieldOn: html.
|
||||
self renderEmailFieldOn: html
|
@@ -0,0 +1,10 @@
|
||||
rendering
|
||||
renderFullnameFieldOn: html
|
||||
html tbsFormGroup: [
|
||||
html label: 'Fullname'.
|
||||
html textInput
|
||||
tbsFormControl;
|
||||
placeholder: 'fullname';
|
||||
callback: [ :value | self contact fullname: value ];
|
||||
value: (self contact fullname ifNil: '')
|
||||
]
|
@@ -0,0 +1,7 @@
|
||||
rendering
|
||||
renderSubmitButtonOn: html
|
||||
html tbsSubmitButton
|
||||
beSuccess;
|
||||
bePrimary;
|
||||
callback: [ self answer: self contact ];
|
||||
with: 'Save'
|
@@ -0,0 +1,3 @@
|
||||
accessing
|
||||
setContact: aContact
|
||||
contact := aContact
|
14
ContactBook.package/WAContact.class/properties.json
Normal file
14
ContactBook.package/WAContact.class/properties.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"category" : "ContactBook",
|
||||
"classinstvars" : [
|
||||
],
|
||||
"classvars" : [
|
||||
],
|
||||
"commentStamp" : "",
|
||||
"instvars" : [
|
||||
"contact" ],
|
||||
"name" : "WAContact",
|
||||
"pools" : [
|
||||
],
|
||||
"super" : "WAComponent",
|
||||
"type" : "normal" }
|
14
ContactBook.package/WAContactBook.class/README.md
Normal file
14
ContactBook.package/WAContactBook.class/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
I represent a contact book web application.
|
||||
|
||||
I render a contact book to HTML using Seaside.
|
||||
|
||||
Collaborators:
|
||||
Veit Heller <veit@veitheller.de>
|
||||
|
||||
Internal Representation and Key Implementation Points.
|
||||
|
||||
Instance Variables
|
||||
contactBook: a Contactbook
|
||||
|
||||
|
||||
Implementation Points
|
@@ -0,0 +1,5 @@
|
||||
initialization
|
||||
initialize
|
||||
(WAAdmin register: self asApplicationAt: 'contacts')
|
||||
addLibrary: JQDeploymentLibrary;
|
||||
addLibrary: TBSDeploymentLibrary
|
@@ -0,0 +1,4 @@
|
||||
rendering
|
||||
addContact
|
||||
(self call: WAContact new)
|
||||
ifNotNil: [ :contact | contactBook addContact: contact ]
|
@@ -0,0 +1,3 @@
|
||||
accessing
|
||||
contacts
|
||||
^ contactBook contacts
|
@@ -0,0 +1,3 @@
|
||||
operations
|
||||
contactsDo: aBlock
|
||||
self contacts do: aBlock
|
@@ -0,0 +1,4 @@
|
||||
initialization
|
||||
initialize
|
||||
super initialize.
|
||||
contactBook := ContactBook createDefault
|
@@ -0,0 +1,7 @@
|
||||
rendering
|
||||
renderButtonsForContact: aContact on: html
|
||||
html tbsButtonGroup: [
|
||||
self
|
||||
renderEditButtonForContact: aContact on: html;
|
||||
renderRemoveButtonForContact: aContact on: html
|
||||
]
|
@@ -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 ]
|
||||
]
|
@@ -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 ]
|
||||
]
|
@@ -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
|
||||
]
|
||||
]
|
@@ -0,0 +1,6 @@
|
||||
updating
|
||||
renderEditButtonForContact: aContact on: html
|
||||
html tbsButton
|
||||
beSuccess;
|
||||
callback: [ self call: (WAContact editContact: aContact) ];
|
||||
with: 'Edit'
|
@@ -0,0 +1,8 @@
|
||||
rendering
|
||||
renderGlobalButtonsOn: html
|
||||
html tbsButtonGroup: [
|
||||
html tbsButton
|
||||
beSuccess;
|
||||
callback: [ self addContact ];
|
||||
with: 'New contact'
|
||||
]
|
@@ -0,0 +1,3 @@
|
||||
rendering
|
||||
renderPhotoOf: aContact on: html
|
||||
html image url: aContact gravatarUrl
|
@@ -0,0 +1,6 @@
|
||||
rendering
|
||||
renderRemoveButtonForContact: aContact on: html
|
||||
html tbsButton
|
||||
beDanger;
|
||||
callback: [ self contactBook removeContact: aContact ];
|
||||
with: 'Remove'
|
@@ -0,0 +1,4 @@
|
||||
updating
|
||||
updateRoot: anHtmlRoot
|
||||
super updateRoot: anHtmlRoot.
|
||||
anHtmlRoot title: 'Contact Book'
|
14
ContactBook.package/WAContactBook.class/properties.json
Normal file
14
ContactBook.package/WAContactBook.class/properties.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"category" : "ContactBook",
|
||||
"classinstvars" : [
|
||||
],
|
||||
"classvars" : [
|
||||
],
|
||||
"commentStamp" : "VeitHeller 5/12/2018 14:29",
|
||||
"instvars" : [
|
||||
"contactBook" ],
|
||||
"name" : "WAContactBook",
|
||||
"pools" : [
|
||||
],
|
||||
"super" : "WAComponent",
|
||||
"type" : "normal" }
|
1
ContactBook.package/monticello.meta/categories.st
Normal file
1
ContactBook.package/monticello.meta/categories.st
Normal file
@@ -0,0 +1 @@
|
||||
SystemOrganization addCategory: #ContactBook!
|
0
ContactBook.package/monticello.meta/initializers.st
Normal file
0
ContactBook.package/monticello.meta/initializers.st
Normal file
1
ContactBook.package/monticello.meta/package
Normal file
1
ContactBook.package/monticello.meta/package
Normal file
@@ -0,0 +1 @@
|
||||
(name 'ContactBook')
|
2
ContactBook.package/properties.json
Normal file
2
ContactBook.package/properties.json
Normal file
@@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user