Repo graph template

This commit is contained in:
Eryn Wells 2012-08-18 11:47:13 -07:00
parent 8e2decc27e
commit 57ea318fcf
3 changed files with 22 additions and 2 deletions

View file

@ -0,0 +1,7 @@
{# vim: set ft=htmldjango #}
{% extends "graph_base.html" %}
{% block graph %}
<h1 class="placeholder">PUT A GRAPH OF<br/>{{ username }}'s<br/>{{ repo }}
REPO<br/>HERE</h1>
{% endblock %}

View file

@ -7,6 +7,9 @@
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">My Repos</a> <a href="#" class="dropdown-toggle" data-toggle="dropdown">My Repos</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% for repo in request.user_repos %}
<li>{{ repo }}</li>
{% endfor %}
</ul> </ul>
</li> </li>
<li><a href="{% url index %}">Followers</a></li> <li><a href="{% url index %}">Followers</a></li>

View file

@ -4,6 +4,13 @@ from django.shortcuts import redirect, render_to_response
from django.template import RequestContext from django.template import RequestContext
class GitHubRequestContext(RequestContext):
@property
def user_repos(self):
username = self.request.user.username
return self.request.github.get_iter('/users/%s/repos/' % username)
def index(request): def index(request):
'''Index page. Everyone starts here. If the user is logged in (that is, they '''Index page. Everyone starts here. If the user is logged in (that is, they
have a session id) return the follower_graph view. Otherwise, render the have a session id) return the follower_graph view. Otherwise, render the
@ -35,9 +42,12 @@ def login(request):
@login_required @login_required
def graph_followers(request): def graph_followers(request):
return render_to_response('graph_followers.html', RequestContext(request)) return render_to_response('graph_followers.html', GitHubRequestContext(request))
@login_required @login_required
def graph_repo(request, user, repo): def graph_repo(request, user, repo):
return render_to_response('graph_followers.html', RequestContext(request)) return render_to_response('graph_repo.html', {
'username': user,
'repo': repo,
}, RequestContext(request))