Commits

Steve Losh committed 8a341db

Add the THANKS view.

Comments (0)

Files changed (6)

 
 urlpatterns = patterns('noodlebucket.feedback.views',
     url(r'request/$', 'request_repo', name='request-repo'),
+    url(r'request/thanks/$', 'request_repo_thanks', name='request-repo-thanks'),
 )

feedback/views.py

 from django.core.urlresolvers import reverse
+from django.http import HttpResponseRedirect
 from django.shortcuts import render_to_response
 from django.template import RequestContext
 
         if form.is_valid():
             form.save()
             
-            return HttpResponseRedirect(reverse('thanks-request-repo'))
+            return HttpResponseRedirect(reverse('request-repo-thanks'))
     else:
         form = FeedbackRepoRequestForm()
     
         context_instance=RequestContext(request)
     )
 
+def request_repo_thanks(request):
+    return render_to_response(
+        'feedback/request_repo_thanks.html', {},
+        context_instance=RequestContext(request)
+    )
+

media/css/base.css

 }
 
 div#main-wrap {
-    width: 50em;
+    width: 52em;
     margin: 1em auto 6em;
 }
 div#content-wrap {

mercurial_data/bitbucket/scrape.py

     csets_data = json.loads(urllib2.urlopen(csets_url).read())
     for cset in csets_data['changesets']:
         if Changeset.objects.filter(repo=repo, cset_hash=cset['node'], cset_parent__isnull=False).count() == 0:
-            c = Changeset(repo=repo, cset_hash=cset['node'], cset_parent=None,
-                cset_author=cset['author'], cset_date=None, cset_message=cset['message'])
+            c = Changeset(
+                repo=repo, cset_hash=cset['node'], cset_parent=None,
+                cset_author=cset['author'], cset_date=None,
+                cset_branch=cset['branch'], cset_message=cset['message']
+            )
             cset_url = 'http://api.bitbucket.org/1.0/repositories/%s/%s/changesets/%s/' % (repo.user_name, repo.repo_name, cset['node'])
             cset_data = json.loads(urllib2.urlopen(cset_url).read())
             c.cset_date = datetime.datetime.strptime(cset_data['timestamp'], '%Y-%m-%d %H:%M:%S')

templates/feedback/request_repo_thanks.html

+{% extends "base.html" %}
+
+{% block header %}Thanks for Requesting a Repository{% endblock %}
+
+{% block content %}
+    <p>
+        Thanks, I'll take a look and if it's interesting I'll add your
+        repository to the list!
+    </p>
+{% endblock %}

templates/repos/repo.html

 {% block title %}{{ repo.user_name }}/{{ repo.repo_name }} – {% endblock %}
 
 {% block content %}
-    <h2>{{ repo.user_name }}/{{ repo.repo_name }}</h2>
+    <h2>
+        Noodles of
+        <a href="http://bitbucket.org/{{ repo.user_name }}/{{ repo.repo_name }}/">{{ repo.user_name }}/{{ repo.repo_name }}</a>
+    </h2>
     
 {% endblock %}