Skip to content

Commit

Permalink
Usability and display improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
onyxfish committed Sep 28, 2009
1 parent 94adb7a commit 3aab162
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 16 deletions.
4 changes: 2 additions & 2 deletions citizen/templates/include_branch.html
Expand Up @@ -11,9 +11,9 @@
{% for event in branch.events %}
<br />
<div class="event">
<div class="expander"><img src="img/closed.png" /></div>
<div class="expander" title="Click to toggle event details"><img src="img/closed.png" /></div>
<div class="summary">
<span class="event_date">{{ event.datetime|iso8601_pretty }}</strong><br />
<span class="event_entity">{{ event.entity }}</span><span class="test">{{ event.datetime|iso8601_pretty_time }}</span><br />
<span class="event_title">{{ event.title|safe }}</span>
</div>
<div class="clear"></div>
Expand Down
8 changes: 4 additions & 4 deletions citizen/templates/index.html
Expand Up @@ -3,7 +3,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Voter's Daily</title>
<title>Voter's Daily for {{ lookup_date|date:"F j, Y" }}</title>
<link type="text/css" rel="stylesheet" href="css/reset.css" />
<link type="text/css" rel="stylesheet" href="css/text.css" />
<link type="text/css" rel="stylesheet" href="css/960.css" />
Expand All @@ -16,10 +16,10 @@
<div>&nbsp;</div>
<div>&nbsp;</div>
<div class="container_12">
<h1 id="title">Voter's Daily</h1>
<h1 id="title">Voter's Daily for {{ lookup_date|date:"F j, Y" }}</h1>
<div id="form_wrapper">
<form name="date_form" action="" method="get">
<input type="text" id="date_text" value="{{ lookup_date|date:"F j, Y" }}" />
<input type="text" id="date_text" value="Click to view calendar..." />
<input type="hidden" id="date_iso8601" value=""{{ lookup_date|date:"Y-m-d" }}" />
<input type="button" id="go_button" onClick="openDate(this.form)" value="Go" />
</form>
Expand All @@ -29,7 +29,7 @@ <h1 id="title">Voter's Daily</h1>
{% include_branch branches.judicial %}
{% include_branch branches.legislative %}
</div>
<div>&nbsp;</div>
<br />

<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
Expand Down
15 changes: 14 additions & 1 deletion citizen/templatetags/api_helpers.py
Expand Up @@ -27,7 +27,20 @@ def iso8601_pretty(value):
if dt.hour == 0 and dt.minute == 0 and dt.second == 0:
return dt.strftime('%B %-d, %Y')
else:
return dt.strftime('%B %-d, %Y at %-I:%M%p')
return dt.strftime('%B %-d, %Y at %-I:%M %p')
except:
return ''

@register.filter
@stringfilter
def iso8601_pretty_time(value):
try:
dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%SZ')

if dt.hour == 0 and dt.minute == 0 and dt.second == 0:
return ''
else:
return dt.strftime('%-I:%M %p')
except:
return ''

Expand Down
21 changes: 13 additions & 8 deletions citizen/views.py
Expand Up @@ -144,15 +144,20 @@ def index(request, lookup_date):
elif value['branch'] == 'Legislative':
value['id'] = key
branches['legislative']['events'].append(value)

def compare_events(a, b):
entity_test = cmp(a['entity'], b['entity'])

if entity_test == 0:
return cmp(a['datetime'], b['datetime'])
else:
return entity_test

#compare_ids = lambda a, b: cmp(a['id'], b['id'])

compare_ids = lambda a, b: cmp(a['id'], b['id'])

branches['executive']['events'].sort(compare_ids)
branches['executive']['events'].reverse()
branches['judicial']['events'].sort(compare_ids)
branches['judicial']['events'].reverse()
branches['legislative']['events'].sort(compare_ids)
branches['legislative']['events'].reverse()
branches['executive']['events'].sort(compare_events)
branches['judicial']['events'].sort(compare_events)
branches['legislative']['events'].sort(compare_events)

return render_to_response('index.html', {
'lookup_date': lookup_date,
Expand Down
8 changes: 7 additions & 1 deletion css/custom.css
Expand Up @@ -40,7 +40,13 @@ h1#title {
}

.event_date {
font-weight: normal;
}

.event_entity {
}

.test {
float: right;
}

.event_title {
Expand Down

0 comments on commit 3aab162

Please sign in to comment.