forked from indymedia/epicyon
Circle around today
parent
93c5857272
commit
56ba5c1c19
|
@ -5,7 +5,7 @@
|
|||
--day-number: #a4a2a2;
|
||||
--day-number2: #c9c7c7;
|
||||
--today-foreground: white;
|
||||
--today-background: darkgray;
|
||||
--today-circle: yellow;
|
||||
}
|
||||
|
||||
body {
|
||||
|
@ -95,33 +95,14 @@ tr:nth-child(even) > .calendar__day__cell:nth-child(even) {
|
|||
background-color: blue;
|
||||
color: blue;
|
||||
}
|
||||
.calendar__day__cell[data-event]:after {
|
||||
content: attr(data-event);
|
||||
color: #F6E9DC;
|
||||
display: block;
|
||||
font-weight: 400;
|
||||
font-size: .75rem;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 1rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.calendar__day__cell[data-today] {
|
||||
background-color: var(--today-background);
|
||||
border-color: var(--today-background);
|
||||
color: var(--today-foreground);
|
||||
}
|
||||
.calendar__day__cell[data-today]:after {
|
||||
content: attr(data-today);
|
||||
color: var(--today-foreground);
|
||||
display: block;
|
||||
font-size: .75rem;
|
||||
font-weight: 400;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 1rem;
|
||||
text-transform: uppercase;
|
||||
border-radius: 50%;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
padding: 8px;
|
||||
|
||||
border: 4px solid var(--today-circle);
|
||||
color: var(--today-circle);
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -2751,6 +2751,51 @@ def weekDayOfMonthStart(monthNumber: int,year: int) -> int:
|
|||
firstDayOfMonth=datetime(year, monthNumber, 1, 0, 0)
|
||||
return int(firstDayOfMonth.strftime("%w"))+1
|
||||
|
||||
def getCalendarEvents(baseDir: str,nickname: str,domain: str,year: int,monthNumber: int) -> []:
|
||||
"""Retrieves calendar events
|
||||
Returns a list of lists containing Event and Place activities
|
||||
"""
|
||||
calendarFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/calendar/'+str(year)+'/'+str(monthNumber)+'.txt'
|
||||
events=[]
|
||||
if not os.path.isfile(calendarFilename):
|
||||
return events
|
||||
calendarPostIds=[]
|
||||
recreateEventsFile=False
|
||||
with open(calendarFilename,'r') as eventsFile:
|
||||
for postId in eventsFile:
|
||||
postFilename=locatePost(baseDir,nickname,domain,postId)
|
||||
if postFilename:
|
||||
postJsonObject=None
|
||||
try:
|
||||
with open(postFilename, 'r') as fp:
|
||||
postJsonObject=commentjson.load(fp)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
if postJsonObject:
|
||||
if postJsonObject.get('object'):
|
||||
if isinstance(postJsonObject['object'], dict):
|
||||
if postJsonObject['object'].get('tag'):
|
||||
postEvent=[]
|
||||
for tag in postJsonObject['object']['tag']:
|
||||
if tag.get('type'):
|
||||
if tag['type']=='Event' or tag['type']=='Place':
|
||||
postEvent.append(tag)
|
||||
if postEvent:
|
||||
calendarPostIds.append(postId)
|
||||
# TODO this should be in a calendar-like format
|
||||
events.append(postEvent)
|
||||
else:
|
||||
recreateEventsFile=True
|
||||
|
||||
# if some posts have been deleted then regenerate the calendar file
|
||||
if recreateEventsFile:
|
||||
calendarFile=open(calendarFilename, "w")
|
||||
for postId in calendarPostIds:
|
||||
calendarFile.write(postId+'\n')
|
||||
calendarFile.close()
|
||||
|
||||
return events
|
||||
|
||||
def htmlCalendar(translate: {}, \
|
||||
baseDir: str,path: str) -> str:
|
||||
"""Show the calendar for a person
|
||||
|
@ -2784,6 +2829,8 @@ def htmlCalendar(translate: {}, \
|
|||
nickname=getNicknameFromActor(actor)
|
||||
domain,port=getDomainFromActor(actor)
|
||||
|
||||
events=getCalendarEvents(baseDir,nickname,domain,year,monthNumber)
|
||||
|
||||
months=['Jaruary','February','March','April','May','June','July','August','September','October','November','December']
|
||||
monthName=translate[months[monthNumber-1]]
|
||||
|
||||
|
|
Loading…
Reference in New Issue