Add root components
This commit is contained in:
47
src/TinyBlog/TBApplicationRootComponent.class.st
Normal file
47
src/TinyBlog/TBApplicationRootComponent.class.st
Normal file
@@ -0,0 +1,47 @@
|
||||
Class {
|
||||
#name : #TBApplicationRootComponent,
|
||||
#superclass : #WAComponent,
|
||||
#instVars : [
|
||||
'main'
|
||||
],
|
||||
#category : #'TinyBlog-Components'
|
||||
}
|
||||
|
||||
{ #category : #testing }
|
||||
TBApplicationRootComponent class >> canBeRoot [
|
||||
^ true
|
||||
]
|
||||
|
||||
{ #category : #initialization }
|
||||
TBApplicationRootComponent class >> initialize [
|
||||
"self initialize"
|
||||
| app |
|
||||
app := WAAdmin register: self asApplicationAt: 'TinyBlog'.
|
||||
app
|
||||
addLibrary: JQDeploymentLibrary;
|
||||
addLibrary: JQUiDeploymentLibrary;
|
||||
addLibrary: SBSDeploymentLibrary
|
||||
]
|
||||
|
||||
{ #category : #rendering }
|
||||
TBApplicationRootComponent >> children [
|
||||
^ { main }
|
||||
]
|
||||
|
||||
{ #category : #initialization }
|
||||
TBApplicationRootComponent >> initialize [
|
||||
super initialize.
|
||||
main := TBScreenComponent new
|
||||
]
|
||||
|
||||
{ #category : #rendering }
|
||||
TBApplicationRootComponent >> renderContentOn: html [
|
||||
html render: main
|
||||
]
|
||||
|
||||
{ #category : #rendering }
|
||||
TBApplicationRootComponent >> updateRoot: anHtmlRoot [
|
||||
super updateRoot: anHtmlRoot.
|
||||
anHtmlRoot beHtml5.
|
||||
anHtmlRoot title: 'TinyBlog'
|
||||
]
|
23
src/TinyBlog/TBHeaderComponent.class.st
Normal file
23
src/TinyBlog/TBHeaderComponent.class.st
Normal file
@@ -0,0 +1,23 @@
|
||||
Class {
|
||||
#name : #TBHeaderComponent,
|
||||
#superclass : #WAComponent,
|
||||
#category : #'TinyBlog-Components'
|
||||
}
|
||||
|
||||
{ #category : #rendering }
|
||||
TBHeaderComponent >> renderBrandOn: html [
|
||||
html tbsNavbarHeader: [
|
||||
html tbsNavbarBrand
|
||||
url: self application url;
|
||||
with: 'TinyBlog'
|
||||
]
|
||||
]
|
||||
|
||||
{ #category : #rendering }
|
||||
TBHeaderComponent >> renderContentOn: html [
|
||||
html tbsNavbar beDefault; with: [
|
||||
html tbsContainer: [
|
||||
self renderBrandOn: html
|
||||
]
|
||||
]
|
||||
]
|
36
src/TinyBlog/TBScreenComponent.class.st
Normal file
36
src/TinyBlog/TBScreenComponent.class.st
Normal file
@@ -0,0 +1,36 @@
|
||||
Class {
|
||||
#name : #TBScreenComponent,
|
||||
#superclass : #WAComponent,
|
||||
#instVars : [
|
||||
'header'
|
||||
],
|
||||
#category : #'TinyBlog-Components'
|
||||
}
|
||||
|
||||
{ #category : #acccessing }
|
||||
TBScreenComponent >> blog [
|
||||
"Return the current blog. In the future we will ask the
|
||||
session to return the blog of the currently logged in user."
|
||||
^ TBBlog current
|
||||
]
|
||||
|
||||
{ #category : #acccessing }
|
||||
TBScreenComponent >> children [
|
||||
^ { header }
|
||||
]
|
||||
|
||||
{ #category : #initialization }
|
||||
TBScreenComponent >> createHeaderComponent [
|
||||
^ TBHeaderComponent new
|
||||
]
|
||||
|
||||
{ #category : #initialization }
|
||||
TBScreenComponent >> initialize [
|
||||
super initialize.
|
||||
header := self createHeaderComponent
|
||||
]
|
||||
|
||||
{ #category : #acccessing }
|
||||
TBScreenComponent >> renderContentOn: html [
|
||||
html render: header
|
||||
]
|
Reference in New Issue
Block a user