This repository has been archived by the owner on Feb 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
501 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{% load ads core betty liveblog_tags %} | ||
<div class="liveblog-cover"> | ||
{% cropped content.thumbnail '3x1' 500 %} | ||
</div> | ||
<bulbs-liveblog | ||
firebase-url="{{ FIREBASE_URL }}" | ||
firebase-api-key="{{ FIREBASE_API_KEY }}" | ||
firebase-path="{{ FIREBASE_PUBLIC_ROOT }}/articles/{{ content.id }}/liveblog" | ||
updated-at="{% now 'c' %}" | ||
liveblog-id="{{ content.id }}" | ||
liveblog-url="{% url 'liveblog-new-entries' slug=content.slug pk=content.pk %}" | ||
> | ||
<div>LIVE COVERAGE</div> | ||
|
||
<h1 class="liveblog-title">{{ content.title | safe }}</h1> | ||
|
||
{% if content.pinned_content %} | ||
{% with pinned_content=content.pinned_content %} | ||
<div class="liveblog-pinned-article"> | ||
<a href="{{ content.get_absolute_url }}"> | ||
<div class="liveblog-pinned-image"> | ||
{% cropped pinned_content.thumbnail "1x1" 100 %} | ||
</div> | ||
|
||
<div class="liveblog-pinned-meta"> | ||
<div class="liveblog-pinned-title"> | ||
<i class="fa fa-thumb-tack" aria-hidden="true"></i> | ||
{{ pinned_content.title | safe }} | ||
</div> | ||
|
||
{% if content.subhead %} | ||
<div class="liveblog-pinned-excerpt"> | ||
{{ content.subhead | removetags:"p br" | safe }} | ||
</div> | ||
{% endif %} | ||
|
||
<div class="liveblog-published-date"></div> | ||
</div> | ||
</a> | ||
</div> | ||
{% endwith %} | ||
{% endif %} | ||
|
||
<div class="liveblog-entries"> | ||
{% with entries=content.entries.all %} | ||
{% liveblog_entries_partial %} | ||
{% endwith %} | ||
</div> | ||
|
||
<div class="liveblog-more"> | ||
<button class="liveblog-more-button"> | ||
SHOW MORE | ||
</button> | ||
</div> | ||
</bulbs-liveblog> | ||
|
||
{% liveblog_recirc_partial %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{% load ads betty liveblog_tags %} | ||
{% for entry in entries %} | ||
<div | ||
class=" | ||
liveblog-entry | ||
{% if request.GET.entry == entry.id %} | ||
liveblog-entry-shared | ||
{% endif %} | ||
" | ||
entry-url="{{ entry.get_absolute_url }}" | ||
> | ||
|
||
{% if request.GET.entry == entry.id %} | ||
<button class="liveblog-entry-reset"> | ||
PUT BACK IN ORDER × | ||
</button> | ||
{% endif %} | ||
|
||
<div class="liveblog-entry-header"> | ||
<div class="liveblog-avatar"> | ||
{% cropped entry.authors.all.0.avatar '1x1' 100 %} | ||
</div> | ||
|
||
<div class="liveblog-entry-meta"> | ||
<div class="liveblog-author-name"> | ||
<a href="{{ entry.authors.all.0.get_absolute_url }}"> | ||
{{ entry.authors.all.0.first_name }} {{ entry.authors.all.0.last_name }} | ||
</a> | ||
</div> | ||
<div class="liveblog-published-time">6:27 AM</div> | ||
<div class="liveblog-published-date">JULY 19TH, 2016</div> | ||
</div> | ||
|
||
</div> | ||
|
||
<h1 class="liveblog-entry-headline"> | ||
<a href="{{ entry.get_absolute_url }}"> | ||
{{ entry.headline | safe }} | ||
</a> | ||
</h1> | ||
|
||
<div class="liveblog-entry-body"> | ||
{{ entry.body | safe }} | ||
</div> | ||
|
||
{% for response in entry.responses.all %} | ||
<div class="liveblog-response"> | ||
<div class="liveblog-avatar"> | ||
{% cropped response.author.avatar '1x1' 100 %} | ||
</div> | ||
|
||
<div class="liveblog-response-content"> | ||
<div class="liveblog-author-name"> | ||
<a href="{{ response.author.get_absolute_url }}"> | ||
{{ response.author.first_name }} {{ response.author.last_name }} | ||
</a> | ||
</div> | ||
|
||
<div class="liveblog-response-body"> | ||
{{ response.body | safe }} | ||
</div> | ||
</div> | ||
</div> | ||
{% endfor %} | ||
|
||
|
||
{% if entry.recirc_content.all %} | ||
<div class="liveblog-related-header"> | ||
RELATED | ||
</div> | ||
|
||
{% for recirc_item in entry.recirc_content.all %} | ||
<div class="liveblog-related-article"> | ||
<a href="{{ recirc_item.get_absolute_url }}"> | ||
<div class="liveblog-related-image"> | ||
{% cropped recirc_item.thumbnail "1x1" 100 %} | ||
</div> | ||
|
||
<div class="liveblog-related-meta"> | ||
<div class="liveblog-related-title"> | ||
{{ recirc_item.title | safe }} | ||
</div> | ||
|
||
{% if content.subhead %} | ||
<div class="liveblog-related-excerpt"> | ||
{{ content.subhead | removetags:"p br" | safe }} | ||
</div> | ||
{% endif %} | ||
|
||
<div class="liveblog-published-date"></div> | ||
</div> | ||
</a> | ||
</div> | ||
{% endfor %} | ||
{% endif %} | ||
|
||
{% liveblog_entry_sharetools_partial %} | ||
|
||
</div> | ||
{% endfor %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<span> | ||
Place an entry sharetools partial at: <code>templates/liveblog/entry_sharetools_override.html</code> | ||
</span> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{% load liveblog_tags %} | ||
{% liveblog_entries_partial %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<span> | ||
Place a recirc partial at: <code>templates/liveblog/recirc_override.html</code> | ||
</span> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from django import template | ||
from bulbs.utils.methods import get_overridable_template_name | ||
|
||
register = template.Library() | ||
|
||
# Liveblog Template | ||
liveblog_template_name = get_overridable_template_name( | ||
'liveblog/bulbs_liveblog.html', | ||
'liveblog/liveblog_override.html') | ||
|
||
|
||
@register.inclusion_tag(liveblog_template_name, takes_context=True) | ||
def liveblog_partial(context): | ||
return context | ||
|
||
# Entries Template | ||
entries_template_name = get_overridable_template_name( | ||
'liveblog/entries.html', | ||
'liveblog/entries_override.html', | ||
must_inherit=False) | ||
|
||
|
||
@register.inclusion_tag(entries_template_name, takes_context=True) | ||
def liveblog_entries_partial(context): | ||
return context | ||
|
||
# Recirc Template | ||
recirc_template_name = get_overridable_template_name( | ||
'liveblog/recirc.html', | ||
'liveblog/recirc_override.html', | ||
must_inherit=False) | ||
|
||
|
||
@register.inclusion_tag(recirc_template_name, takes_context=True) | ||
def liveblog_recirc_partial(context): | ||
return context | ||
|
||
# Sharetools Template | ||
entry_sharetools_template_name = get_overridable_template_name( | ||
'liveblog/entry_sharetools.html', | ||
'liveblog/entry_sharetools_override.html', | ||
must_inherit=False) | ||
|
||
|
||
@register.inclusion_tag(entry_sharetools_template_name, takes_context=True) | ||
def liveblog_entry_sharetools_partial(context): | ||
return context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django.conf import settings | ||
from django.db.models.loading import get_model | ||
from django.shortcuts import get_object_or_404 | ||
from django.utils import dateparse | ||
from django.views.decorators.cache import cache_control | ||
from django.views.generic import TemplateView | ||
|
||
LiveBlogModel = get_model(settings.BULBS_LIVEBLOG_MODEL) | ||
|
||
|
||
class LiveblogNewEntriesView(TemplateView): | ||
template_name = 'liveblog/new_entries.html' | ||
|
||
def get_context_data(self, slug, pk): | ||
context = {} | ||
liveblog = get_object_or_404(LiveBlogModel, pk=pk) | ||
when = dateparse.parse_datetime(self.request.GET['new_as_of']) | ||
if not when: | ||
raise ValueError('param new_as_of must be an ISO formatted timestamp') | ||
context['entries'] = liveblog.entries.filter(published__gte=when) | ||
return context | ||
|
||
liveblog_new_entries = cache_control(max_age=600)(LiveblogNewEntriesView.as_view()) |
Oops, something went wrong.