Skip to content

Commit

Permalink
Merge branch 'design-2012-11-13' of github.com:sunlightlabs/openstate…
Browse files Browse the repository at this point in the history
…s into design-2012-11-13
  • Loading branch information
twneale committed Feb 4, 2013
2 parents a4c7207 + 5dbd7fe commit d4ae6aa
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 59 deletions.
54 changes: 54 additions & 0 deletions billy_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,60 @@

ENABLE_ELASTICSEARCH = True
BOUNDARY_SERVICE_SETS = 'sldl,sldu'
ENABLE_DOCUMENT_VIEW = {
'ak': True,
'al': True,
'ar': False, # revisit
'az': True,
'ca': False,
'co': False, # revisit
'ct': True,
'dc': True,
'de': True,
'fl': True,
'ga': False,
'hi': True,
'ia': True,
'id': True,
'il': True,
'in': True,
'ks': True,
'ky': True,
'la': False, # revisit
'ma': False,
'md': True,
'me': True,
'mi': True,
'mn': False,
'mo': True,
'ms': True,
'mt': True,
'nc': True,
'nd': True,
'ne': True,
'nh': True,
'nj': True,
'nm': True,
'nv': True,
'ny': False,
'oh': True,
'ok': True,
'or': True,
'pa': False, # revisit
'pr': True,
'ri': False, # revisit
'sc': True,
'sd': False,
'tn': True,
'tx': False, # revisit
'ut': True,
'va': False,
'vt': True,
'wa': False, # revisit
'wi': True,
'wv': False,
'wv': True
}

try:
from billy_local import *
Expand Down
2 changes: 2 additions & 0 deletions manual_data/districts/pr.csv
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pr,lower,6,1,sldl/pr-6
pr,lower,7,1,sldl/pr-7
pr,lower,8,1,sldl/pr-8
pr,lower,9,1,sldl/pr-9
pr,lower,At-Large,11,cd/pr-resident-commissioner-district-at-large
pr,upper,I,1,sldu/pr-i
pr,upper,II,2,sldu/pr-ii
pr,upper,III,2,sldu/pr-iii
Expand All @@ -47,3 +48,4 @@ pr,upper,V,2,sldu/pr-v
pr,upper,VI,2,sldu/pr-vi
pr,upper,VII,2,sldu/pr-vii
pr,upper,VIII,2,sldu/pr-viii
pr,upper,At-Large,11,cd/pr-resident-commissioner-district-at-large
30 changes: 13 additions & 17 deletions openstates/pr/legislators.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@ def scrape(self, chamber, term):
self.scrape_house(term)

def scrape_senate(self, term):
urls = (
'http://www.senadopr.us/senadores/Pages/Senadores%20Acumulacion.aspx',
'http://www.senadopr.us/Pages/Senadores%20Distrito%20I.aspx',
'http://www.senadopr.us/Pages/Senadores%20Distrito%20II.aspx',
'http://www.senadopr.us/Pages/Senadores%20Distrito%20III.aspx',
'http://www.senadopr.us/Pages/Senadores%20Distrito%20IV.aspx',
'http://www.senadopr.us/Pages/Senadores%20Distrito%20V.aspx',
'http://www.senadopr.us/Pages/Senadores%20Distrito%20VI.aspx',
'http://www.senadopr.us/Pages/Senadores%20Distrito%20VII.aspx',
'http://www.senadopr.us/Pages/Senadores%20Distrito%20VIII.aspx')

for counter, url in enumerate(urls):
urls = {
'At-Large': 'http://www.senadopr.us/senadores/Pages/Senadores%20Acumulacion.aspx',
'I': 'http://www.senadopr.us/Pages/Senadores%20Distrito%20I.aspx',
'II': 'http://www.senadopr.us/Pages/Senadores%20Distrito%20II.aspx',
'III': 'http://www.senadopr.us/Pages/Senadores%20Distrito%20III.aspx',
'IV': 'http://www.senadopr.us/Pages/Senadores%20Distrito%20IV.aspx',
'V': 'http://www.senadopr.us/Pages/Senadores%20Distrito%20V.aspx',
'VI': 'http://www.senadopr.us/Pages/Senadores%20Distrito%20VI.aspx',
'VII': 'http://www.senadopr.us/Pages/Senadores%20Distrito%20VII.aspx',
'VIII': 'http://www.senadopr.us/Pages/Senadores%20Distrito%20VIII.aspx'
}

for district, url in urls.iteritems():
leg_page_html = self.urlopen(url)
doc = lxml.html.fromstring(leg_page_html)
doc.make_links_absolute(url)
Expand All @@ -45,11 +46,6 @@ def scrape_senate(self, term):
party = tds[1].text_content()
phone = tds[2].text_content()
email = tds[3].text_content()
#shapefiles denote 0 as At-Large Districts
if counter == 0:
district = 'At-Large'
else:
district = str(counter)

#Code to guess the picture
namefixed = unicode(name.replace(".",". ")) #Those middle names abbreviations are sometimes weird.
Expand Down
11 changes: 5 additions & 6 deletions scripts/purge_old_committee_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def main():
found = True
msg = 'Removing participant %r from event %r'
logger.info(msg % (participant[id_key], event['_id']))
event['participants'].remove(participant)

# Leave the participant in but set their id to none.
# Text will still be displayed without a hyperlink.
Expand All @@ -42,7 +41,7 @@ def main():
if found:
msg = 'Removed %d old committee %r ids from %r'
logger.info(msg % (count, old_ids, event['_id']))
db.events.save(event)
db.events.save(event, safe=True)

# Related committees in bill actions.
spec = {
Expand All @@ -69,7 +68,7 @@ def main():
if found:
msg = 'Removed %d old committee %r ids from %r'
logger.info(msg % (count, old_ids, bill['_id']))
db.bills.save(bill)
db.bills.save(bill, safe=True)

# Legislator old roles.
spec = {
Expand All @@ -94,7 +93,7 @@ def main():
if found:
msg = 'Removed %d old committee %r ids from %r'
logger.info(msg % (count, old_ids, leg['_id']))
db.legislators.save(leg)
db.legislators.save(leg, safe=True)

# Related entities in feeds.
spec = {
Expand All @@ -121,7 +120,7 @@ def main():
if found:
msg = 'Removed %d old committee ids %r from %r'
logger.info(msg % (count, old_ids, entry['_id']))
feeds_db.entries.save(entry)
feeds_db.entries.save(entry, safe=True)

# Nuke any committee sponsors of bills.
spec = {
Expand All @@ -147,4 +146,4 @@ def main():
db.bills.save(bill)

if __name__ == '__main__':
main()
main()
67 changes: 59 additions & 8 deletions site/media/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,34 @@ ul li { margin-bottom: 20px; }
.firstHalfModule { margin-right: 20px; float: left;}
img.firstHalfModule { width: 100px;}

#legLinks { margin-top: 25px; margin-bottom: 0; }
#legLinks, #billLinks {
margin-top: 0px;
margin-bottom: 45px;
padding-left:20px;
border-bottom: 1px solid #E2E2DD;
padding-bottom:10px;
}

#billLinks {
margin-right: 480px;
margin-left:130px;
}
#legLinks {
margin-right: 380px;
margin-left:20px;
}

#legLinks li, #billLinks li {
font-family: "museo-slab-1","museo-slab-2","Georgia","Times New Roman","Times",serif;
font-weight: 300;
font-style: normal;
color: #E2E2DD;
}

#legLinks li a, #billLinks li a{
padding-right: 10px;
}


.module header { margin-bottom: 15px; }
.withBorderLine { float: left; margin-right: 10px; padding-right: 10px; border-right: 1px solid #cecac1; }
Expand Down Expand Up @@ -1001,7 +1028,7 @@ pre {
font-height: 10px;

}
.event>h3{
.titlebox{
background: #f4f4f0; /* Old browsers */
background: -moz-linear-gradient(top, #f4f4f0 0%, #eae8e2 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f4f4f0), color-stop(100%,#eae8e2)); /* Chrome,Safari4+ */
Expand All @@ -1015,9 +1042,12 @@ pre {
font-family: "Helvetica Neue", Helvetica, Arial, sans-se;
font-size: 100%;
font-weight: bold;
margin-bottom: 10px;
}
.event>h3 a {
font-weight: normal;
.event h5 {
font-weight: bold;
font-family: "museo-slab-2", "museo-slab-1", georgia, times, serif;
margin-bottom: 10px;
}
.event dl{
margin-left: 20px;
Expand Down Expand Up @@ -1355,7 +1385,7 @@ div.notification-preference {
}

.favbutton:hover{
color:#00FF00;
color:#C69600;
}

.star{
Expand Down Expand Up @@ -1432,22 +1462,43 @@ li.greyArrow:before {content:"»"}
color: #DFDFD1;
margin-right: 10px;
}
.legvote_yes {
color: #A3B669;
}

.legvote_no {
color: #BB522E;
}

.legvote_other, .legvote_no, .legvote_yes {
font-size: 19px;
font-weight: normal;
font-style:normal;
font-family:sans-serif;

}



/* Document type "icons" */
.html {
color: #817C78;
.mimetype {
color: #A4A09D;
font-size: 12px;
font-family: "museo-slab-1","museo-slab-2","Georgia","Times New Roman","Times",serif;
font-style: normal;
font-weight: 500;
background-color: #DCD7D2;
background-color: #E9E7DB;
padding: 2px 5px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
display: inline;
white-space: nowrap;
vertical-align:baseline;
}
.mimetype.html { background-color: #EDF1E1; }
.mimetype.doc { background-color: #E0E4EE; }
.mimetype.pdf { background-color: #F0EBEA; }

#maptip {
height:420px;
Expand Down
9 changes: 6 additions & 3 deletions site/templates/billy/web/public/_event.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
{% load humanize %}
{% load i18n %}
{% load customtags %}
<h3 class="">
<div class="titlebox">
<h5>
<a href="{{event.get_absolute_url}}">{{ event.description|trunc }}</a>
<a href="{% url 'event_ical' abbr event.id %}">Add to iCal</a> |
</h5>
<a href="{% url 'event_ical' abbr event.id %}">Add to iCal</a> |
<a href="https://www.google.com/calendar/render?{{event.gcal_string}}">Add to Google Calendar</a>
</h3>
</div>

<dl>
{% if event.host %}
<dt>Host:</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<time class="published clear" datetime="{{vote.date|date:"Y-m-d"}}">{{vote.date|date:"M j, Y"}}</time>
<a href="{{ vote.get_absolute_url }}" class="h4 withTip">{{vote.bill.bill_id|upper}}</a>
<p class="h5">{{vote.motion|truncatewords:30}}</p>
<p>{% trans "Legislator Vote" %}: <span class="bold legvote_{{vote_value}}">{{vote_value|title}}</span></p>
<p class=tip>{% trans "Legislator Vote" %}: <span class="legvote_{{vote_value}}">{{vote_value|title}}</span></p>

{% include "billy/web/public/_vote_chart_table.html" %}
</div>
Expand Down
10 changes: 10 additions & 0 deletions site/templates/billy/web/public/_mimetype_tag.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% if mimetype %}
{% if mimetype == "application/pdf" %} <span class="mimetype pdf">PDF
{% elif mimetype == "text/html" %} <span class="mimetype html">HTML
{% elif mimetype == "application/msword" %} <span class="mimetype doc">DOC
{% elif mimetype == "application/vnd.wordperfect" %} <span class="mimetype wpd">WPD
{% elif mimetype == "application/rtf" %} <span class="mimetype rtf">RTF
{% else %} <span class="mimetype other">{{version.mimetype}}
{% endif %}
</span>
{% endif %}
20 changes: 15 additions & 5 deletions site/templates/billy/web/public/bill.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@


{% block content %}
<div class="fullWidth tip clearfix">
<ul class="inlineList tip noSpace" id="billLinks">
<li><a href="#votes">{% trans "Votes" %}</a> |</li>
<li><a href="#actions">{% trans "Actions" %}</a> |</li>
<li><a href="#billtext">{% trans "Bill Text" %}</a> |</li>
<li><a href="#events">{% trans "Events" %}</a></li>
</ul>
</div>
<ul class="breadcrumb floatedList clearfix">
<li><a href="{{metadata.get_absolute_url}}">{{metadata.name}}</a></li>
<li>
Expand Down Expand Up @@ -196,7 +204,7 @@ <h5>{{ bill.title|capfirst|smallcaps }}</h5>
</dl>
</div>

<div class="module clearfix">
<div id="votes" class="module clearfix">
<h3 class="moduleTitle">{% trans "Votes" %}</h3>

{% if bill.votes_manager.count %}
Expand All @@ -222,7 +230,7 @@ <h6><a href="{{ vote.get_absolute_url }}">({{vote.chamber_name}}) {{vote.motion|
{% endif %}
</div>

<div class="module fullWidth">
<div id="actions" class="module fullWidth">
<h3 class="moduleTitle">{% trans "Actions" %}</h3>

<div class="fullWidth clearfix">
Expand Down Expand Up @@ -263,15 +271,17 @@ <h3 class="moduleTitle">{% trans "Actions" %}</h3>


{% if bill.versions or bill.documents %}
<div class="module">
<div id="billtext" class="module">
<div class="eightCol colLt">
{% if bill.versions %}
<h3 class="moduleTitle">{% trans "Bill Text" %}</h3>
<ul class="inlineThirds">
{% for version in bill.versions_preview %}
<li class="{% cycle 'one' 'two' 'three' %}">
<a href="{% url 'document' bill.state bill.session bill.bill_id version.doc_id %}">{{ version.name }}</a>
{% if version.mimetype %}<span class="html">[{{ version.mimetype}}]</span>{% endif %}
{% with mimetype=version.mimetype %}
{% include "billy/web/public/_mimetype_tag.html" %}
{% endwith %}
</li>
{% endfor %}

Expand Down Expand Up @@ -311,7 +321,7 @@ <h4>{% trans "Documents" %}</h4>


{% if events|length > 0 %}
<div class="fullWidth module">
<div id="events" class="fullWidth module">
<h3 class="moduleTitle">{% trans "Events" %}</h3>
<table>
<thead>
Expand Down
2 changes: 1 addition & 1 deletion site/templates/billy/web/public/find_your_legislator.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
strokeOpacity: 1,
strokeWeight: 3,
fillColor: lay['fill'],
fillOpacity: 0.3
fillOpacity: 0.5
});
overlays.push(polygon);
}
Expand Down
Loading

0 comments on commit d4ae6aa

Please sign in to comment.