Skip to content

Commit

Permalink
Merge branch 'master' of github.com:hacklabr/timtec
Browse files Browse the repository at this point in the history
  • Loading branch information
bgola committed Nov 11, 2013
2 parents 575ed4c + 6f59d5f commit 2c3823e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import Group
from django.contrib.staticfiles.storage import staticfiles_storage

from allauth.account.signals import user_signed_up

Expand Down Expand Up @@ -211,6 +212,14 @@ def save(self, **kwargs):
def __unicode__(self):
return self.name

def thumbnail(self):
try:
first_vid_unit = self.units.exclude(video=None).order_by('position')[0]
thumbnail = 'http://i1.ytimg.com/vi/' + first_vid_unit.video.youtube_id + '/hqdefault.jpg'
return thumbnail
except IndexError:
return staticfiles_storage.url('img/lesson-default.png')

def activity_count(self):
return self.units.exclude(activity=None).count()

Expand Down
2 changes: 1 addition & 1 deletion core/templates/admin/_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<body id="admin" ng-controller="CourseEdit">

<!-- NAVBAR -->
<div id="main-navbar" class="navbar navbar-fixed-top navbar-inverse">
<div id="main-navbar" class="navbar navbar-inverse">
<div class="container">
<a class="navbar-brand" href="/">TIM Tec - ADMIN</a>
<ul class="nav navbar-nav pull-right">
Expand Down
4 changes: 2 additions & 2 deletions core/templates/course.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ <h3><i class="icon-double-angle-right"></i> {% trans "Lessons" %}</h3>
{% for lesson in course.public_lessons %}
<li>
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3 hidden-xs">
<p><img src="{% static 'img/lesson-default.png' %}" class="thumbnail"></p>
<div class="col-lg-3 col-sm-3 col-sm-3 hidden-xs">
<img src="{{ lesson.thumbnail }}" class="thumbnail">
</div>
<div class="col-lg-9 col-md-9 col-sm-9 col-xs-12">
<p>
Expand Down

0 comments on commit 2c3823e

Please sign in to comment.