Permalink
Browse files

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

…he winners/runners-up
  • Loading branch information...
1 parent 64ab657 commit db7e08d90764f59940eb3cb75a216633033658bb @rossbruniges rossbruniges committed Feb 22, 2013
@@ -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;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -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 %}

0 comments on commit db7e08d

Please sign in to comment.