Skip to content

Commit

Permalink
Merge pull request #758 from freedomofpress/713-video-teaser
Browse files Browse the repository at this point in the history
Add video at top of incident
  • Loading branch information
chigby authored Aug 5, 2019
2 parents c8dc6e9 + 21491e2 commit ff6d326
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 7 deletions.
10 changes: 10 additions & 0 deletions client/common/sass/_incident-video.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.incident-video
position: relative
padding-bottom: 56.25%
padding-top: 25px
height: 0

iframe
position: absolute
width: 100%
height: 95%
1 change: 1 addition & 0 deletions client/common/sass/common.sass
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
@import hamburger
@import header
@import incident
@import incident-video
@import incidents-sidebar
@import info-footer
@import category-list
Expand Down
23 changes: 23 additions & 0 deletions common/migrations/0058_auto_20190730_1936.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.1.10 on 2019-07-30 19:36

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('common', '0057_auto_20190723_0332'),
]

operations = [
migrations.AlterField(
model_name='categoryincidentfilter',
name='incident_filter',
field=models.CharField(choices=[('actor', 'Actor'), ('affiliation', 'Affiliation'), ('arrest_status', 'Arrest status'), ('assailant', 'Assailant'), ('border_point', 'Border point'), ('charged_under_espionage_act', 'Charged under espionage act?'), ('charges', 'Charges'), ('circuits', 'Circuits'), ('city', 'City'), ('current_charges', 'Current Charges'), ('denial_of_entry', 'Denied entry?'), ('detention_date', 'Detention date between'), ('detention_status', 'Detention status'), ('did_authorities_ask_for_device_access', 'Did authorities ask for device access?'), ('did_authorities_ask_for_social_media_pass', 'Did authorities ask for social media password?'), ('did_authorities_ask_for_social_media_user', 'Did authorities ask for social media username?'), ('did_authorities_ask_about_work', "Did authorities ask intrusive questions about journalist's work?"), ('dropped_charges', 'Dropped Charges'), ('equipment_broken', 'Equipment Broken'), ('equipment_seized', 'Equipment Seized'), ('tags', 'Has any of these tags'), ('held_in_contempt', 'If subject refused to cooperate, were they held in contempt?'), ('authors', 'Incident author'), ('links', 'Incident page links'), ('targets_whose_communications_were_obtained', 'Journalists/Organizations whose communications were obtained in leak investigation'), ('lawsuit_name', 'Lawsuit name'), ('legal_order_type', 'Legal order type'), ('politicians_or_public_figures_involved', 'Politicians or public officials involved'), ('primary_video', 'Primary video'), ('release_date', 'Release date between'), ('is_search_warrant_obtained', 'Search warrant obtained?'), ('pending_cases', 'Show only pending cases'), ('state', 'State'), ('status_of_charges', 'Status of charges'), ('status_of_prior_restraint', 'Status of prior restraint'), ('status_of_seized_equipment', 'Status of seized equipment'), ('stopped_at_border', 'Stopped at border?'), ('stopped_previously', 'Stopped previously?'), ('subpoena_status', 'Subpoena status'), ('subpoena_type', 'Subpoena type'), ('target_nationality', 'Target Nationality'), ('targets', 'Targeted any of these journalists'), ('third_party_business', 'Third party business'), ('third_party_in_possession_of_communications', 'Third party in possession of communications'), ('date', 'Took place between'), ('target_us_citizenship_status', 'US Citizenship Status'), ('unnecessary_use_of_force', 'Unnecessary use of force?'), ('venue', 'Venue'), ('was_journalist_targeted', 'Was journalist targeted?'), ('were_devices_searched_or_seized', 'Were devices searched or seized?')], max_length=255, unique=True),
),
migrations.AlterField(
model_name='generalincidentfilter',
name='incident_filter',
field=models.CharField(choices=[('actor', 'Actor'), ('affiliation', 'Affiliation'), ('arrest_status', 'Arrest status'), ('assailant', 'Assailant'), ('border_point', 'Border point'), ('charged_under_espionage_act', 'Charged under espionage act?'), ('charges', 'Charges'), ('circuits', 'Circuits'), ('city', 'City'), ('current_charges', 'Current Charges'), ('denial_of_entry', 'Denied entry?'), ('detention_date', 'Detention date between'), ('detention_status', 'Detention status'), ('did_authorities_ask_for_device_access', 'Did authorities ask for device access?'), ('did_authorities_ask_for_social_media_pass', 'Did authorities ask for social media password?'), ('did_authorities_ask_for_social_media_user', 'Did authorities ask for social media username?'), ('did_authorities_ask_about_work', "Did authorities ask intrusive questions about journalist's work?"), ('dropped_charges', 'Dropped Charges'), ('equipment_broken', 'Equipment Broken'), ('equipment_seized', 'Equipment Seized'), ('tags', 'Has any of these tags'), ('held_in_contempt', 'If subject refused to cooperate, were they held in contempt?'), ('authors', 'Incident author'), ('links', 'Incident page links'), ('targets_whose_communications_were_obtained', 'Journalists/Organizations whose communications were obtained in leak investigation'), ('lawsuit_name', 'Lawsuit name'), ('legal_order_type', 'Legal order type'), ('politicians_or_public_figures_involved', 'Politicians or public officials involved'), ('primary_video', 'Primary video'), ('release_date', 'Release date between'), ('is_search_warrant_obtained', 'Search warrant obtained?'), ('pending_cases', 'Show only pending cases'), ('state', 'State'), ('status_of_charges', 'Status of charges'), ('status_of_prior_restraint', 'Status of prior restraint'), ('status_of_seized_equipment', 'Status of seized equipment'), ('stopped_at_border', 'Stopped at border?'), ('stopped_previously', 'Stopped previously?'), ('subpoena_status', 'Subpoena status'), ('subpoena_type', 'Subpoena type'), ('target_nationality', 'Target Nationality'), ('targets', 'Targeted any of these journalists'), ('third_party_business', 'Third party business'), ('third_party_in_possession_of_communications', 'Third party in possession of communications'), ('date', 'Took place between'), ('target_us_citizenship_status', 'US Citizenship Status'), ('unnecessary_use_of_force', 'Unnecessary use of force?'), ('venue', 'Venue'), ('was_journalist_targeted', 'Was journalist targeted?'), ('were_devices_searched_or_seized', 'Were devices searched or seized?')], max_length=255, unique=True),
),
]
18 changes: 18 additions & 0 deletions incident/migrations/0035_incidentpage_primary_video.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.1.10 on 2019-07-30 19:36

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('incident', '0034_incidentauthor'),
]

operations = [
migrations.AddField(
model_name='incidentpage',
name='primary_video',
field=models.URLField(blank=True, help_text='YouTube or Vimeo URL', null=True),
),
]
8 changes: 8 additions & 0 deletions incident/models/incident_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ class IncidentPage(MetadataPageMixin, Page):
related_name='+',
)

primary_video = models.URLField(
blank=True,
null=True,
help_text='YouTube or Vimeo URL'
)

image_caption = RichTextField(
max_length=255,
blank=True,
Expand Down Expand Up @@ -371,6 +377,8 @@ class IncidentPage(MetadataPageMixin, Page):
"incident. Displayed as footnotes."
),

FieldPanel('primary_video'),

MultiFieldPanel(
heading='Teaser',
children=[
Expand Down
14 changes: 8 additions & 6 deletions incident/templates/incident/_incident.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
incident--full
{% endif %}
">
{% if incident.teaser_image %}
{% if teaser %}
{% include "common/_teaser_image.html" with page=incident %}
{% else %}
{% include "common/_top_image.html" with page=incident %}
{% endif %}

{% if teaser and incident.teaser_image %}
{% include "common/_teaser_image.html" with page=incident %}
{% elif incident.primary_video %}
{% include "incident/_incident_video.html" with page=incident %}
{% elif incident.teaser_image %}
{% include "common/_teaser_image.html" with page=incident %}
{% endif %}

<div class="incident__body">
<ul class="category-list">
{% for category in incident.categories.all %}
Expand Down
5 changes: 5 additions & 0 deletions incident/templates/incident/_incident_video.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% load wagtailembeds_tags %}

<div class="incident-video">
{% embed incident.primary_video %}
</div>
2 changes: 1 addition & 1 deletion incident/tests/test_incidents_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ def test_GET(self):

# Since we have no incidents in the db right now, this should just be
# a CSV header row
self.assertEqual(content, b'title,slug,first_published_at,last_published_at,latest_revision_created_at,authors,updates,categories,links,equipment_seized,equipment_broken,date,exact_date_unknown,affiliation,city,state,body,teaser,teaser_image,image_caption,arrest_status,status_of_charges,release_date,detention_date,unnecessary_use_of_force,lawsuit_name,status_of_seized_equipment,is_search_warrant_obtained,actor,border_point,stopped_at_border,target_us_citizenship_status,denial_of_entry,stopped_previously,did_authorities_ask_for_device_access,did_authorities_ask_for_social_media_user,did_authorities_ask_for_social_media_pass,did_authorities_ask_about_work,were_devices_searched_or_seized,assailant,was_journalist_targeted,charged_under_espionage_act,subpoena_type,subpoena_status,held_in_contempt,detention_status,third_party_in_possession_of_communications,third_party_business,legal_order_type,status_of_prior_restraint,targets,tags,current_charges,dropped_charges,venue,target_nationality,targets_whose_communications_were_obtained,politicians_or_public_figures_involved\r\n')
self.assertEqual(content, b'title,slug,first_published_at,last_published_at,latest_revision_created_at,authors,updates,categories,links,equipment_seized,equipment_broken,date,exact_date_unknown,affiliation,city,state,body,teaser,teaser_image,primary_video,image_caption,arrest_status,status_of_charges,release_date,detention_date,unnecessary_use_of_force,lawsuit_name,status_of_seized_equipment,is_search_warrant_obtained,actor,border_point,stopped_at_border,target_us_citizenship_status,denial_of_entry,stopped_previously,did_authorities_ask_for_device_access,did_authorities_ask_for_social_media_user,did_authorities_ask_for_social_media_pass,did_authorities_ask_about_work,were_devices_searched_or_seized,assailant,was_journalist_targeted,charged_under_espionage_act,subpoena_type,subpoena_status,held_in_contempt,detention_status,third_party_in_possession_of_communications,third_party_business,legal_order_type,status_of_prior_restraint,targets,tags,current_charges,dropped_charges,venue,target_nationality,targets_whose_communications_were_obtained,politicians_or_public_figures_involved\r\n')

0 comments on commit ff6d326

Please sign in to comment.