Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest Updates landing page #478

Merged
merged 36 commits into from
Sep 10, 2016
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6925bc7
latest updates page
xtine Sep 4, 2016
5b73a61
Capitalization
emileighoutlaw Sep 6, 2016
3de4514
Adding prop to get an update type string
Sep 6, 2016
b539b69
Updating update view and template
Sep 6, 2016
f6c264c
Adding filter to display update type
Sep 7, 2016
f5c84ed
Fixing slugs & moving post to partial
Sep 7, 2016
4b4f3b0
Creating press landing page
Sep 7, 2016
2baa685
Adding template for disclaimer
Sep 7, 2016
2bd18cf
Adding inclusion tag for press feed
Sep 7, 2016
b6760d4
Sorting combined queryset reverse chronologically
Sep 7, 2016
c27d65b
Updating various variable names and fitlering mechanisms
Sep 7, 2016
0171c7f
Adding form nav js component
Sep 7, 2016
e2d3063
Creating breadcrumb partial
Sep 7, 2016
7bf7ede
Updating category param names
Sep 7, 2016
80ee661
Adding migration
Sep 7, 2016
b5a12af
Linking from breadcrumbs
Sep 7, 2016
9fdd6f9
Updating feed filtering
Sep 7, 2016
7f8ffaf
Support for multiple categories
Sep 8, 2016
e2a760b
Updating "from" field
Sep 8, 2016
4e03bcd
Adding disabled select
Sep 8, 2016
6a6ef95
capitalization
emileighoutlaw Sep 8, 2016
2cb3531
Capitalization
emileighoutlaw Sep 8, 2016
dbaa3d4
Updates capitalization
emileighoutlaw Sep 8, 2016
4700551
Capitalization
emileighoutlaw Sep 8, 2016
19408d4
Pinning fec-style
Sep 8, 2016
6aa0850
Adds content and fixes capitalization
emileighoutlaw Sep 8, 2016
4019159
adding colon back in
emileighoutlaw Sep 8, 2016
abda38f
Typo
emileighoutlaw Sep 8, 2016
6217b25
New select for publication type
Sep 8, 2016
468116f
Adding press hero class
Sep 8, 2016
274fd9c
Adding new content
Sep 8, 2016
b6a4570
Using constants
Sep 9, 2016
4131a4d
Using .get
Sep 9, 2016
c2bc993
Merge branch 'develop' of github.com:18F/fec-cms into feature/latest_…
Sep 9, 2016
621cb1a
New migration and fixing pluralization
Sep 9, 2016
b329576
Pinning to 5.0.0
Sep 9, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions fec/fec/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,9 @@
"Rulemakings",
"Other agency actions",
])

update_types = OrderedDict([
("press-release", "Press releases"),
("fec-record", "FEC Record"),
("weekly-digest", "Weekly Digest")
])
6 changes: 6 additions & 0 deletions fec/fec/static/js/fec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ window.$ = window.jQuery = $;
var Sticky = require('component-sticky');
var calendar = require('./calendar');
var calendarHelpers = require('./calendar-helpers');
var FormNav = require('./form-nav').FormNav;

var legal = require('./legal');

Expand Down Expand Up @@ -91,6 +92,11 @@ $(document).ready(function() {
// Initialize filters
var filterPanel = new FilterPanel();

if (document.querySelector('.js-form-nav')) {
var formNav = document.querySelector('.js-form-nav');
new FormNav(formNav);
}

// Initialize calendar
new calendar.Calendar({
selector: '#calendar',
Expand Down
25 changes: 25 additions & 0 deletions fec/fec/static/js/form-nav.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

/* FormNav
* Submits the form on select change and clears out unnecessary params
*/

function FormNav(form) {
this.form = form;
this.form.addEventListener('change', this.handleChange.bind(this));
}

FormNav.prototype.handleChange = function() {
var allSelects = this.form.querySelectorAll('select,input');
// Remove names from all selects with no values
for(var i = 0; i < allSelects.length; i++) {
var select = allSelects[i];
if(select.getAttribute('name') && !select.value) {
select.setAttribute('name', '');
}
}

this.form.submit();
};

module.exports = {FormNav: FormNav};
15 changes: 15 additions & 0 deletions fec/fec/templates/partials/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<header class="page-header page-header--{{ style }}">
<ul class="breadcrumbs">
<li class="breadcrumbs__item"><a href="/" class="breadcrumbs__link" rel="Home">Home</a></li>
{% for link in links %}
<li class="breadcrumbs__item breadcrumbs__item--current">
<span class="breadcrumbs__separator">›</span>
<span>Latest updates</span>
</li>
{% endfor %}
<li class="breadcrumbs__item breadcrumbs__item--current">
<span class="breadcrumbs__separator">›</span>
<span>{{ page.title }}</span>
</li>
</ul>
</header>
6 changes: 6 additions & 0 deletions fec/fec/templates/partials/disclaimer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="slab slab--neutral footer-disclaimer">
<div class="container">
<p class="usa-width-one-half">This site is in beta, which means we're testing content that better adheres to legal plain language requirements. This content is not finalized, is not legal advice and is subject to change.</p>
<p class="usa-width-one-half">Everything on this site should be read in conjunction with FEC.gov. Please let us know what you think of our new content; use the feedback tool on this page.</p>
</div>
</div>
18 changes: 18 additions & 0 deletions fec/fec/templates/partials/update.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% load wagtailimages_tags %}

<article class="post">
<div class="post__pre">
<span class="u-float-left">{{ update.date|date:'F j, Y' }}</span>
<span class="u-float-right">From: {% if update.get_update_type == 'FEC Record' %}Information Division{% else %}Press Office{% endif %}</span>
</div>
<h3><a href="{{ update.url }}">{{ update.title }}</a></h3>
{% if update.get_update_type != 'Weekly Digest' %}
{{ update.body | truncatewords_html:30 }}
{% endif %}
<div class="post__meta">
<a class="tag tag--secondary" href="/updates?update_type={{update.get_update_type|slugify}}">{{update.get_update_type}}</a>
{% if update.category %}
in: <a href="/updates?update_type={{update.get_update_type|slugify}}&category={{update.category|slugify}}">{{ update.category }}</a>
{% endif %}
</div>
</article>
3 changes: 3 additions & 0 deletions fec/fec/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from wagtail.wagtaildocs import urls as wagtaildocs_urls
from wagtail.wagtailcore import urls as wagtail_urls

from home import views as home_views
from legal import views as legal_views
from search import views as search_views

Expand All @@ -17,6 +18,8 @@
url(r'^admin/', include(wagtailadmin_urls)),
url(r'^documents/', include(wagtaildocs_urls)),

url(r'^updates/$', home_views.updates),

url(r'^search/$', search_views.search, name='search'),
url(r'^legal-resources/$', legal_views.home, name='legal'),

Expand Down
85 changes: 85 additions & 0 deletions fec/home/migrations/0019_auto_20160907_2152.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-07 21:52
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import wagtail.contrib.table_block.blocks
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailimages.blocks


class Migration(migrations.Migration):

dependencies = [
('wagtailcore', '0028_merge'),
('home', '0018_record_digest_press_release'),
]

operations = [
migrations.CreateModel(
name='PressLandingPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('hero', wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('html', wagtail.wagtailcore.blocks.RawHTMLBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('table', wagtail.contrib.table_block.blocks.TableBlock())), blank=True, null=True)),
('option_blocks', wagtail.wagtailcore.fields.StreamField((('option_blocks', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('intro', wagtail.wagtailcore.blocks.RichTextBlock(blank=False, null=False, required=False)), ('button_text', wagtail.wagtailcore.blocks.CharBlock(blank=False, null=False, required=True)), ('related_page', wagtail.wagtailcore.blocks.PageChooserBlock())))),))),
('feed_intro', wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('html', wagtail.wagtailcore.blocks.RawHTMLBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('table', wagtail.contrib.table_block.blocks.TableBlock())), blank=True, null=True)),
('contact_intro', wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('html', wagtail.wagtailcore.blocks.RawHTMLBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('table', wagtail.contrib.table_block.blocks.TableBlock())), blank=True, null=True)),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.AlterField(
model_name='digestpage',
name='body',
field=wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('html', wagtail.wagtailcore.blocks.RawHTMLBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('table', wagtail.contrib.table_block.blocks.TableBlock())), blank=True, null=True),
),
migrations.AlterField(
model_name='digestpageauthors',
name='role',
field=models.CharField(choices=[('author', 'Author'), ('writer', 'Written by'), ('graphics', 'Graphics by'), ('contact', 'Contact')], default='author', max_length=255),
),
migrations.AlterField(
model_name='pressreleasepage',
name='body',
field=wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('html', wagtail.wagtailcore.blocks.RawHTMLBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('table', wagtail.contrib.table_block.blocks.TableBlock())), blank=True, null=True),
),
migrations.AlterField(
model_name='pressreleasepage',
name='category',
field=models.CharField(choices=[('audit reports', 'Audit reports'), ('campaign finance data summaries', 'Campaign finance data summaries'), ('commission appointments', 'Commission appointments'), ('disclosure initiatives', 'Disclosure initiatives'), ('enforcement matters', 'Enforcement matters'), ('hearings', 'Hearings'), ('litigation', 'Litigation'), ('non-filer publications', 'Non-filer publications'), ('open meetings and related matters', 'Open meetings and related matters'), ('presidential public funds', 'Presidential public funds'), ('rulemakings', 'Rulemakings'), ('other agency actions', 'Other agency actions')], max_length=255),
),
migrations.AlterField(
model_name='pressreleasepageauthors',
name='role',
field=models.CharField(choices=[('author', 'Author'), ('writer', 'Written by'), ('graphics', 'Graphics by'), ('contact', 'Contact')], default='author', max_length=255),
),
migrations.AlterField(
model_name='recordpage',
name='body',
field=wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('html', wagtail.wagtailcore.blocks.RawHTMLBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('table', wagtail.contrib.table_block.blocks.TableBlock())), blank=True, null=True),
),
migrations.AlterField(
model_name='recordpage',
name='category',
field=models.CharField(choices=[('advisory opinions', 'Advisory opinions'), ('commission', 'Commission'), ('compliance', 'Compliance'), ('litigation', 'Litigation'), ('outreach', 'Outreach'), ('public funding', 'Public funding'), ('regulations', 'Regulations'), ('reporting', 'Reporting'), ('statistics', 'Statistics')], max_length=255),
),
migrations.AlterField(
model_name='recordpage',
name='related_section_title',
field=models.CharField(blank=True, default='Explore campaign finance data', max_length=255),
),
migrations.AlterField(
model_name='recordpage',
name='related_section_url',
field=models.CharField(blank=True, default='/data/', max_length=255),
),
migrations.AlterField(
model_name='recordpageauthors',
name='role',
field=models.CharField(choices=[('author', 'Author'), ('writer', 'Written by'), ('graphics', 'Graphics by'), ('contact', 'Contact')], default='author', max_length=255),
),
]
37 changes: 35 additions & 2 deletions fec/home/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

from fec import constants


stream_factory = functools.partial(
StreamField,
[
Expand Down Expand Up @@ -142,7 +141,6 @@ class Meta:
class RecordPageAuthors(Orderable, PageAuthors):
page = ParentalKey('RecordPage', related_name='authors')


def get_previous_record_page():
return RecordPage.objects.order_by('-date', '-pk').first()

Expand Down Expand Up @@ -172,6 +170,10 @@ class RecordPage(ContentPage):
def content_section(self):
return ''

@property
def get_update_type(self):
return 'FEC Record'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be referring to the update_types OrderedDict defined above instead?



class DigestPageAuthors(Orderable, PageAuthors):
page = ParentalKey('DigestPage', related_name='authors')
Expand All @@ -197,6 +199,10 @@ class DigestPage(ContentPage):
def content_section(self):
return ''

@property
def get_update_type(self):
return 'Weekly Digest'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here.



class PressReleasePageAuthors(Orderable, PageAuthors):
page = ParentalKey('PressReleasePage', related_name='authors')
Expand Down Expand Up @@ -225,6 +231,10 @@ class PressReleasePage(ContentPage):
def content_section(self):
return ''

@property
def get_update_type(self):
return 'Press release'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Fixed!



class CustomPage(Page):
"""Flexible customizable page."""
Expand All @@ -239,3 +249,26 @@ class CustomPage(Page):
StreamFieldPanel('body'),
StreamFieldPanel('sidebar'),
]

class OptionBlock(blocks.StructBlock):
title = blocks.CharBlock(required=True)
intro = blocks.RichTextBlock(blank=False, null=False, required=False)
button_text = blocks.CharBlock(required=True, null=False, blank=False)
related_page = blocks.PageChooserBlock()

class PressLandingPage(Page):
hero = stream_factory(null=True, blank=True)
option_blocks = StreamField([
('option_blocks', OptionBlock())
])

feed_intro = stream_factory(null=True, blank=True)
contact_intro = stream_factory(null=True, blank=True)

content_panels = Page.content_panels + [
StreamFieldPanel('hero'),
StreamFieldPanel('feed_intro'),
StreamFieldPanel('contact_intro'),
StreamFieldPanel('option_blocks'),
]

7 changes: 1 addition & 6 deletions fec/home/templates/home/checklist_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,6 @@ <h2>Need help?</h2>
</div>
</div>

<div class="slab slab--neutral footer-disclaimer">
<div class="container">
<p class="usa-width-one-half">This site is in beta, which means we're testing content that better adheres to legal plain language requirements. This content is not finalized, is not legal advice and is subject to change.</p>
<p class="usa-width-one-half">Everything on this site should be read in conjunction with FEC.gov. Please let us know what you think of our new content; use the feedback tool on this page.</p>
</div>
</div>
{% include 'partials/disclaimer.html' %}

{% endblock %}
8 changes: 2 additions & 6 deletions fec/home/templates/home/custom_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ <h4 class="sidebar__title">{{ block }}</h4>
</div>
</article>

<div class="slab slab--neutral footer-disclaimer">
<div class="container">
<p class="usa-width-one-half">This site is in beta, which means we're testing content that better adheres to legal plain language requirements. This content is not finalized, is not legal advice and is subject to change.</p>
<p class="usa-width-one-half">Everything on this site should be read in conjunction with FEC.gov. Please let us know what you think of our new content; use the feedback tool on this page.</p>
</div>
</div>
{% include 'partials/disclaimer.html' %}

{% endblock %}
5 changes: 2 additions & 3 deletions fec/home/templates/home/digest_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<li class="breadcrumbs__item"><a href="/" class="breadcrumbs__link" rel="Home">Home</a></li>
<li class="breadcrumbs__item">
<span class="breadcrumbs__separator">›</span>
Weekly Digests
<a href="/updates?update_type=weekly-digest">Weekly Digest</a>
</li>
<li class="breadcrumbs__item breadcrumbs__item--current">
<span class="breadcrumbs__separator">›</span>
Expand All @@ -22,7 +22,6 @@
<article class="main">
<div class="container">
<div class="main__content--full">

<div class="section__heading">
<ul class="tags" aria-hidden="false">
<li class="tag t-upper">
Expand Down Expand Up @@ -63,7 +62,7 @@ <h3>Read next:</h3>
{% if self.read_next %}
<h4><a href="{{ self.read_next.url }}">{{ self.read_next.title }}</a></h4>
{% endif %}
<h4><a href="#" class="is-disabled">More weekly digests</a> &raquo;</h4>
<h4><a href="#" class="is-disabled">More Weekly Digests</a> &raquo;</h4>
</div>
</div>
</div>
Expand Down
8 changes: 2 additions & 6 deletions fec/home/templates/home/landing_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,8 @@ <h2>Need help?</h2>
</div>
</div>
</div>
<div class="slab slab--neutral footer-disclaimer">
<div class="container">
<p class="usa-width-one-half">This site is in beta, which means we're testing content that better adheres to legal plain language requirements. This content is not finalized, is not legal advice and is subject to change.</p>
<p class="usa-width-one-half">Everything on this site should be read in conjunction with FEC.gov. Please let us know what you think of our new content; use the feedback tool on this page.</p>
</div>
</div>
{% include 'partials/disclaimer.html' %}

</article>

{% endblock %}
Loading