Add administration view button

This commit is contained in:
2025-10-04 05:40:23 +02:00
parent ead239c061
commit 41d2f66eaa
5 changed files with 89 additions and 2 deletions

View 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 ]
]

View 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' ]
]

View File

@@ -1,10 +1,32 @@
Class {
#name : 'TBHeaderComponent',
#superclass : 'SBSComponent',
#instVars : [
'component'
],
#category : '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' }
TBHeaderComponent >> renderBrandOn: html [
html navigationBarBrand
@@ -12,6 +34,11 @@ TBHeaderComponent >> renderBrandOn: html [
with: 'TinyBlog'
]
{ #category : 'rendering' }
TBHeaderComponent >> renderButtonsOn: html [
self renderSimpleAdminButtonOn: html
]
{ #category : 'rendering' }
TBHeaderComponent >> renderContentOn: html [
| bar |
@@ -20,7 +47,18 @@ TBHeaderComponent >> renderContentOn: html [
bar background beLight.
bar with: [
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' ] ]
]

View File

@@ -43,6 +43,11 @@ TBPostsListComponent >> currentCategory: anObject [
currentCategory := anObject
]
{ #category : 'as yet unclassified' }
TBPostsListComponent >> goToAdministrationView [
self call: TBAdminComponent new
]
{ #category : 'initialization' }
TBPostsListComponent >> initialize [
super initialize.

View File

@@ -22,7 +22,7 @@ TBScreenComponent >> children [
{ #category : 'initialization' }
TBScreenComponent >> createHeaderComponent [
^ TBHeaderComponent new
^ TBHeaderComponent from: self
]
{ #category : 'initialization' }