| as yet unclassified |
| canSelect: aDate
|
^ canSelectBlock notNil and: [canSelectBlock value: aDate]
|
| canSelectBlock: aBlock
|
canSelectBlock _ aBlock
|
| date
|
^ date contents
|
| date: aDate
|
date contents: aDate.
month contents: aDate month
|
| initialize
|
month _ WAStateHolder new contents: Date today month.
date _ WAStateHolder new.
|
| month
|
^ month contents
|
| month: aMonth
|
^ month contents: aMonth
|
| monthHeading
|
^ self month name, ' ', self month year asString
|
| renderCellForDate: aDate on: html
|
html tableData: [
aDate month = self month ifTrue:
[html cssClass: (self date = aDate ifTrue: ['calendarArchiveDate']).
html span: [
(self canSelect: aDate)
ifTrue: [html anchorWithAction: [self select: aDate] text: aDate dayOfMonth]
ifFalse: [html text: aDate dayOfMonth]
]]
]
|
| renderContentOn: html
|
html divClass: 'calendar' with: [
html spanClass: 'calendarCaption' with: self monthHeading.
html table: [
html cssClass: 'calendarTitle'; tableRow: [
self weekDays do: [:ea | html tableData: ea].
].
self month eachWeekDo: [:week | self renderRowForWeek: week on: html].
].
self renderMonthNavigationOn: html.
]
|
| renderMonthNavigationOn: html
|
html spanClass: 'calendarPrevious' with: [
html
anchorWithAction: [self month: self month previous]
text: (self month previous name first: 3).
].
html space.
html spanClass: 'calendarNext' with: [
html
anchorWithAction: [self month: self month next]
text: (self month next name first: 3).
]
|
| renderRowForWeek: aWeek on: html
|
html tableRow: [
aWeek do: [:ea | self renderCellForDate: ea on: html].
]
|
| select: aDate
|
self date: aDate.
selectBlock ifNotNil: [selectBlock value: aDate]
|
| selectBlock: aBlock
|
selectBlock _ aBlock
|
| weekDays
|
^ (1 to: 7) collect: [:i | (Date nameOfDay: i) first: 3]
|