blob: 67761868bf36997cf20d6930965ab368a6d854b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
Class {
#name : 'TBCategoriesComponent',
#superclass : 'TBScreenComponent',
#instVars : [
'categories',
'postsList'
],
#category : 'TinyBlog-Components',
#package : 'TinyBlog-Components'
}
{ #category : 'instance creation' }
TBCategoriesComponent class >> categories: categories postsList: aTBScreen [
^ self new categories: categories; postsList: aTBScreen
]
{ #category : 'accessing' }
TBCategoriesComponent >> categories [
^ categories
]
{ #category : 'accessing' }
TBCategoriesComponent >> categories: anObject [
categories := anObject
]
{ #category : 'accessing' }
TBCategoriesComponent >> postsList [
^ postsList
]
{ #category : 'accessing' }
TBCategoriesComponent >> postsList: anObject [
postsList := anObject
]
{ #category : 'actions' }
TBCategoriesComponent >> renderCategoryLinkOn: html with: aCategory [
html listGroupLinkedItem
class: 'active' if: aCategory = self postsList currentCategory;
callback: [ self selectCategory: aCategory ];
with: aCategory
]
{ #category : 'actions' }
TBCategoriesComponent >> renderContentOn: html [
html listGroup: [
html listGroupItem
with: [ html strong: 'Categories' ].
categories do: [ :cat |
self renderCategoryLinkOn: html with: cat ] ]
]
{ #category : 'actions' }
TBCategoriesComponent >> selectCategory: aCategory [
postsList currentCategory: aCategory
]
|