aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bn_django/git_wiki/models.py12
-rw-r--r--bn_django/git_wiki/settings.py3
-rw-r--r--bn_django/templates/frontpage.html1
-rw-r--r--bn_django/templates/newknowldge_table13
-rw-r--r--bn_django/urls.py5
-rw-r--r--static/style/default.css12
6 files changed, 37 insertions, 9 deletions
diff --git a/bn_django/git_wiki/models.py b/bn_django/git_wiki/models.py
index ae9ef79..060e9d5 100644
--- a/bn_django/git_wiki/models.py
+++ b/bn_django/git_wiki/models.py
@@ -150,10 +150,10 @@ def fromslug(reqslug):
import commands
if reqslug == '' or reqslug == '/':
- f = open(GITWIKI_BASE + '/HEAD','r')
+ f = open(GITWIKI_DIR + '/HEAD','r')
head = f.readline().strip().split()[1]
f.close()
- f = open(GITWIKI_BASE + '/'+head,'r')
+ f = open(GITWIKI_DIR + '/'+head,'r')
hash = f.readline().strip()
f.close()
ret = Tree(id=hash)
@@ -198,13 +198,13 @@ def fromslug(reqslug):
def reposcan():
import os
heads = dict()
- for h in os.listdir(GITWIKI_BASE + '/refs/heads/'):
- f = open(GITWIKI_BASE + '/refs/heads/' + h,'r')
+ for h in os.listdir(GITWIKI_DIR + '/refs/heads/'):
+ f = open(GITWIKI_DIR + '/refs/heads/' + h,'r')
heads[h.strip()] = f.readline().strip()
f.close()
tags = dict()
- for t in os.listdir(GITWIKI_BASE + '/refs/tags/'):
- f = open(GITWIKI_BASE + '/refs/tags/' + t,'r')
+ for t in os.listdir(GITWIKI_DIR + '/refs/tags/'):
+ f = open(GITWIKI_DIR + '/refs/tags/' + t,'r')
tags[t.strip()] = f.readline().strip()
f.close()
return (heads, tags)
diff --git a/bn_django/git_wiki/settings.py b/bn_django/git_wiki/settings.py
index ed07f53..965ac26 100644
--- a/bn_django/git_wiki/settings.py
+++ b/bn_django/git_wiki/settings.py
@@ -9,5 +9,6 @@ GITWIKI_NAME = ''
# fill path to the git command
GITCOMMAND = '/usr/local/bin/git'
+GITWIKI_DIR = str(GITWIKI_BASE) + '/' + str(GITWIKI_NAME) + '.git'
GITPREFIX = 'cd ' +str(GITWIKI_BASE) + '; ' + str(GITCOMMAND) + ' --git-dir=' \
- + str(GITWIKI_BASE) + '/' + GITWIKI_NAME + '.git'
+ + str(GITWIKI_DIR)
diff --git a/bn_django/templates/frontpage.html b/bn_django/templates/frontpage.html
index dc3f450..d3eed9d 100644
--- a/bn_django/templates/frontpage.html
+++ b/bn_django/templates/frontpage.html
@@ -39,6 +39,7 @@ For more recent content see the <a href="/timeline/">timeline</a>
<div class="col_right">
<div class="col_title">Latest knowledge</div>
{% if latest_knowledge %}
+{% include "newknowldge_table" %}
{% else %}
None yet!
<br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
diff --git a/bn_django/templates/newknowldge_table b/bn_django/templates/newknowldge_table
new file mode 100644
index 0000000..686a12f
--- /dev/null
+++ b/bn_django/templates/newknowldge_table
@@ -0,0 +1,13 @@
+{% if latest_knowledge %}
+<table class="listing">
+{% for l in latest_knowledge %}
+<tr>
+ <td class="date">
+ {{ l.date }}</td>
+ <td class="description">
+ <a href="/k/commit/{{ l.hash }}/" class="description">
+ {{ l.description|truncatewords:6 }}</a></td>
+ </tr>
+{% endfor %}
+</table>
+{% else %}No shortlog!{% endif %}
diff --git a/bn_django/urls.py b/bn_django/urls.py
index 2d833be..c413f39 100644
--- a/bn_django/urls.py
+++ b/bn_django/urls.py
@@ -1,13 +1,14 @@
from django.conf.urls.defaults import *
from photos.models import Photo
+import git_wiki.models
urlpatterns = patterns('',
# Example:
# (r'^bn_django/', include('bn_django.foo.urls')),
(r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'frontpage.html','extra_context':dict({ \
- 'latest_photos':Photo.objects.order_by('date')[:2] \
+ 'latest_photos':Photo.objects.order_by('date')[:2], \
#'latest_comments':Photo.objects.order_by('date')[:4] \
- #'latest_knowledge':Photo.objects.order_by('date')[:4] \
+ 'latest_knowledge':git_wiki.models.shortlog() \
})}),
(r'^about/$', 'django.views.generic.simple.direct_to_template', {'template': 'about.html'}),
(r'^credits/$', 'django.views.generic.simple.direct_to_template', {'template': 'credits.html'}),
diff --git a/static/style/default.css b/static/style/default.css
index 35373c7..d6f93e4 100644
--- a/static/style/default.css
+++ b/static/style/default.css
@@ -189,6 +189,18 @@ pre.large {
.photo_thumb {
width: 160px;
height: 180px; }
+table.listing {
+ width: 100%;
+ border-spacing: 0px;
+ font-size: 11px; }
+table.listing tr {
+ width: 100%; }
+table.listing td.date {
+ font-style: italic;
+ width: 75px;
+ overflow: hidden; }
+table.listing td.description {
+ overflow: hidden; }
#commentary {
background-color: #a9afdc;