Repo graph template
This commit is contained in:
parent
8e2decc27e
commit
57ea318fcf
3 changed files with 22 additions and 2 deletions
7
templates/graph_repo.html
Normal file
7
templates/graph_repo.html
Normal 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 %}
|
|
@ -7,6 +7,9 @@
|
|||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">My Repos</a>
|
||||
<ul class="dropdown-menu">
|
||||
{% for repo in request.user_repos %}
|
||||
<li>{{ repo }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="{% url index %}">Followers</a></li>
|
||||
|
|
14
views.py
14
views.py
|
@ -4,6 +4,13 @@ from django.shortcuts import redirect, render_to_response
|
|||
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):
|
||||
'''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
|
||||
|
@ -35,9 +42,12 @@ def login(request):
|
|||
|
||||
@login_required
|
||||
def graph_followers(request):
|
||||
return render_to_response('graph_followers.html', RequestContext(request))
|
||||
return render_to_response('graph_followers.html', GitHubRequestContext(request))
|
||||
|
||||
|
||||
@login_required
|
||||
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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue