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
end of article recirc #333
Open
camsom
wants to merge
2
commits into
master
Choose a base branch
from
video-recirc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+60
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% load core %} | ||
|
||
<div class="end-of-article-video"> | ||
<h2>{{ recirc_text }}</h2> | ||
<bulbs-video | ||
twitter-handle="{{ twitter_handle }}" | ||
src="{{ video_src }}"> | ||
</bulbs-video> | ||
<bulbs-video-meta | ||
src="{{ video_src }}" | ||
share-email-message="{{share_message}}" | ||
share-twitter-handle="{{twitter_handle}}" | ||
> | ||
</bulbs-video-meta> | ||
</div> |
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,45 @@ | ||
from django.conf import settings | ||
from django.core.exceptions import ObjectDoesNotExist | ||
from django.template import Context, Library | ||
from django.template.loader import get_template | ||
|
||
from bulbs.content.models import Content | ||
from bulbs.promotion.models import PZone | ||
|
||
|
||
register = Library() | ||
|
||
|
||
@register.simple_tag | ||
def end_of_article_video(): | ||
''' | ||
templatetag that renders the end of article video recirc. | ||
''' | ||
try: | ||
queryset = PZone.objects.applied(name='end-of-article-videos') | ||
except ObjectDoesNotExist: | ||
queryset = Content.search_objects.videos() | ||
|
||
try: | ||
# TODO: come up with a sane way to iterate. | ||
video = queryset[0] | ||
except IndexError: | ||
return | ||
|
||
site_name = getattr(settings, "SITE_DISPLAY_NAME", None) | ||
recirc_text = "Watch Video " + str(video.videohub_ref.id) | ||
if site_name: | ||
recirc_text += " From " + site_name | ||
|
||
base_url = getattr(settings, "VIDEOHUB_BASE_URL", None) + "/video/{}.json" | ||
if base_url is None: | ||
return "" | ||
|
||
return get_template( | ||
"recirc/end_of_article.html" | ||
).render( | ||
Context({ | ||
'recirc_text': recirc_text, | ||
'video_src': base_url.format(video.videohub_ref.id) | ||
}) | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe Raise here --- would we ever expect VIDEOHUB_BASE_URL to be undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benghaziboy notice you didn't respond to mike here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
he was wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.youtube.com/watch?v=8eCGkOL6WGw