Commits

Kevin Veroneau committed 6d5de34 Draft

Added Homepage to ready for prototype deployment.

Comments (0)

Files changed (4)

gamedb/templates/gamedb/fragments/latest_games.html

+{% load ohrrpgce %}<ul class="thumbnails">
+{% for game in game_list %}
+  <li class="span4">
+    <div class="thumbnail">
+      <img src="{{game.first_screenshot}}" alt="{{game}}">
+      <h3>{{game|link}}</h3>
+      <p>{{game.description}}</p>
+    </div>
+  </li>
+{% endfor %}
+</ul>

gamedb/templates/gamedb/homepage.html

+{% extends "base.html" %}
+{% load ohrrpgce %}
+
+{% block content %}
+          <div class="hero-unit">
+            <h1>OHRRPGCE Game Database</h1>
+            <p>Welcome to the prototype of the OHRRPGCE Game Database!  Please refrain from uploading any games at this time.</p>
+            <p><a href="{% url 'game_list' %}" class="btn btn-primary btn-large">Browse Games &raquo;</a></p>
+          </div>
+          <h3>Latest Games</h3>
+          {% latest_games %}
+{% endblock %}

gamedb/templatetags/ohrrpgce.py

 from django import template
 from django.utils.safestring import mark_safe
+from gamedb.models import Game
 
 register = template.Library()
 
         return mark_safe('<a href="%s">%s</a>' % (value.get_absolute_url(), value))
     except:
         return value
+
+@register.inclusion_tag('gamedb/fragments/latest_games.html')
+def latest_games():
+    game_list = Game.objects.all().order_by('-date_added')[:3]
+    return {'game_list':game_list}
     ViewComposer
 
 urlpatterns = patterns('',
+    url(r'^$', TemplateView.as_view(template_name='gamedb/homepage.html'), name='gamedb_home'),
     url(r'^Games/$', GameList.as_view(), name='game_list'),
     url(r'^Games/(?P<slug>[\w-]+).html$', ViewGame.as_view(), name='game_detail'),
     url(r'^Writer/(?P<pk>\d+)$', ViewWriter.as_view(), name='writer_detail'),