Today's Smalltalk Daily builds a simple Blog Server in WebVelocity 1.1 - 3 methods and 5 minutes. To jump to the video now, click here.
The code I added is:
PostViewUI
renderActionsOn: html
super renderActionsOn: html.
html button
class: #comment;
callback: [self addComment];
with: 'Comment'.
addComment
| comment |
comment := Comment new.
(self call: (CommentEditUI on: comment)) ifTrue:
[comment bePersistent.
object comments add: comment.
object commitUnitOfWork]
PostListUI
renderDetailsOn: html
| sorted |
sorted := SortedCollection sortBlock: [:a :b | a created >= b created].
sorted addAll: self objects.
sorted do: [:each |
html anchor
callback: [self call: (PostViewUI on: each)];
with: each title.
html text: ' -- ', each created printString.
html paragraph: [html text: each content].
html horizontalRule]
Click on the viewer below to watch it now:
If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.
You can also watch it on YouTube:
Technorati Tags:
smalltalk, seaside, webvelocity, blog server