Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
2 parents 6db5717 + 7658723 commit 288cd3f8058b50d3fe3ce32db2c44dcf3dedca89 @pmac pmac committed May 16, 2012
Showing with 1,088 additions and 148 deletions.
  1. +2 −0 .gitignore
  2. +3 −0 .gitmodules
  3. +2 −0 flicks/base/templates/judges.html
  4. +8 −1 flicks/base/templates/shared/header.html
  5. +57 −0 flicks/base/templates/shared/macros.html
  6. +6 −6 flicks/base/urls.py
  7. +9 −1 flicks/settings/base.py
  8. +3 −2 flicks/urls.py
  9. +2 −2 flicks/users/admin.py
  10. +8 −4 flicks/videos/admin.py
  11. +91 −0 flicks/videos/migrations/0010_auto__add_award.py
  12. +103 −0 flicks/videos/migrations/0011_add_awards.py
  13. +90 −1 flicks/videos/models.py
  14. +4 −6 flicks/videos/templates/videos/details.html
  15. +1 −21 flicks/videos/templates/videos/recent.html
  16. +39 −0 flicks/videos/templates/videos/recent_contest_over.html
  17. +93 −0 flicks/videos/templates/videos/winners.html
  18. +0 −51 flicks/videos/tests/test_views.py
  19. +2 −3 flicks/videos/urls.py
  20. +41 −5 flicks/videos/views.py
  21. +469 −44 media/css/main.css
  22. BIN media/fonts/OpenSans-Light-webfont.eot
  23. BIN media/fonts/OpenSans-Light-webfont.woff
  24. BIN media/img/anon_user.png
  25. BIN media/img/black-bg.jpg
  26. BIN media/img/curtains-contest-closed.png
  27. BIN media/img/curtains.jpg
  28. BIN media/img/favicon.png
  29. BIN media/img/firefox-flicks-wm.png
  30. BIN media/img/firefox-small.png
  31. BIN media/img/flair.png
  32. BIN media/img/flicks-logo.png
  33. BIN media/img/footer-mini.jpg
  34. BIN media/img/footer.jpg
  35. BIN media/img/footer.png
  36. BIN media/img/form-footer-mini.jpg
  37. BIN media/img/form-profile-banner-mobile.png
  38. BIN media/img/form-profile-banner.png
  39. BIN media/img/gravatar.png
  40. BIN media/img/grey-bg.jpg
  41. BIN media/img/home-back.jpg
  42. BIN media/img/home-black-bg-mid.png
  43. BIN media/img/home-black-bg-mobile.png
  44. BIN media/img/home-black-bg.png
  45. BIN media/img/home-title-en-US.png
  46. BIN media/img/judge_ben_silverman.jpg
  47. BIN media/img/judge_buffy.jpg
  48. BIN media/img/judge_couper_samuelson.jpg
  49. BIN media/img/judge_edward_norton.jpg
  50. BIN media/img/judge_hanin.jpg
  51. BIN media/img/judge_jaison.jpg
  52. BIN media/img/judge_jasmine.jpg
  53. BIN media/img/judge_jeff_silver.jpg
  54. BIN media/img/judge_ray.jpg
  55. BIN media/img/judge_shauna_robertson.jpg
  56. BIN media/img/judge_tammy.jpg
  57. BIN media/img/mozilla-tab.png
  58. BIN media/img/partner-adobe.jpg
  59. BIN media/img/partner-bafici.jpg
  60. BIN media/img/partner-bavc.jpg
  61. BIN media/img/partner-panavision.jpg
  62. BIN media/img/partner-sfiff.jpg
  63. BIN media/img/partner-vidly.jpg
  64. BIN media/img/profile-banner-mobile.png
  65. BIN media/img/profile-banner.png
  66. BIN media/img/promo-dance.jpg
  67. BIN media/img/promo-noir.jpg
  68. BIN media/img/promo-twilight.jpg
  69. BIN media/img/search.png
  70. BIN media/img/social-logos.png
  71. BIN media/img/sub-curtains-mid.png
  72. BIN media/img/sub-curtains-mobile-long.png
  73. BIN media/img/sub-curtains-mobile.png
  74. BIN media/img/sub-curtains.jpg
  75. BIN media/img/sub-curtains.png
  76. BIN media/img/title-en-US.png
  77. BIN media/img/vote.png
  78. BIN media/img/winner-trophy-lg.png
  79. BIN media/img/winner-trophy-sm.png
  80. BIN media/img/winners-header.png
  81. +48 −0 media/js/winners.js
  82. +2 −0 requirements/compiled.txt
  83. +2 −0 requirements/prod.txt
  84. +1 −1 vendor
  85. +1 −0 vendor-local/src/django-waffle
  86. +1 −0 vendor-local/vendor.pth
View
@@ -19,3 +19,5 @@ tmp/*
*.mo
flicks/locale/templates
flicks/locale/.svn
+*.egg-info
+media/previews/*
View
@@ -28,3 +28,6 @@
[submodule "vendor-local/src/django-statsd"]
path = vendor-local/src/django-statsd
url = git://github.com/andymckay/django-statsd.git
+[submodule "vendor-local/src/django-waffle"]
+ path = vendor-local/src/django-waffle
+ url = git://github.com/jsocol/django-waffle.git
@@ -123,6 +123,8 @@ <h2>{{ _('Couper Samuelson (Producer)') }}</h2>
{% endtrans %}
</p>
+ <h1 class="youth_judges_header">{{ _('Youth Judges') }}</h1>
+
<h2>{{ _('Raymundo Archila') }}</h2>
<p>
<img src="{{ MEDIA_URL }}img/judge_ray.jpg" class="judge">
@@ -1,8 +1,15 @@
<div id="header">
<div class="header-wrapper">
- <a href="{{ url('flicks.videos.recent') }}"
+ <a href="{{ url('flicks.videos.winners') if waffle.flag('winners_page')
+ else url('flicks.videos.recent') }}"
title="{{ _('Firefox Flicks') }}" class="logo">{{ _('Firefox Flicks') }}</a>
<ul>
+ {% if waffle.flag('winners_page') %}
+ <li><a href="{{ url('flicks.videos.winners')}}"
+ title="{{ _('Award') }}">
+ <img class="award" src="{{ MEDIA_URL }}img/winner-trophy-sm.png" alt="{{ _('Award') }}">
+ </a></li>
+ {% endif %}
<li><a href="{{ url('flicks.videos.recent')}}"
title="{{ _('Videos') }}">{{ _('Videos') }}</a></li>
<li><a href="{{ url('flicks.base.creative')}}"
@@ -1,6 +1,9 @@
{% macro video_item(idx, video) -%}
<li id="slide-{{ idx }}">
<a href="{{ video.details_href }}" class="title" title="{{ video.title }}">
+ {% if waffle.flag('winners_page') and video.is_winner %}
+ <img class="winner-mark" src="{{ MEDIA_URL }}img/winner-trophy-sm.png" alt="{{ _('Award') }}">
+ {% endif %}
<img src="{{ video.poster_href }}" height="141">
</a>
<div class="video-details">
@@ -14,6 +17,13 @@
{% macro video_details(video) -%}
<a href="{{ url('flicks.users.details', user_id=video.user_id) }}"
class="user">{{ video.user.userprofile.full_name }}, {{ video.user.userprofile.country }}</a>
+ {% if waffle.flag('winners_page') and video.is_winner %}
+ {% for award in video.award_set.all() %}
+ <div class="winner-details">
+ {{ award.award_title }}
+ </div>
+ {% endfor %}
+ {% endif %}
<p class="region-info">
{% set category_link='<span class="category">{title}</span>'|fe(title=video.get_category_display()) %}
{% set country_link='<span class="region">{title}</span>'|fe(title=video.get_region_display()) %}
@@ -121,3 +131,50 @@ <h3>{{ _('Search') }}</h3>
</p>
{% endif %}
{%- endmacro %}
+
+{% macro award_region(region_name, region_key) -%}
+ <h1>{{ region_name }}</h1>
+
+ <section class="grandprize">
+ {% set key = 'grand_winner__%s'|format(region_key) %}
+ {{ large_award(awards[key]) }}
+ </section>
+
+ <section class="category">
+ <h2>{{ _('Category Winners') }}</h2>
+ <ul>
+ {% for category_key, category_name in category_choices %}
+ {% set key = 'category_winner__%s__%s'|format(region_key, category_key) %}
+ {{ small_award(category_name, awards[key]) }}
+ {% endfor %}
+ </ul>
+ </section>
+
+ <section class="runnerups">
+ <h2>{{ _('Runner Ups') }}</h2>
+ <ul>
+ {% for category_key, category_name in category_choices %}
+ {% set key = 'runner_up__%s__%s'|format(region_key, category_key) %}
+ {{ small_award(category_name, awards[key]) }}
+ {% endfor %}
+ </ul>
+ </section>
+{%- endmacro %}
+
+{% macro large_award(award) -%}
+ <h2 class="title">
+ <a href="{{ award.video_href }}">
+ <img src="{{ award.video_preview }}" alt="{{ award.video_title }}" width="600" height="342">
+ {{ award.video_title }}
+ </a>
+ </h2>
+ <p class="credit">{{ award.submitter_name }}, {{ award.submitter_country }}</p>
+{%- endmacro %}
+
+{% macro small_award(category_name, award) -%}
+ <li>
+ <h3>{{ category_name }}</h3>
+ <h4 class="title"><a href="{{ award.video_href }}">{{ award.video_title }}</a></h4>
+ <p class="credit">{{ award.submitter_name }}, {{ award.submitter_country }}</p>
+ </li>
+{%- endmacro %}
View
@@ -3,10 +3,10 @@
from flicks.base import views
urlpatterns = patterns('',
- url(r'^creative$', views.creative, name='flicks.base.creative'),
- url(r'^faq$', views.faq, name='flicks.base.faq'),
- url(r'^judges$', views.judges, name='flicks.base.judges'),
- url(r'^partners$', views.partners, name='flicks.base.partners'),
- url(r'^prizes$', views.prizes, name='flicks.base.prizes'),
- url(r'^rules$', views.rules, name='flicks.base.rules'),
+ url(r'^creative/?$', views.creative, name='flicks.base.creative'),
+ url(r'^faq/?$', views.faq, name='flicks.base.faq'),
+ url(r'^judges/?$', views.judges, name='flicks.base.judges'),
+ url(r'^partners/?$', views.partners, name='flicks.base.partners'),
+ url(r'^prizes/?$', views.prizes, name='flicks.base.prizes'),
+ url(r'^rules/?$', views.rules, name='flicks.base.rules'),
)
View
@@ -21,14 +21,16 @@
),
'video_details': (
'js/libs/script.js',
- 'js/vote.js',
'js/views.js',
'js/share.js',
),
'promo_video': (
'js/libs/script.js',
'js/share.js',
),
+ 'winners': (
+ 'js/winners.js',
+ )
}
}
@@ -77,13 +79,15 @@
'django_browserid',
'django_statsd',
'south',
+ 'waffle',
]
MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES) + [
'commonware.response.middleware.StrictTransportMiddleware',
'csp.middleware.CSPMiddleware',
'django_statsd.middleware.GraphiteRequestTimingMiddleware',
'django_statsd.middleware.GraphiteMiddleware',
+ 'waffle.middleware.WaffleMiddleware',
]
AUTH_PROFILE_MODULE = 'flicks.UserProfile'
@@ -213,3 +217,7 @@
'django_statsd.patches.db',
'django_statsd.patches.cache',
]
+
+# Video preview settings
+PREVIEW_PATH = lambda inst, filename: 'previews/%s_%s' % (inst.id, filename)
+MAX_FILEPATH_LENGTH = 100
View
@@ -1,10 +1,11 @@
from django.conf import settings
from django.conf.urls.defaults import include, patterns, url
+from django.contrib import admin
from django.contrib.admin import autodiscover
from django.shortcuts import render
-from funfactory import admin
-
+from funfactory.monkeypatches import patch
+patch()
# Autodiscover admin.py files in each app
autodiscover()
View
@@ -1,8 +1,7 @@
+from django.contrib.admin import site
from django.contrib.auth import admin
from django.contrib.auth.models import User
-from funfactory.admin import site
-
class UserAdmin(admin.UserAdmin):
"""Configuration for the user admin pages."""
@@ -19,4 +18,5 @@ def country(self, user):
def youth_contest(self, user):
return user.userprofile.youth_contest
youth_contest.boolean = True
+site.unregister(User)
site.register(User, UserAdmin)
View
@@ -1,8 +1,6 @@
from django.contrib import admin
-from funfactory.admin import site
-
-from flicks.videos.models import Video
+from flicks.videos.models import Award, Video
class VideoAdmin(admin.ModelAdmin):
@@ -11,4 +9,10 @@ class VideoAdmin(admin.ModelAdmin):
'region', 'shortlink', 'created']
list_filter = ['state', 'judge_mark', 'category', 'region']
search_fields = ['title', 'description', 'user__email']
-site.register(Video, VideoAdmin)
+admin.site.register(Video, VideoAdmin)
+
+
+class AwardAdmin(admin.ModelAdmin):
+ """Configuration for the award admin pages."""
+ list_display = ['region', 'award_type', 'category', 'video', 'preview']
+admin.site.register(Award, AwardAdmin)
@@ -0,0 +1,91 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding model 'Award'
+ db.create_table('videos_award', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('video', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['videos.Video'], null=True, blank=True)),
+ ('preview', self.gf('django.db.models.fields.files.ImageField')(max_length=100)),
+ ('category', self.gf('django.db.models.fields.CharField')(max_length=50)),
+ ('region', self.gf('django.db.models.fields.CharField')(max_length=50)),
+ ('award_type', self.gf('django.db.models.fields.CharField')(max_length=50)),
+ ))
+ db.send_create_signal('videos', ['Award'])
+
+ def backwards(self, orm):
+ # Deleting model 'Award'
+ db.delete_table('videos_award')
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'videos.award': {
+ 'Meta': {'object_name': 'Award'},
+ 'award_type': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'category': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'preview': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}),
+ 'region': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'video': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['videos.Video']", 'null': 'True', 'blank': 'True'})
+ },
+ 'videos.video': {
+ 'Meta': {'object_name': 'Video'},
+ 'bitly_link_db': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
+ 'category': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 2, 28, 0, 0)', 'auto_now_add': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'judge_mark': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'region': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'shortlink': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
+ 'state': ('django.db.models.fields.CharField', [], {'default': "'unsent'", 'max_length': '10'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'upload_url': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
+ 'views': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
+ 'votes': ('django.db.models.fields.BigIntegerField', [], {'default': '0'})
+ }
+ }
+
+ complete_apps = ['videos']
Oops, something went wrong.

0 comments on commit 288cd3f

Please sign in to comment.