summaryrefslogtreecommitdiff
path: root/pharo-mooc/tiny-blog/src/TinyBlog-Components/TBApplicationRootComponent.class.st
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-11-21 22:20:10 +0100
committerEugen Wissner <belka@caraus.de>2025-11-21 22:20:10 +0100
commitc03c9f8b886c0e8eca5a701c0ca941e05e0b6285 (patch)
tree5f27293563caa042b182de97fe59b22e2cbd533a /pharo-mooc/tiny-blog/src/TinyBlog-Components/TBApplicationRootComponent.class.st
parentc0336dac8effb57c04221f23b72bff70170933c5 (diff)
downloadbook-exercises-c03c9f8b886c0e8eca5a701c0ca941e05e0b6285.tar.gz
Add pharo tiny blog
Diffstat (limited to 'pharo-mooc/tiny-blog/src/TinyBlog-Components/TBApplicationRootComponent.class.st')
-rw-r--r--pharo-mooc/tiny-blog/src/TinyBlog-Components/TBApplicationRootComponent.class.st57
1 files changed, 57 insertions, 0 deletions
diff --git a/pharo-mooc/tiny-blog/src/TinyBlog-Components/TBApplicationRootComponent.class.st b/pharo-mooc/tiny-blog/src/TinyBlog-Components/TBApplicationRootComponent.class.st
new file mode 100644
index 0000000..6c8d80c
--- /dev/null
+++ b/pharo-mooc/tiny-blog/src/TinyBlog-Components/TBApplicationRootComponent.class.st
@@ -0,0 +1,57 @@
+Class {
+ #name : 'TBApplicationRootComponent',
+ #superclass : 'WAComponent',
+ #instVars : [
+ 'main'
+ ],
+ #category : 'TinyBlog-Components',
+ #package : 'TinyBlog-Components'
+}
+
+{ #category : 'testing' }
+TBApplicationRootComponent class >> canBeRoot [
+ ^ true
+]
+
+{ #category : 'initialization' }
+TBApplicationRootComponent class >> initialize [
+ "self initialize"
+ | app |
+ app := WAAdmin register: self asApplicationAt: 'TinyBlog'.
+ app
+ preferenceAt: #sessionClass put: TBSession.
+ app
+ addLibrary: JQDeploymentLibrary;
+ addLibrary: JQUiDeploymentLibrary;
+ addLibrary: SBSDeploymentLibrary
+]
+
+{ #category : 'rendering' }
+TBApplicationRootComponent >> children [
+ ^ { main }
+]
+
+{ #category : 'initialization' }
+TBApplicationRootComponent >> initialize [
+ super initialize.
+ main := TBPostsListComponent new
+]
+
+{ #category : 'initialization' }
+TBApplicationRootComponent >> main: aComponent [
+
+ main := aComponent
+]
+
+{ #category : 'rendering' }
+TBApplicationRootComponent >> renderContentOn: html [
+ html render: main.
+ SBSDeploymentLibrary addLoadScriptTo: html
+]
+
+{ #category : 'rendering' }
+TBApplicationRootComponent >> updateRoot: anHtmlRoot [
+ super updateRoot: anHtmlRoot.
+ anHtmlRoot beHtml5.
+ anHtmlRoot title: 'TinyBlog'
+]