Skip to content

Commit f4124af

Browse files
committed
Add missing EmailPresenter>>#modelChanged
1 parent 603dc22 commit f4124af

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Chapters/MailApp/MailApp.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,17 @@ EmailPresenter >> connectPresenters
353353
body whenTextChangedDo: [ :text | self model body: text ]
354354
```
355355

356+
`EmailPresenter` inherits from `SpPresenterWithModel`, which means that we have to state in the `modelChanged` method what should happen when the model changes. We set the text of the four fields.
357+
358+
```
359+
EmailPresenter >> modelChanged
360+
361+
from text: (self model from ifNil: [ '' ]).
362+
to text: (self model to ifNil: [ '' ]).
363+
subject text: (self model subject ifNil: [ '' ]).
364+
body text: (self model body ifNil: [ '' ])
365+
```
366+
356367
For convenience later on, we define two extra methods to make the fields editable or read-only.
357368

358369
```

0 commit comments

Comments
 (0)