Add administration view button
This commit is contained in:
24
src/TinyBlog-Components/TBAdminComponent.class.st
Normal file
24
src/TinyBlog-Components/TBAdminComponent.class.st
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
Class {
|
||||||
|
#name : 'TBAdminComponent',
|
||||||
|
#superclass : 'TBScreenComponent',
|
||||||
|
#category : 'TinyBlog-Components',
|
||||||
|
#package : 'TinyBlog-Components'
|
||||||
|
}
|
||||||
|
|
||||||
|
{ #category : 'initialization' }
|
||||||
|
TBAdminComponent >> createHeaderComponent [
|
||||||
|
^ TBAdminHeaderComponent from: self
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : 'rendering' }
|
||||||
|
TBAdminComponent >> goToPostListView [
|
||||||
|
self answer
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : 'acccessing' }
|
||||||
|
TBAdminComponent >> renderContentOn: html [
|
||||||
|
super renderContentOn: html.
|
||||||
|
html container: [
|
||||||
|
html heading: 'Blog Admin'.
|
||||||
|
html horizontalRule ]
|
||||||
|
]
|
20
src/TinyBlog-Components/TBAdminHeaderComponent.class.st
Normal file
20
src/TinyBlog-Components/TBAdminHeaderComponent.class.st
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
Class {
|
||||||
|
#name : 'TBAdminHeaderComponent',
|
||||||
|
#superclass : 'TBHeaderComponent',
|
||||||
|
#category : 'TinyBlog-Components',
|
||||||
|
#package : 'TinyBlog-Components'
|
||||||
|
}
|
||||||
|
|
||||||
|
{ #category : 'rendering' }
|
||||||
|
TBAdminHeaderComponent >> renderButtonsOn: html [
|
||||||
|
html form: [ self renderDisconnectButtonOn: html ]
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : 'rendering' }
|
||||||
|
TBAdminHeaderComponent >> renderDisconnectButtonOn: html [
|
||||||
|
html formButton beSecondary;
|
||||||
|
callback: [ component goToPostListView ];
|
||||||
|
with: [
|
||||||
|
html text: 'Disconnect'.
|
||||||
|
html span class: 'glyphicon glyphicon-logout' ]
|
||||||
|
]
|
@@ -1,10 +1,32 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : 'TBHeaderComponent',
|
#name : 'TBHeaderComponent',
|
||||||
#superclass : 'SBSComponent',
|
#superclass : 'SBSComponent',
|
||||||
|
#instVars : [
|
||||||
|
'component'
|
||||||
|
],
|
||||||
#category : 'TinyBlog-Components',
|
#category : 'TinyBlog-Components',
|
||||||
#package : 'TinyBlog-Components'
|
#package : 'TinyBlog-Components'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #category : 'instance creation' }
|
||||||
|
TBHeaderComponent class >> from: aComponent [
|
||||||
|
^ self new
|
||||||
|
component: aComponent;
|
||||||
|
yourself
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : 'accessing' }
|
||||||
|
TBHeaderComponent >> component [
|
||||||
|
|
||||||
|
^ component
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : 'accessing' }
|
||||||
|
TBHeaderComponent >> component: anObject [
|
||||||
|
|
||||||
|
component := anObject
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : 'rendering' }
|
{ #category : 'rendering' }
|
||||||
TBHeaderComponent >> renderBrandOn: html [
|
TBHeaderComponent >> renderBrandOn: html [
|
||||||
html navigationBarBrand
|
html navigationBarBrand
|
||||||
@@ -12,6 +34,11 @@ TBHeaderComponent >> renderBrandOn: html [
|
|||||||
with: 'TinyBlog'
|
with: 'TinyBlog'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : 'rendering' }
|
||||||
|
TBHeaderComponent >> renderButtonsOn: html [
|
||||||
|
self renderSimpleAdminButtonOn: html
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : 'rendering' }
|
{ #category : 'rendering' }
|
||||||
TBHeaderComponent >> renderContentOn: html [
|
TBHeaderComponent >> renderContentOn: html [
|
||||||
| bar |
|
| bar |
|
||||||
@@ -20,7 +47,18 @@ TBHeaderComponent >> renderContentOn: html [
|
|||||||
bar background beLight.
|
bar background beLight.
|
||||||
bar with: [
|
bar with: [
|
||||||
html container: [
|
html container: [
|
||||||
self renderBrandOn: html
|
self renderBrandOn: html.
|
||||||
|
self renderButtonsOn: html
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : 'rendering' }
|
||||||
|
TBHeaderComponent >> renderSimpleAdminButtonOn: html [
|
||||||
|
html form: [
|
||||||
|
html formButton beSecondary;
|
||||||
|
callback: [ component goToAdministrationView ];
|
||||||
|
with: [
|
||||||
|
html span class: 'glyphicon glyphicon-list-alt'.
|
||||||
|
html text: 'Admin View' ] ]
|
||||||
|
]
|
||||||
|
@@ -43,6 +43,11 @@ TBPostsListComponent >> currentCategory: anObject [
|
|||||||
currentCategory := anObject
|
currentCategory := anObject
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : 'as yet unclassified' }
|
||||||
|
TBPostsListComponent >> goToAdministrationView [
|
||||||
|
self call: TBAdminComponent new
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : 'initialization' }
|
{ #category : 'initialization' }
|
||||||
TBPostsListComponent >> initialize [
|
TBPostsListComponent >> initialize [
|
||||||
super initialize.
|
super initialize.
|
||||||
|
@@ -22,7 +22,7 @@ TBScreenComponent >> children [
|
|||||||
|
|
||||||
{ #category : 'initialization' }
|
{ #category : 'initialization' }
|
||||||
TBScreenComponent >> createHeaderComponent [
|
TBScreenComponent >> createHeaderComponent [
|
||||||
^ TBHeaderComponent new
|
^ TBHeaderComponent from: self
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : 'initialization' }
|
{ #category : 'initialization' }
|
||||||
|
Reference in New Issue
Block a user