Skip to content
This repository
Newer
Older
100644 47 lines (40 sloc) 1.26 kb
ea209838 » billsaysthis
2010-11-26 edit event now has the time/date fields, rooms as checkbox list, part…
1 from google.appengine.ext import webapp
2 register = webapp.template.create_template_register()
3
4 @register.filter
db9c267b » jonathan
2011-04-13 patch for github issue #18... warn user who is trying to register the…
5 def strip_spaces(string):
6 return string.replace(" ", "")
7
8 @register.filter
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
9 def american_date(element):
10 return element.strftime('%m/%d/%Y')
11
12 @register.filter
ea209838 » billsaysthis
2010-11-26 edit event now has the time/date fields, rooms as checkbox list, part…
13 def check_filter(the_list, item):
14 if item in the_list:
15 cb = "checked='checked'"
16 else:
17 cb = ""
18 return cb
19
20 @register.filter
21 def select_hour(event, item):
22 return select_time(event,item,'hour')
23
24 @register.filter
25 def select_minute(event, item):
26 return select_time(event,item,'minute')
27
28 @register.filter
29 def select_ampm(event, item):
30 return select_time(event,item,'ampm')
31
32 # event = event timestamp
33 # item = UI element value (e.g., the specific hour or minute to compare)
34 # element = hour, minute, ampm
35 def select_time(event,item,element):
36 st = ""
37 if element == 'hour':
38 eh = event.hour if event.hour < 12 else event.hour - 12
39 if eh == item:
40 st = "selected='selected'"
41 if element == 'minute' and event.minute == item:
42 st = "selected='selected'"
43 if element == 'ampm':
44 half = "am" if event.hour < 12 else "pm"
45 if half == item:
46 st = "selected='selected'"
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
47 return st
Something went wrong with that request. Please try again.