From 4dbc1a7c7c31a3033baf51dbf6415ef402b618ea Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 1 Oct 2025 01:00:08 +0200 Subject: [PATCH] Update to bootstrap 4 --- src/ContactBook/Contact.class.st | 21 +++++----- src/ContactBook/ContactBook.class.st | 19 +++++---- src/ContactBook/ContactBookTest.class.st | 17 ++++---- src/ContactBook/ContactTest.class.st | 11 ++--- src/ContactBook/WAContact.class.st | 49 +++++++++++----------- src/ContactBook/WAContactBook.class.st | 53 ++++++++++++------------ src/ContactBook/package.st | 2 +- 7 files changed, 89 insertions(+), 83 deletions(-) diff --git a/src/ContactBook/Contact.class.st b/src/ContactBook/Contact.class.st index f93541d..67ca674 100644 --- a/src/ContactBook/Contact.class.st +++ b/src/ContactBook/Contact.class.st @@ -3,16 +3,17 @@ I represent a person with a name and an email address. I'm usually part of a contact book. " Class { - #name : #Contact, - #superclass : #Object, + #name : 'Contact', + #superclass : 'Object', #instVars : [ 'fullname', 'email' ], - #category : #ContactBook + #category : 'ContactBook', + #package : 'ContactBook' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } Contact class >> newNamed: aNameString email: anEmailString [ ^ self new fullname: aNameString; @@ -20,38 +21,38 @@ Contact class >> newNamed: aNameString email: anEmailString [ yourself ] -{ #category : #accessing } +{ #category : 'accessing' } Contact >> email [ ^ email ] -{ #category : #accessing } +{ #category : 'accessing' } Contact >> email: anObject [ email := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } Contact >> fullname [ ^ fullname ] -{ #category : #accessing } +{ #category : 'accessing' } Contact >> fullname: aString [ fullname := aString ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } Contact >> gravatarUrl [ ^ 'http://www.gravatar.com/avatar/', (MD5 hashMessage: email asString trimBoth asLowercase) hex, '.jpg' ] -{ #category : #accessing } +{ #category : 'accessing' } Contact >> printOn: aStream [ aStream nextPutAll: self fullname; diff --git a/src/ContactBook/ContactBook.class.st b/src/ContactBook/ContactBook.class.st index 20af36d..3c6ef69 100644 --- a/src/ContactBook/ContactBook.class.st +++ b/src/ContactBook/ContactBook.class.st @@ -1,13 +1,14 @@ Class { - #name : #ContactBook, - #superclass : #Object, + #name : 'ContactBook', + #superclass : 'Object', #instVars : [ 'contacts' ], - #category : #ContactBook + #category : 'ContactBook', + #package : 'ContactBook' } -{ #category : #demos } +{ #category : 'demos' } ContactBook class >> createDefault [ ^ self new addContact: (Contact newNamed: 'Damien Cassou' email: 'damien@cassou.me'); @@ -17,28 +18,28 @@ ContactBook class >> createDefault [ yourself ] -{ #category : #writing } +{ #category : 'writing' } ContactBook >> addContact: aContact [ self contacts add: aContact ] -{ #category : #reading } +{ #category : 'reading' } ContactBook >> contacts [ ^ contacts ] -{ #category : #initialization } +{ #category : 'initialization' } ContactBook >> initialize [ super initialize. contacts := OrderedCollection new ] -{ #category : #deleting } +{ #category : 'deleting' } ContactBook >> removeContact: aContact [ self contacts remove: aContact ] -{ #category : #initialization } +{ #category : 'initialization' } ContactBook >> size [ ^ contacts size ] diff --git a/src/ContactBook/ContactBookTest.class.st b/src/ContactBook/ContactBookTest.class.st index 80d3bb0..6e5cf2d 100644 --- a/src/ContactBook/ContactBookTest.class.st +++ b/src/ContactBook/ContactBookTest.class.st @@ -1,14 +1,15 @@ Class { - #name : #ContactBookTest, - #superclass : #TestCase, + #name : 'ContactBookTest', + #superclass : 'TestCase', #instVars : [ 'blog', 'post' ], - #category : #ContactBook + #category : 'ContactBook', + #package : 'ContactBook' } -{ #category : #running } +{ #category : 'running' } ContactBookTest >> setUp [ blog := ContactBook new. blog addContact: (Contact newNamed: 'Tudor Girba' email: 'tudor@tudorgirba.com'). @@ -16,25 +17,25 @@ ContactBookTest >> setUp [ post := Contact newNamed: 'Clara Allende' email: 'clari.allende@gmail.com' ] -{ #category : #tests } +{ #category : 'tests' } ContactBookTest >> testAddContact [ blog addContact: post. self assert: blog size equals: 2 ] -{ #category : #tests } +{ #category : 'tests' } ContactBookTest >> testContacts [ blog addContact: post. self assert: blog contacts size equals: 2 ] -{ #category : #tests } +{ #category : 'tests' } ContactBookTest >> testRemoveContact [ blog removeContact: blog contacts first. self assert: blog size equals: 0 ] -{ #category : #tests } +{ #category : 'tests' } ContactBookTest >> testSize [ self assert: blog size equals: 1 ] diff --git a/src/ContactBook/ContactTest.class.st b/src/ContactBook/ContactTest.class.st index c3e21c3..c1dc553 100644 --- a/src/ContactBook/ContactTest.class.st +++ b/src/ContactBook/ContactTest.class.st @@ -1,10 +1,11 @@ Class { - #name : #ContactTest, - #superclass : #TestCase, - #category : #ContactBook + #name : 'ContactTest', + #superclass : 'TestCase', + #category : 'ContactBook', + #package : 'ContactBook' } -{ #category : #tests } +{ #category : 'tests' } ContactTest >> testCreation [ | contact | @@ -15,7 +16,7 @@ ContactTest >> testCreation [ self assert: contact email equals: 'marcus.denker@inria.fr' ] -{ #category : #tests } +{ #category : 'tests' } ContactTest >> testPrinting [ | contact | diff --git a/src/ContactBook/WAContact.class.st b/src/ContactBook/WAContact.class.st index 5b2c639..d9663ce 100644 --- a/src/ContactBook/WAContact.class.st +++ b/src/ContactBook/WAContact.class.st @@ -1,94 +1,95 @@ Class { - #name : #WAContact, - #superclass : #WAComponent, + #name : 'WAContact', + #superclass : 'WAComponent', #instVars : [ 'contact' ], - #category : #ContactBook + #category : 'ContactBook', + #package : 'ContactBook' } -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } WAContact class >> editContact: aContact [ ^ self new setContact: aContact; yourself ] -{ #category : #initialization } +{ #category : 'initialization' } WAContact >> contact [ ^ contact ] -{ #category : #initialization } +{ #category : 'initialization' } WAContact >> initialize [ super initialize. contact := Contact new ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } WAContact >> renderButtonsOn: html [ - html tbsFormGroup: [ - html tbsButtonGroup: [ + html formGroup: [ + html buttonGroup: [ self renderSubmitButtonOn: html; renderCancelButtonOn: html ] ] ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } WAContact >> renderCancelButtonOn: html [ - html tbsButton + html outlineButton beDanger; cancelCallback: [ self answer: nil ]; with: 'Cancel' ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } WAContact >> renderContentOn: html [ - html tbsContainer: [ + html container: [ html heading with: 'Contact Editing'. - html tbsForm with: [ + html form with: [ self renderFieldsOn: html. self renderButtonsOn: html ] ] ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } WAContact >> renderEmailFieldOn: html [ - html tbsFormGroup: [ + html formGroup: [ html label: 'Email'. html emailInput - tbsFormControl; + formControl; placeholder: 'your@email.eu'; callback: [ :value | self contact email: value ]; value: (self contact email ifNil: '') ] ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } WAContact >> renderFieldsOn: html [ self renderFullnameFieldOn: html. self renderEmailFieldOn: html ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } WAContact >> renderFullnameFieldOn: html [ - html tbsFormGroup: [ + html formGroup: [ html label: 'Fullname'. html textInput - tbsFormControl; + formControl; placeholder: 'fullname'; callback: [ :value | self contact fullname: value ]; value: (self contact fullname ifNil: '') ] ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } WAContact >> renderSubmitButtonOn: html [ - html tbsSubmitButton + html submitButton beSuccess; bePrimary; callback: [ self answer: self contact ]; with: 'Save' ] -{ #category : #initialization } +{ #category : 'initialization' } WAContact >> setContact: aContact [ contact := aContact ] diff --git a/src/ContactBook/WAContactBook.class.st b/src/ContactBook/WAContactBook.class.st index db0a964..1e0d7fb 100644 --- a/src/ContactBook/WAContactBook.class.st +++ b/src/ContactBook/WAContactBook.class.st @@ -1,49 +1,50 @@ Class { - #name : #WAContactBook, - #superclass : #WAComponent, + #name : 'WAContactBook', + #superclass : 'WAComponent', #instVars : [ 'contactBook' ], - #category : #ContactBook + #category : 'ContactBook', + #package : 'ContactBook' } -{ #category : #initialization } +{ #category : 'initialization' } WAContactBook class >> initialize [ (WAAdmin register: self asApplicationAt: 'contacts') addLibrary: JQDeploymentLibrary; - addLibrary: TBSDeploymentLibrary + addLibrary: SBSDevelopmentLibrary ] -{ #category : #rendering } +{ #category : 'rendering' } WAContactBook >> addContact [ (self call: WAContact new) ifNotNil: [ :contact | contactBook addContact: contact ] ] -{ #category : #accessing } +{ #category : 'accessing' } WAContactBook >> contactBook [ ^ contactBook ifNil: [ contactBook := ContactBook createDefault ] ] -{ #category : #accessing } +{ #category : 'accessing' } WAContactBook >> contacts [ ^ self contactBook contacts ] -{ #category : #iterating } +{ #category : 'iterating' } WAContactBook >> contactsDo: aBlock [ self contacts do: aBlock ] -{ #category : #rendering } +{ #category : 'rendering' } WAContactBook >> renderButtonsForContact: aContact on: html [ - html tbsButtonGroup: [ + html buttonGroup: [ self renderEditButtonForContact: aContact on: html; renderRemoveButtonForContact: aContact on: html ] ] -{ #category : #rendering } +{ #category : 'rendering' } WAContactBook >> renderContact: aContact on: html [ html tableRow: [ html @@ -53,9 +54,9 @@ WAContactBook >> renderContact: aContact on: html [ tableData: [ self renderButtonsForContact: aContact on: html ] ] ] -{ #category : #rendering } +{ #category : 'rendering' } WAContactBook >> renderContactsOn: html [ - html tbsTable: [ + html table: [ html tableHead: [ html tableHeading: 'Name'; @@ -64,51 +65,51 @@ WAContactBook >> renderContactsOn: html [ self contactsDo: [ :contact | self renderContact: contact on: html ] ] ] -{ #category : #rendering } +{ #category : 'rendering' } WAContactBook >> renderContentOn: html [ "Main entry point of the view. Render both a title and the list of contacts." html - tbsContainer: [ + container: [ html heading level: 1; with: 'My Contact Book'. - html tbsForm: [ + html form: [ self renderContactsOn: html. self renderGlobalButtonsOn: html ] ] ] -{ #category : #rendering } +{ #category : 'rendering' } WAContactBook >> renderEditButtonForContact: aContact on: html [ - html tbsButton + html outlineButton beSuccess; callback: [ self call: (WAContact editContact: aContact) ]; with: 'Edit' ] -{ #category : #rendering } +{ #category : 'rendering' } WAContactBook >> renderGlobalButtonsOn: html [ - html tbsButtonGroup: [ - html tbsButton + html buttonGroup: [ + html outlineButton beSuccess; callback: [ self addContact ]; with: 'New contact' ] ] -{ #category : #rendering } +{ #category : 'rendering' } WAContactBook >> renderPhotoOf: aContact on: html [ html image url: aContact gravatarUrl ] -{ #category : #rendering } +{ #category : 'rendering' } WAContactBook >> renderRemoveButtonForContact: aContact on: html [ - html tbsButton + html outlineButton beDanger; callback: [ self contactBook removeContact: aContact ]; with: 'Remove' ] -{ #category : #updating } +{ #category : 'updating' } WAContactBook >> updateRoot: anHtmlRoot [ super updateRoot: anHtmlRoot. anHtmlRoot title: 'Contact Book' diff --git a/src/ContactBook/package.st b/src/ContactBook/package.st index 9b6cb2b..eb8ba7a 100644 --- a/src/ContactBook/package.st +++ b/src/ContactBook/package.st @@ -1 +1 @@ -Package { #name : #ContactBook } +Package { #name : 'ContactBook' }