Skip to content

Commit

Permalink
Making custom events simpler and more focused.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Palazzolo committed Apr 16, 2014
1 parent 9fd5747 commit b9ae360
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 26 deletions.
8 changes: 3 additions & 5 deletions README.md
Expand Up @@ -122,7 +122,7 @@ First make sure you have 3 sheets with the following columns:
* `category_id`: the identifier that will be used in URL linking. Should be something like `social_issues`.
* `title`: The text title.
* `short_title`: Used for the top menu list. If none is given, the first word from the category title will be used.
* `description`: The full description.
* `description`: The full description. Feel free to use HTML here, but do note that the content will be wrapped in a paragragh tag.
* `links`: Links field, see below.
* `image`: Name of image for the category. By default, these pull from the images directory, which is configurable in the `imagePath` option. Or if you use a full URL, starting with `http` it will use that directly.
* `Bills`
Expand All @@ -133,13 +133,11 @@ First make sure you have 3 sheets with the following columns:
* `title`
* `description`: Descriptions get split up when in the category list view and have a "more details" link. By default, this is based on the number of words. To handle longer texts with HTML, you can use `<!-- break -->` to define that break point. Also note that is no description is given, then the application will use the primary bill summary which may or may not be useful and significant.
* `links`: Links field, see below.
* `Events`: Events are custom events like the stalling of a bill or committee that would otherwise not show up in the data from Open States. This shows up as part of the overall bill information below the description.
* `Events`: Events are custom events like the stalling of a bill or committee that would otherwise not show up in the data from Open States. This shows up as part of the overall editorial bill information below the description.
* `bill`: The primary bill ID.
* `date`: A date in a format like `'YYYY-MM-DD'`
* `chamber`: This should be `upper` or `lower`.
* `title`: A title for the event.
* `description`: A short description for the event.
* `links`: Any links associated with the event.
* `description`: A short description for the event. Feel free to use HTML here for things like links.

#### Link field formatting

Expand Down
11 changes: 6 additions & 5 deletions dist/legislature-tracker.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legislature-tracker.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/legislature-tracker.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/app.js
Expand Up @@ -282,8 +282,8 @@ _.extend(App.prototype, {
},
eEvents: {
'bill_id': 'bill',
'actor': 'chamber',
'action': 'title'
'chamber': 'chamber',
'description': 'description'
}
},
wordTranslations: {
Expand Down
5 changes: 3 additions & 2 deletions js/parsers.js
Expand Up @@ -97,14 +97,15 @@ LT.parsers.eCategories = function(categories, options) {
};

LT.parsers.eEvents = function(events, options) {
return _.map(events, function(row) {
return _.sortBy(_.map(events, function(row) {
LT.parsers.translateFields(options.fieldTranslations.eEvents, row);
row.links = LT.parsers.eLinks(row.links);
row.date = moment(row.date);

// Add some things to fit format of Open States actions
row.type = ['custom'];
return row;
}), function(e, ei) {
return e.date.unix * -1;
});
};

Expand Down
28 changes: 20 additions & 8 deletions js/templates/template-ebill.html
Expand Up @@ -74,6 +74,26 @@ <h2>{{ bill.title }}</h2>
{{/bill.categories}}
</div>

{{#(compact == true && bill.custom_events && bill.custom_events.length && bill.custom_events.length > 0)}}
<div class="custom-events">
<strong>Latest updates:</strong>
{{#bill.custom_events.0}}
{{ date.format('MMM DD, YYYY') }}, {{ bill_id }}, {{{ description }}} ({{ translate('chamber', chamber) }})
{{/bill.custom_events.0}}
</div>
{{/()}}

{{#(compact != true && bill.custom_events && bill.custom_events.length && bill.custom_events.length > 0)}}
<div class="custom-events">
<strong>Latest updates:</strong>
{{#bill.custom_events}}
<div>
{{ date.format('MMM DD, YYYY') }}: {{ bill_id }}, {{{ description }}} ({{ translate('chamber', chamber) }})
</div>
{{/bill.custom_events}}
</div>
{{/()}}

{{#(bill.links && bill.links.length && bill.links.length > 0)}}
<div class="elinks">
<strong>In the news</strong>
Expand Down Expand Up @@ -148,14 +168,6 @@ <h4>


{{#(compact != true)}}
{{#(bill.custom_events && bill.custom_events.length && bill.custom_events.length > 0)}}
<div class="custom-events">
<strong>Events</strong>
{{#bill.custom_events}}
<div>{{ bill_id }} {{ action }} on {{ date.format('MMM DD, YYYY') }}: {{ e.description }}</div>
{{/bill.custom_events}}
</div>
{{/()}}

<div class="osbills clear-block
{{#bill.bill_conference}}has-conference{{/bill.bill_conference}}
Expand Down

0 comments on commit b9ae360

Please sign in to comment.