From de7fbaadb211650a73c68509f8b87cb93effdd2a Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sun, 18 Feb 2007 18:47:15 -0800 Subject: removed knowledge directory, filled in front page, continued git_browse --- .../templates/git_browse/repository_info.html | 5 +- .../templates/git_browse/repository_list.html | 7 +- .../git_browse/templates/git_browse/tree.html | 12 ++- bn_django/git_browse/urls.py | 3 +- bn_django/git_browse/views.py | 15 ++- bn_django/templates/base.html | 3 +- bn_django/templates/frontpage.html | 119 +++++++++------------ bn_django/urls.py | 13 ++- 8 files changed, 98 insertions(+), 79 deletions(-) (limited to 'bn_django') diff --git a/bn_django/git_browse/templates/git_browse/repository_info.html b/bn_django/git_browse/templates/git_browse/repository_info.html index bec150c..72f30b1 100644 --- a/bn_django/git_browse/templates/git_browse/repository_info.html +++ b/bn_django/git_browse/templates/git_browse/repository_info.html @@ -1,8 +1,11 @@ {% extends "git_browse/base.html" %} {% block gitbrowse %} +{{ object.description }} {% if shortlog %} -

Shortlog

+

Shortlog (full log)

{{ shortlog }}
+

Filelist (browse)

+
{{ filelist }}
{% endif %} {% endblock %} diff --git a/bn_django/git_browse/templates/git_browse/repository_list.html b/bn_django/git_browse/templates/git_browse/repository_list.html index a089fec..106c0e8 100644 --- a/bn_django/git_browse/templates/git_browse/repository_list.html +++ b/bn_django/git_browse/templates/git_browse/repository_list.html @@ -5,11 +5,14 @@ {% block title %}Code Repositories{% endblock %} {% block content %} +
+Until this is better developed I would recommend trying gitweb. +
{% if object_list %} {% for item in object_list %}

- tree - - changelog + browse - + changelog

{{ item.name }} (aka {{ item.slug }})

{{ item.description }} diff --git a/bn_django/git_browse/templates/git_browse/tree.html b/bn_django/git_browse/templates/git_browse/tree.html index 22162da..046d85c 100644 --- a/bn_django/git_browse/templates/git_browse/tree.html +++ b/bn_django/git_browse/templates/git_browse/tree.html @@ -1,10 +1,20 @@ {% extends "git_browse/base.html" %} {% block gitbrowse %} + {% if all_objs %} +

Tree sha1 hash:


{{ hash }}

Directory listing:

{% for obj in all_objs %} -[{{obj.type}}] {{obj.name}}
+[{{obj.type}}] + {% ifequal obj.type 'blob'%} + {{obj.name}} {% else %} + {% ifequal obj.type 'tree'%} + {{obj.name}} + {% else %} + {{obj.name}} + {% endifequal %}{% endifequal %} +
{% endfor %} {% endif %} {% endblock %} diff --git a/bn_django/git_browse/urls.py b/bn_django/git_browse/urls.py index 91e9baa..909bfcd 100644 --- a/bn_django/git_browse/urls.py +++ b/bn_django/git_browse/urls.py @@ -36,5 +36,6 @@ urlpatterns += patterns('bn_django.git_browse.views', (r'^(?P[\w\-\_]*)/branches/$', 'view_branches',), (r'^(?P[\w\-\_]*)/history/$', 'view_history',), (r'^(?P[\w\-\_]*)/log/$', 'view_log',), - (r'^(?P[\w\-\_]*)/obj/(?P[0-9a-z]*)/$', 'view_obj',), + (r'^(?P[\w\-\_]*)/obj/(?P[0-9a-z]{40})/$', 'view_obj',), + (r'^(?P[\w\-\_]*)/tree/(?P[0-9a-z]{40})/$', 'view_tree',), ) diff --git a/bn_django/git_browse/views.py b/bn_django/git_browse/views.py index 9e3ba90..c8a7a40 100644 --- a/bn_django/git_browse/views.py +++ b/bn_django/git_browse/views.py @@ -27,20 +27,24 @@ def repo_info(request, repo,branch=None): GITPREFIX = 'cd ' + GITBROWSE_BASE + therepo.slug + '; ' + GITCOMMAND + ' --git-dir=' + GITBROWSE_BASE + therepo.slug + '/.git ' shortlog = commands.getoutput(GITPREFIX + ' log | ' + GITCOMMAND + '-shortlog') + filelist = commands.getoutput(GITPREFIX + ' ls-files') return render_to_response('git_browse/repository_info.html', dict(object=therepo, + filelist=filelist, shortlog=shortlog,)) -def view_tree(request, repo, tree_hash=None,branch=None): +def view_tree(request, repo, hash=None,branch=None): therepo = get_object_or_404(Repository, slug=repo) GITPREFIX = 'cd ' + GITBROWSE_BASE + therepo.slug + '; ' + GITCOMMAND + ' --git-dir=' + GITBROWSE_BASE + therepo.slug + '/.git ' - head_ref = commands.getoutput('cd ' + GITBROWSE_BASE + therepo.slug +'/.git; cat HEAD') - head_ref = head_ref.split()[1] - head = commands.getoutput('cd ' + GITBROWSE_BASE + therepo.slug +'/.git; cat ' + head_ref) - tree_ls = commands.getoutput(GITPREFIX + ' ls-tree ' + head) + if(hash == None): + head_ref = commands.getoutput('cd ' + GITBROWSE_BASE + therepo.slug +'/.git; cat HEAD') + head_ref = head_ref.split()[1] + hash = commands.getoutput('cd ' + GITBROWSE_BASE + therepo.slug +'/.git; cat ' + head_ref) + + tree_ls = commands.getoutput(GITPREFIX + ' ls-tree ' + hash) tree_objs = list() blob_objs = list() for line in tree_ls.splitlines(): @@ -56,6 +60,7 @@ def view_tree(request, repo, tree_hash=None,branch=None): dict(object=therepo, blob_objs=blob_objs, tree_objs=tree_objs, + hash=hash, all_objs=tree_objs+blob_objs,)) def view_log(request, repo, tree_hash=None, branch=None): diff --git a/bn_django/templates/base.html b/bn_django/templates/base.html index cee3641..63bdbda 100644 --- a/bn_django/templates/base.html +++ b/bn_django/templates/base.html @@ -20,7 +20,8 @@

- + +
style options # # # #
diff --git a/bn_django/templates/frontpage.html b/bn_django/templates/frontpage.html index d73070e..9dacccd 100644 --- a/bn_django/templates/frontpage.html +++ b/bn_django/templates/frontpage.html @@ -5,82 +5,69 @@ {% block title %}A Brave New Bold World!{% endblock %} {% block right_stuff %} +
Other sites:
  - athena locker
-   - git repository +   - git repository {% endblock %} {% block content %} - There will be more forthcoming ... - There will be more stuff forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... +
+
This site is under active development!
+

There are undoubtedly bugs, errors, aesthetic travesties, ommissions, etc (notably the knowledge section isn't anything yet). +If you're curious you can track my work in the code section. +

In the meanwhile you can get your bryan newbold fix at my old site. +

+

Where am I?

+For 2007 i'm taking a year break from MIT... + + +as of February i'm living in Seattle working at Azalea Software doing tech work. Starting in mid-May i'll be working at the Moss Landing Marine Labs in California, followed in October by field work in Antartica. I will be back at MIT for the spring 2008 semester. +
- There will be more forthcoming ... - There will be more stuff forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - -
-what if i put more content over here? also, will it wrap correctly? +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 %} +
+ +
+
Latest photos
+{% if latest_photos %} +
+{% for photo in latest_photos %} + +
+{% endfor %}
+{% else %} +

None yet! +








+{% endif %}
-
- There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more stuff forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more stuff forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... - There will be more forthcoming ... +



+












{% endblock %} diff --git a/bn_django/urls.py b/bn_django/urls.py index 327e9ec..1993f26 100644 --- a/bn_django/urls.py +++ b/bn_django/urls.py @@ -1,21 +1,30 @@ from django.conf.urls.defaults import * +from photos.models import Photo urlpatterns = patterns('', # Example: # (r'^bn_django/', include('bn_django.foo.urls')), - (r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'frontpage.html'}), + (r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'frontpage.html','extra_context':dict({ \ + 'latest_photos':Photo.objects.order_by('date')[:2] \ + #'latest_comments':Photo.objects.order_by('date')[:4] \ + #'latest_knowledge':Photo.objects.order_by('date')[:4] \ + })}), (r'^about/$', 'django.views.generic.simple.direct_to_template', {'template': 'about.html'}), (r'^credits/$', 'django.views.generic.simple.direct_to_template', {'template': 'credits.html'}), (r'^copyright/$', 'django.views.generic.simple.direct_to_template', {'template': 'copyright.html'}), (r'^knowledge/', include('bn_django.git_wiki.urls')), + (r'^k/', include('bn_django.git_wiki.urls')), (r'^code/', include('bn_django.git_browse.urls')), (r'^photos/', include('bn_django.photos.urls')), + + (r'^search/', include('bn_django.search.urls')), # Uncomment this for admin: (r'^admin/', include('django.contrib.admin.urls')), - (r'^static/(?P.*)$', 'django.views.static.serve', {'document_root': '/home/bnewbold/bn-project/static', 'show_indexes': True}), + + (r'^static/(?P.*)$', 'django.views.static.serve', {'document_root': '/home/bnewbold/bn-project/static', 'show_indexes': True}), (r'^style/(?P.*)$', 'django.views.static.serve', {'document_root': '/home/bnewbold/bn-project/static/style'}), (r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': '/home/bnewbold/bn-project/media'}), ) -- cgit v1.2.3