diff options
-rw-r--r-- | bn_django/git_wiki/models.py | 2 | ||||
-rw-r--r-- | bn_django/git_wiki/templates/git_wiki/newitems_table | 18 | ||||
-rw-r--r-- | bn_django/git_wiki/templates/git_wiki/tree_table | 11 | ||||
-rw-r--r-- | bn_django/git_wiki/urls.py | 8 |
4 files changed, 28 insertions, 11 deletions
diff --git a/bn_django/git_wiki/models.py b/bn_django/git_wiki/models.py index f320984..3023500 100644 --- a/bn_django/git_wiki/models.py +++ b/bn_django/git_wiki/models.py @@ -222,7 +222,7 @@ def reposcan(): def newest_items(): num = Item.objects.count() - min = num-7 + min = num-6 if min < 0: min = 0 return Item.objects.all()[min:num] diff --git a/bn_django/git_wiki/templates/git_wiki/newitems_table b/bn_django/git_wiki/templates/git_wiki/newitems_table index d86c538..e072a10 100644 --- a/bn_django/git_wiki/templates/git_wiki/newitems_table +++ b/bn_django/git_wiki/templates/git_wiki/newitems_table @@ -3,11 +3,19 @@ {% 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> + {% if i.isfig %} + <a href='/k/{{ i.slug }}' class="item"> + {{i.path}}</a> + </td><td type="links"> + <a href='/k/{{ i.slug }}'>download</a> + {% else %} + <a href='/k/{{ i.slug }}' class="item"> + {{i.path}}</a> + </td><td type="links"> + <a href='/k/{{ i.slug }}/pdf/'>pdf</a> + <a href='/k/{{ i.slug }}/latex/'>latex</a> + <a href='/k/{{ i.slug }}/raw/'>raw</a> + {% endif %} {% else %} {% ifequal i.type 'tree' %} <a href='/k/{{ i.slug }}/' class="tree"> {{i.path}}/</a> diff --git a/bn_django/git_wiki/templates/git_wiki/tree_table b/bn_django/git_wiki/templates/git_wiki/tree_table index c1f9a82..2f638ef 100644 --- a/bn_django/git_wiki/templates/git_wiki/tree_table +++ b/bn_django/git_wiki/templates/git_wiki/tree_table @@ -5,12 +5,15 @@ {{o.type}}</td> <td class="filename"> {% ifequal o.type 'blob' %} - <a href='/k/{{ o.slug }}/' class="item"> - {{o.path}}</a> - </td><td type="links"> {% if o.isfig %} - <a href='/k/{{ o.slug }}'>download</a> + <a href='/k/{{ o.slug }}' class="item"> + {{o.path}}</a> + </td><td type="links"> + <a href='/k/{{ o.slug }}/download/'>download</a> {% else %} + <a href='/k/{{ o.slug }}/' class="item"> + {{o.path}}</a> + </td><td type="links"> <a href='/k/{{ o.slug }}/pdf/'>pdf</a> <a href='/k/{{ o.slug }}/latex/'>latex</a> <a href='/k/{{ o.slug }}/raw/'>raw</a> diff --git a/bn_django/git_wiki/urls.py b/bn_django/git_wiki/urls.py index 2570f05..3489941 100644 --- a/bn_django/git_wiki/urls.py +++ b/bn_django/git_wiki/urls.py @@ -18,12 +18,18 @@ urlpatterns = patterns('bn_django.git_wiki.views', (r'^commit/(?P<hash>[0-9a-z]{40})/$', 'view_commit',), (r'^(?P<reqslug>[\w\-\_\/]*)/log/$', 'tree',), (r'^(?P<reqslug>[\w\-\_\/]*)/edit/$', 'tree',), - (r'^(?P<reqslug>[\w\-\_\/]*)/pdf/$', 'tree',), + (r'^(?P<reqslug>[\w\-\_\/]*)/pdf/$', 'latexitem',), (r'^(?P<reqslug>[\w\-\_\/]*)/raw/$', 'rawitem',), (r'^(?P<reqslug>[\w\-\_\/]*)/latex/$', 'latexitem',), (r'^(?P<reqslug>[\w\-\_\/]*\.png/?)$', 'figure',), (r'^(?P<reqslug>[\w\-\_\/]*\.gif/?)$', 'figure',), (r'^(?P<reqslug>[\w\-\_\/]*\.jpg/?)$', 'figure',), (r'^(?P<reqslug>[\w\-\_\/]*\.jpeg/?)$', 'figure',), + (r'^(?P<reqslug>[\w\-\_\/]*\.svg/?)$', 'figure',), + (r'^(?P<reqslug>[\w\-\_\/]*\.png)/download/$', 'figure',{'download':True}), + (r'^(?P<reqslug>[\w\-\_\/]*\.gif)/download/$', 'figure',{'download':True}), + (r'^(?P<reqslug>[\w\-\_\/]*\.jpg)/download/$', 'figure',{'download':True}), + (r'^(?P<reqslug>[\w\-\_\/]*\.jpeg)/download/$','figure',{'download':True}), + (r'^(?P<reqslug>[\w\-\_\/]*\.svg)/download/$', 'figure',{'download':True}), (r'^(?P<reqslug>[\w\-\_\/]*)$', 'tree',), ) |