diff options
author | bnewbold <bnewbold@manus.(none)> | 2007-03-07 14:56:46 -0800 |
---|---|---|
committer | bnewbold <bnewbold@manus.(none)> | 2007-03-07 14:56:46 -0800 |
commit | 953fc002832a9afe59372bf513ef167916608e05 (patch) | |
tree | 73ba59d2479d240c7b14d9e1757b9e5cecad5fb6 /bn_django | |
parent | 8a459f1bfcad487d6e594b9c3d7ca485a9084f49 (diff) | |
download | bnewnet-953fc002832a9afe59372bf513ef167916608e05.tar.gz bnewnet-953fc002832a9afe59372bf513ef167916608e05.zip |
comments progress, style changes
Diffstat (limited to 'bn_django')
-rw-r--r-- | bn_django/git_wiki/models.py | 8 | ||||
-rw-r--r-- | bn_django/git_wiki/settings.py | 6 | ||||
-rw-r--r-- | bn_django/git_wiki/templates/git_wiki/commit.html | 17 | ||||
-rw-r--r-- | bn_django/git_wiki/templates/git_wiki/frontpage.html | 8 | ||||
-rw-r--r-- | bn_django/git_wiki/templates/git_wiki/item.html | 2 | ||||
-rw-r--r-- | bn_django/git_wiki/templates/git_wiki/newitems_table | 27 | ||||
-rw-r--r-- | bn_django/git_wiki/views.py | 10 | ||||
-rw-r--r-- | bn_django/templates/about.html | 2 | ||||
-rw-r--r-- | bn_django/templates/credits.html | 2 | ||||
-rw-r--r-- | bn_django/templates/frontpage.html | 10 | ||||
-rw-r--r-- | bn_django/templates/newcomments_table | 26 | ||||
-rw-r--r-- | bn_django/urls.py | 7 |
12 files changed, 106 insertions, 19 deletions
diff --git a/bn_django/git_wiki/models.py b/bn_django/git_wiki/models.py index ad3affb..78a26f6 100644 --- a/bn_django/git_wiki/models.py +++ b/bn_django/git_wiki/models.py @@ -82,6 +82,7 @@ class Item(models.Model): return "/k/%s/" % self.slug() def get_admin_url(self): return "%s/k/%s/" % (ADMIN_URL, self.id) + def update(self): import commands @@ -208,6 +209,13 @@ def reposcan(): f.close() return (heads, tags) +def newest_items(): + num = Item.objects.count() + min = num-7 + if min < 0: + min = 0 + return Item.objects.all()[min:num] + def shortlog(hash=None,tree=None): import commands diff --git a/bn_django/git_wiki/settings.py b/bn_django/git_wiki/settings.py index b94d318..965ac26 100644 --- a/bn_django/git_wiki/settings.py +++ b/bn_django/git_wiki/settings.py @@ -1,13 +1,13 @@ # full path to directory holding the wiki repository (or sys links to # the repositories) -GITWIKI_BASE = '/srv/git/' +GITWIKI_BASE = '/home/bnewbold/knowledge/' # leave this blank (NO WHITE SPACE) unless you're using a bare repo -GITWIKI_NAME = 'knowledge' +GITWIKI_NAME = '' # fill path to the git command -GITCOMMAND = '/usr/bin/git' +GITCOMMAND = '/usr/local/bin/git' GITWIKI_DIR = str(GITWIKI_BASE) + '/' + str(GITWIKI_NAME) + '.git' GITPREFIX = 'cd ' +str(GITWIKI_BASE) + '; ' + str(GITCOMMAND) + ' --git-dir=' \ diff --git a/bn_django/git_wiki/templates/git_wiki/commit.html b/bn_django/git_wiki/templates/git_wiki/commit.html index 5eb5dd0..8497311 100644 --- a/bn_django/git_wiki/templates/git_wiki/commit.html +++ b/bn_django/git_wiki/templates/git_wiki/commit.html @@ -1,24 +1,27 @@ {% extends "git_wiki/base.html" %} +{% block title %}Commit: {{ commit.committer_date}} +{% endblock %} {% block gitwiki %} {% if commit %} - <h3>Commit sha1 hash</h3> + <b>Commit sha1 hash: </b> <span class="hash">{{ commit.id }}</span><br /> - <h3>Parent sha1 hash</h3> + <b>Parent sha1 hash: </b> {% if commit.parenthash %} <a href="/k/commit/{{ commit.parenthash }}/"> <span class="hash">{{ commit.parenthash }}</span></a> {% else %}No parent... root commit?{% endif %} - <h3>Tree sha1 hash</h3> + <br /> + <b>Tree sha1 hash: </b> {% if commit.treehash %} <span class="hash">{{ commit.treehash }}</span> {% else %}No tree hash?{% endif %} - <h3>Author</h3> + <br /><b>Author: </b> {{ commit.author }}<br /> - <h3>Author Date</h3> + <b>Author Date: </b> {{ commit.author_date }}<br /> - <h3>Committer</h3> + <b>Committer: </b> {{ commit.committer }}<br /> - <h3>Committer Date</h3> + <b>Committer Date: </b> {{ commit.committer_date }}<br /> {% if commit.rawdiff %} <pre class="large">{{ commit.rawdiff }}</pre> diff --git a/bn_django/git_wiki/templates/git_wiki/frontpage.html b/bn_django/git_wiki/templates/git_wiki/frontpage.html index 85698c4..0c8d245 100644 --- a/bn_django/git_wiki/templates/git_wiki/frontpage.html +++ b/bn_django/git_wiki/templates/git_wiki/frontpage.html @@ -20,12 +20,14 @@ If you're curious you can track my work in the <a href="/code">code</a> section. <div class="right_stuff"> For more recent content see the <a href="/timeline/">timeline</a> </div> -<h3><a href="/k/">Browse the knowledge!</a></h3> -<h3>Latest knowledge</h3> +<h2><a href="/k/">Browse the knowledge!</a></h2> +<h3>Latest knowledge items</h3> +{% include "git_wiki/newitems_table" %} +<h3>Latest knowledge commits</h3> {% include "git_wiki/shortlog_table" %} -<hr /> <h3>Latest comments</h3> {% if latest_comments %} +{% include "newcomments_table" %} {% else %} None yet! {% endif %} diff --git a/bn_django/git_wiki/templates/git_wiki/item.html b/bn_django/git_wiki/templates/git_wiki/item.html index 4258b1c..d9d33c9 100644 --- a/bn_django/git_wiki/templates/git_wiki/item.html +++ b/bn_django/git_wiki/templates/git_wiki/item.html @@ -31,6 +31,8 @@ {% block commentary %} <div class="content" id="commentary"> {% load comments %} +<br /><p><em>IMPORTANT: Comments only apply to this revision of the item! +They will be lost if the item is updated.</em></p> <h3>Post a comment</h3> {% if user.is_authenticated %} {% comment_form for git_wiki.item item.id with is_public yes %} diff --git a/bn_django/git_wiki/templates/git_wiki/newitems_table b/bn_django/git_wiki/templates/git_wiki/newitems_table new file mode 100644 index 0000000..d86c538 --- /dev/null +++ b/bn_django/git_wiki/templates/git_wiki/newitems_table @@ -0,0 +1,27 @@ +{% if newitems %} +<table class="listing"> + {% for i in newitems reversed %} + <tr> <td class="filename"> + {% ifequal i.type 'blob' %} + <a href='/k/{{ i.slug }}/' class="item"> + {{i.path}}</a> + </td><td type="links"> + <a href='/k/{{ i.slug }}/pdf/'>pdf</a> + </td> + {% else %} {% ifequal i.type 'tree' %} + <a href='/k/{{ i.slug }}/' class="tree"> + {{i.path}}/</a> + </td><td type="links"> + <a href='/k/{{ i.slug }}/'>browse</a> + </td> + {% else %} + <a href='/k/{{ i.slug }}/' class="item"> + {{i.name}}</a> + </td><td type="links"> + </td> + {% endifequal %}{% endifequal %} + </tr> + {% endfor %} +</table> +{% else %}No new items! +{% endif %} diff --git a/bn_django/git_wiki/views.py b/bn_django/git_wiki/views.py index c0681c7..b0dde21 100644 --- a/bn_django/git_wiki/views.py +++ b/bn_django/git_wiki/views.py @@ -7,14 +7,20 @@ import os, commands from models import * from settings import * +from django.contrib.comments.models import Comment,FreeComment # Create your views here. def frontpage(request): t = fromslug('') t.update() + #TODO: doesn't display free comments unless there's a comment + lc = Comment.objects.filter(content_type__name="item").order_by('-submit_date')[:6] + lfc = FreeComment.objects.filter(content_type__name="item").order_by('-submit_date')[:6] return render_to_response('git_wiki/frontpage.html', \ - dict(shortlog=shortlog(), tree=t)) + dict(shortlog=shortlog(), tree=t, + latest_comments=lc, latest_freecomments=lfc, + newitems=newest_items())) def tree(request, reqslug, tree=None): if not tree: @@ -52,7 +58,7 @@ def item(request, reqslug, blob=None): docutils_settings = getattr(settings, "GITWIKI_REST_SETTINGS", {}) parts = publish_parts(source=i.contents, writer_name="html4css1", settings_overrides=docutils_settings) return render_to_response('git_wiki/item.html', - dict(item=i,doc=parts)) + dict(item=i,doc=parts,user=request.user)) def olditem(request, hash): i = get_object_or_404(Item, id=hash) diff --git a/bn_django/templates/about.html b/bn_django/templates/about.html index c9f9ce4..1ca9d60 100644 --- a/bn_django/templates/about.html +++ b/bn_django/templates/about.html @@ -10,7 +10,7 @@ {% block content %} <p /> <div class="righty_content"> - <img src="http://static.bryannewbold.com/img/orange_small.jpg" + <img src="/static/img/orange_small.jpg" alt="the author" /> <br /> <div class="content_caption">the perp</div> diff --git a/bn_django/templates/credits.html b/bn_django/templates/credits.html index b96d2a9..d1322b9 100644 --- a/bn_django/templates/credits.html +++ b/bn_django/templates/credits.html @@ -15,5 +15,5 @@ This site uses a variety of delicious software! <h3>text editor</h3> <p /><a href="http://vim.org">vim</a>! fuck emacs! <h3>versioning system</h3> -<p />I use git as a revisioning system for the <a href="knowledge">knowledge wiki</a> and my <a href="code">software</a> (including this site!). +<p />I use git as a revisioning system for the <a href="/knowledge/">knowledge wiki</a> and my <a href="/code/">software</a> (including this site!). {% endblock %} diff --git a/bn_django/templates/frontpage.html b/bn_django/templates/frontpage.html index 1a7acc2..46906ef 100644 --- a/bn_django/templates/frontpage.html +++ b/bn_django/templates/frontpage.html @@ -35,7 +35,14 @@ For more recent content see the <a href="/timeline/">timeline</a> <br /> <div class="col_right"> -<div class="col_title">Latest knowledge</div> +<div class="col_title">Latest knowledge items</div> +{% if newitems %} +{% include "git_wiki/newitems_table" %} +{% else %} +None yet! +{% endif %} +<br /> +<div class="col_title">Latest knowledge commits</div> {% if latest_knowledge %} {% include "newknowldge_table" %} {% else %} @@ -46,6 +53,7 @@ None yet! <div class="col_center"> <div class="col_title">Latest comments</div> {% if latest_comments %} +{% include "newcomments_table" %} {% else %} None yet! {% endif %} diff --git a/bn_django/templates/newcomments_table b/bn_django/templates/newcomments_table new file mode 100644 index 0000000..6c38d10 --- /dev/null +++ b/bn_django/templates/newcomments_table @@ -0,0 +1,26 @@ +<table class="listing"> +{% for c in latest_comments %} +<tr> + <td class="date"> + {{ c.submit_date|date:"F jS" }}</td> + <td class="description"> + {% if c.user.username %}{{ c.user.username }} + {% else %}anonymous{% endif%} </td> + <td class="description"> + <a href="{{c.get_content_object.get_absolute_url}}"> + {{ c.content_type.name }}</a></td> + </tr> +{% endfor %} +{% for c in latest_freecomments %} +<tr> + <td class="date"> + {{ c.submit_date|date:"F jS" }}</td> + <td class="description"> + {% if c.person_name %}{{c.person_name}}{% else %}anonymous{% endif %} + </td> + <td class="description"> + <a href="{{c.get_content_object.get_absolute_url}}"> + {{ c.content_type.name }}</a></td> + </tr> +{% endfor %} +</table> diff --git a/bn_django/urls.py b/bn_django/urls.py index 425066b..eaf991e 100644 --- a/bn_django/urls.py +++ b/bn_django/urls.py @@ -1,5 +1,6 @@ from django.conf.urls.defaults import * from photos.models import Photo +from django.contrib.comments.models import Comment,FreeComment import git_wiki.models urlpatterns = patterns('', @@ -9,7 +10,11 @@ urlpatterns = patterns('', {'template': 'frontpage.html','extra_context':dict({ \ 'latest_photos':Photo.objects.order_by('date')[:2], \ #'latest_comments':Photo.objects.order_by('date')[:4] \ - 'latest_knowledge':git_wiki.models.shortlog() \ + 'latest_knowledge':git_wiki.models.shortlog(), \ + 'latest_comments':Comment.objects.order_by('-submit_date')[:4], \ + 'latest_freecomments': \ + FreeComment.objects.order_by('-submit_date')[:4], \ + 'newitems':git_wiki.models.newest_items(), \ })}), (r'^about/$', 'django.views.generic.simple.direct_to_template', {'template': 'about.html'}), |