New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #120, #121, #122 - allowing winners to be chosen and then displayed #128

Merged
merged 3 commits into from Feb 25, 2013
Jump to file or symbol
Failed to load files and symbols.
+37 −7
Diff settings

Always

Just for now

Viewing a subset of changes. View all

Closes #122 - adding in markers to the submission list to highlight t…

…he winners/runners-up
  • Loading branch information...
rossbruniges committed Feb 22, 2013
commit db7e08d90764f59940eb3cb75a216633033658bb
@@ -332,6 +332,7 @@ nav li a {
box-sizing: border-box;
padding: 0 10px;
margin-bottom: 1em;
position: relative;
}
.entries li:nth-child(3n+1) {
clear: left;
@@ -340,6 +341,15 @@ nav li a {
width: 100%;
height: auto;
display: block;
position: relative;
z-index: 10;
}
.entries .badge {
width: auto;
position: absolute;
top: -0.2em;
left: 0;
z-index: 20;
}
.entries .cta {
margin-top: 0.5em;
@@ -507,6 +517,9 @@ nav li a {
width: auto;
margin-right: 0;
}
.entries .badge {
width: 40%;
}
.mini-col {
float: none;
width: auto;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -34,6 +34,14 @@
}
}
AWARD_CHOICES = (
('champ', 'Grand Champion'),
('best-hack', 'Best Hackable Game'),
('best-device', 'Best Multi-Device Game'),
('best-web', 'Best Web-Only Game'),
('notable', 'Notable Runner-Up')
)
def url2embed(url):
if not url:
@@ -116,13 +124,8 @@ class Entry(models.Model):
validators=[MaxLengthValidator(250)], blank=True)
to_market = models.BooleanField(verbose_name="redirect to marketplace",
default=False)
award = models.CharField(max_length=255, blank=True, null=True, choices=(
('champ', 'Grand Champion'),
('best-hack', 'Best Hackable Game'),
('best-device', 'Best Multi-Device Game'),
('best-web', 'Best Web-Only Game'),
('notable', 'Notable Runner-Up')
))
award = models.CharField(max_length=255, blank=True, null=True,
choices=AWARD_CHOICES)
def __unicode__(self):
return self.title
@@ -154,6 +157,19 @@ def has_entry_feature(self):
"""
return url2embed(self.video_url) or self.thumbnail
@property
def has_award(self):
return self.award or False
def get_award_badge(self):
static_url = getattr(settings, 'STATIC_URL', '')
static_path = lambda f: f and '%s%s' % (static_url, f)
badge_values = filter(lambda x: x[0] == self.award, AWARD_CHOICES)[0]
return '<img class="badge" src="%s" alt="This entry was awarded %s" />' % (
static_path('base/img/badges/%s.png' % badge_values[0]),
badge_values[1]
)
def get_entry_feature(self):
"""
If there is a video_url we want to include that as a feature, otherwise
@@ -26,6 +26,7 @@ <h1 class="busta shout">All Entries</h1>
<span class="frame"><img src="{{ sub.get_image_src() }}" width="180" height="102" alt="" /></span>
{{ sub.title }}
</a>
{% if sub.has_award %}{{ sub.get_award_badge()|safe }}{% endif %}
{% if sub.editable_by(user=request.user) and request.challenge.is_open() %}
<a class="cta whimper" href="{{ url('submissions.entry_edit', slug=sub.slug) }}">Edit your game</a>
{% endif %}
ProTip! Use n and p to navigate between commits in a pull request.