def home(request): """Landing page for Flicks. Displays only the promo videos.""" # Redirect logged in users to the recent videos page. if request.user.is_active: return redirect('flicks.videos.recent') d = dict(promo_dance=promo_video_shortlink('dance'), promo_noir=promo_video_shortlink('noir'), promo_twilight=promo_video_shortlink('twilight'), page_type='home') return render(request, 'home.html', d)
def promo_video_twilight(request): """Twilight parody promo video.""" desc = _('A teenage girl learns the truth about the fox. Get inspired for ' 'your Firefox Flicks entry by checking out our video.') d = dict(video_title=_('Twilight'), video_description=desc, tweet_text=desc, page_type='videos', video_embed=vidly_embed_code(promo_video_shortlink('twilight'), width='100%')) return render(request, 'videos/2012/promo.html', d)
def promo_video_twilight(request): """Twilight parody promo video.""" desc = _lazy('A teenage girl learns the truth about the fox. Get inspired ' 'for your Firefox Flicks entry by checking out our video.') d = dict(video_title=_lazy('Twilight'), video_description=desc, tweet_text=desc, page_type='videos', video_embed=Markup(embedCode(promo_video_shortlink('twilight'), width=600, height=337))) return render(request, 'videos/promo.html', d)
def promo_video_dance(request): """Dancing promo video.""" d = dict(video_title=_lazy('Dance'), video_description=_lazy("He's got the moves, he's got ambition. " "How far can this fox's feet take him? " "Get inspired for your Firefox Flicks " "entry by checking out our video."), page_type='videos', video_embed=Markup(embedCode(promo_video_shortlink('dance'), width=600, height=337))) return render(request, 'videos/promo.html', d)
def promo_video_noir(request): """Film Noir promo video.""" d = dict(video_title=_lazy('Noir'), video_description=_lazy('The fox meets a damsel in distress, but ' 'can he help her? Get inspired for your ' 'Firefox Flicks entry by checking out ' 'our video.'), page_type='videos', video_embed=Markup(embedCode(promo_video_shortlink('noir'), width=600, height=337))) return render(request, 'videos/promo.html', d)
def promo_video_noir(request): """Film Noir promo video.""" d = dict(video_title=_('Noir'), video_description=_('The fox meets a damsel in distress, but can ' 'he help her? Get inspired for your Firefox ' 'Flicks entry by checking out our video.'), tweet_text=_('The fox meets a damsel in distress, but can he help ' 'her?'), page_type='videos', video_embed=vidly_embed_code(promo_video_shortlink('noir'), width='100%')) return render(request, 'videos/2012/promo.html', d)
def promo_video_dance(request): """Dancing promo video.""" d = dict(video_title=_('Dance'), video_description=_("He's got the moves, he's got ambition. How " "far can this fox's feet take him? Get " "inspired for your Firefox Flicks entry by " "checking out our video."), tweet_text=_("He's got the moves. He's got ambition. How far can " "this fox's feet take him?"), page_type='videos', video_embed=vidly_embed_code(promo_video_shortlink('dance'), width='100%')) return render(request, 'videos/2012/promo.html', d)
def test_success(self): """If a video for the current locale exists, return it's shortlink.""" with self.activate('fr'): eq_(promo_video_shortlink('noir'), 'french')
def test_no_en_us(self): """If there is no video matching the current locale or en-US, return None. """ with self.activate('es'): eq_(promo_video_shortlink('no-en-us'), None)
def test_no_locale(self): """If there is no video matching the current locale, default to en-US. """ with self.activate('es'): eq_(promo_video_shortlink('noir'), 'english')
def test_invalid_promo(self): """If an invalid promo name is given, return None.""" eq_(promo_video_shortlink('invalid'), None)