From 34ce40fdb73eda0ae07ef62ddc713a4651b9bc7c Mon Sep 17 00:00:00 2001 From: bnewbold Date: Wed, 21 Feb 2007 01:06:47 -0800 Subject: created skeleton for git_wiki app --- bn_django/git_wiki/settings.py | 7 +++ bn_django/git_wiki/templates/git_wiki/base.html | 39 ++++++++++++ .../git_wiki/templates/git_wiki/frontpage.html | 36 +++++++++++ bn_django/git_wiki/urls.py | 26 ++++++++ bn_django/git_wiki/views.py | 42 +++++++++++++ bn_django/urls.py | 3 +- static/style/git_wiki.css | 69 ++++++++++++++++++++++ 7 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 bn_django/git_wiki/settings.py create mode 100644 bn_django/git_wiki/templates/git_wiki/base.html create mode 100644 bn_django/git_wiki/templates/git_wiki/frontpage.html create mode 100644 bn_django/git_wiki/urls.py create mode 100644 static/style/git_wiki.css diff --git a/bn_django/git_wiki/settings.py b/bn_django/git_wiki/settings.py new file mode 100644 index 0000000..bb81610 --- /dev/null +++ b/bn_django/git_wiki/settings.py @@ -0,0 +1,7 @@ + +# full path to directory holding the wiki repository (or sys links to +# the repositories) +GITWIKI_BASE = '/home/bnewbold/knowledge/' + +# fill path to the git command +GITCOMMAND = '/usr/local/bin/git' diff --git a/bn_django/git_wiki/templates/git_wiki/base.html b/bn_django/git_wiki/templates/git_wiki/base.html new file mode 100644 index 0000000..6107c04 --- /dev/null +++ b/bn_django/git_wiki/templates/git_wiki/base.html @@ -0,0 +1,39 @@ +{% extends "base.html" %} + +{% block stylesheets %} +{{ block.super }} + + + + +{% endblock %} + +{% block path %} +{{ block.super }} +knowledge +{% if item %} + » {{ object.title }} +{% endif %} +{% endblock %} + +{% block title %} +{% if item %} +{{ item.title }} +{% endif %} +{% endblock %} + +{% block content %} +{% if item %} + {% block gitwiki %} + {% endblock %} +
+ + pdf - log + +
+{% else %} +

No such knowledge!

+

Perhaps you meant...

+{% endif %} + +{% endblock %} diff --git a/bn_django/git_wiki/templates/git_wiki/frontpage.html b/bn_django/git_wiki/templates/git_wiki/frontpage.html new file mode 100644 index 0000000..897bf8b --- /dev/null +++ b/bn_django/git_wiki/templates/git_wiki/frontpage.html @@ -0,0 +1,36 @@ +{% extends "git_wiki/base.html" %} + +{% block title %}Knowledge Repository{% endblock %} + +{% block right_stuff %} +
+Get some knowledge:
+   - wikipedia
+   - internet archive
+   - mathworld +{% endblock %} + +{% block content %} +
+
This site is under active development!
+

There are undoubtedly bugs, errors, aesthetic travesties, ommissions, etc. +If you're curious you can track my work in the code section. +

+ +
+For more recent content see the timeline +
+ +

Latest knowledge

+{% if latest_knowledge %} +{% else %} +None yet! +{% endif %} +
+

Latest comments

+{% if latest_comments %} +{% else %} +None yet! +{% endif %} + +{% endblock %} diff --git a/bn_django/git_wiki/urls.py b/bn_django/git_wiki/urls.py new file mode 100644 index 0000000..98cedc4 --- /dev/null +++ b/bn_django/git_wiki/urls.py @@ -0,0 +1,26 @@ +from django.conf.urls.defaults import * +from django.conf import settings + +from models import * + +try: + GITWIKI_BASE = settings.GITWIKI_BASE +except AttributeError: + GITWIKI_BASE='/home/usr/doc/' + +try: + ADMIN_URL = settings.ADMIN_URL +except AttributeError: + ADMIN_URL='/admin' +if ADMIN_URL[-1] == '/': + ADMIN_URL=ADMIN_URL[:-1] + +info_dict = { 'extra_context': { 'admin_url': ADMIN_URL, + } } + +urlpatterns = patterns('bn_django.git_wiki.views', + (r'^(?P[0-9a-z]{40})/$', 'olditem',), + (r'^(?P.+)/$', 'item',), + (r'^(?P.+)/log/$', 'item',), + (r'^(?P.+)/edit/$', 'item',) +) diff --git a/bn_django/git_wiki/views.py b/bn_django/git_wiki/views.py index 60f00ef..d9ce15f 100644 --- a/bn_django/git_wiki/views.py +++ b/bn_django/git_wiki/views.py @@ -1 +1,43 @@ +import settings +from django import forms, http, template +from django.contrib.auth.decorators import login_required +from django.shortcuts import get_object_or_404, render_to_response +from django.http import HttpResponse + +import os, commands + +from models import * + +try: + GITWIKI_BASE = settings.GITWIKI_BASE+'/' +except AttributeError: + GITWIKI_BASE='/home/' + +try: + GITCOMMAND = settings.GITCOMMAND +except AttributeError: + GITCOMMAND='git' + + # Create your views here. + +def frontpage(request): + + return render_to_response('git_wiki/frontpage.html', \ + dict()) + +def item(request, req=''): + #GITPREFIX = models.getGITPREFIX() + #i = Item() + #i.update() + + return render_to_response('git_browse/item.html', + dict(item=i)) + +def olditem(request, hash): + #GITPREFIX = models.getGITPREFIX() + #i = Item() + #i.update() + + return render_to_response('git_browse/olditem.html', + dict(item=i)) diff --git a/bn_django/urls.py b/bn_django/urls.py index 1993f26..59c7b0a 100644 --- a/bn_django/urls.py +++ b/bn_django/urls.py @@ -14,7 +14,8 @@ urlpatterns = patterns('', (r'^copyright/$', 'django.views.generic.simple.direct_to_template', {'template': 'copyright.html'}), - (r'^knowledge/', include('bn_django.git_wiki.urls')), + (r'^knowledge/', 'bn_django.git_wiki.views.frontpage',), + (r'^k/$', 'bn_django.git_wiki.views.frontpage',), (r'^k/', include('bn_django.git_wiki.urls')), (r'^code/', include('bn_django.git_browse.urls')), (r'^photos/', include('bn_django.photos.urls')), diff --git a/static/style/git_wiki.css b/static/style/git_wiki.css new file mode 100644 index 0000000..7fc04e8 --- /dev/null +++ b/static/style/git_wiki.css @@ -0,0 +1,69 @@ +pre.large { + font-family: courier; + margin: 10px; + padding: 6px; + border: 1px solid black; + background-color: #F2D1D1; + overflow: auto; } + +table.gitbrowser { + width: 100%; + border-spacing: 0px; + font-size: 11px; } +table.gitbrowser tr { + width: 100%; + background-color: #EEEEEE; } +td.head { + font-weight: bold; + padding-left: 13px; + width: 130px; + overflow: hidden; } +td.links { + width: 90px; + overflow: hidden; } +td.objtype { + width: 35px; + font-style: italic; } +td.filemode { + width: 55px; + font-family: courier; } +td.filename { + width: 450px; } +td.filename a.tree { + font-weight: bold; } +td.filename a.blob { + font-weight: normal; } +td.tag { + font-weight: bold; + padding-left: 13px; + width: 130px; + overflow: hidden; } +td.date { + font-style: italic; + width: 90px; + overflow: hidden; } +td.author { + font-style: italic; + width: 100px; + overflow: hidden; } +td.description { + overflow: hidden; } +td.shorthash { + width: 60px; + overflow: hidden; + text-align: right; + font-family: courier; } +td.hash { + width: 100px; + overflow: hidden; + text-align: right; + font-family: courier; } + +span.hash { + font-family: courier; } + + +a.head { + color: green; } +a.tag { + color: yellow; } -- cgit v1.2.3