From: Radek Czajka Date: Thu, 7 Mar 2013 12:11:39 +0000 (+0100) Subject: add breadcrumbs to fileupload, X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/babe7f68fcbb8f7e73f9b62d611715ca28b4c4e6 add breadcrumbs to fileupload, basic support for browsing directories, minor fixes. --- diff --git a/apps/apiclient/urls.py b/apps/apiclient/urls.py index 87d9997d..55cc4669 100755 --- a/apps/apiclient/urls.py +++ b/apps/apiclient/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls.defaults import * +from django.conf.urls import patterns, url urlpatterns = patterns('apiclient.views', url(r'^oauth/$', 'oauth', name='apiclient_oauth'), diff --git a/apps/catalogue/urls.py b/apps/catalogue/urls.py index feebb3ec..e72b88db 100644 --- a/apps/catalogue/urls.py +++ b/apps/catalogue/urls.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -from django.conf.urls.defaults import * +from django.conf.urls import patterns, url from django.contrib.auth.decorators import permission_required from django.views.generic import RedirectView from catalogue.feeds import PublishTrackFeed diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index a3978304..e09940d6 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -479,6 +479,12 @@ class GalleryView(UploadView): def get_object(self, request, slug): return get_object_or_404(Book, slug=slug) + def breadcrumbs(self): + return [ + (_('books'), reverse('catalogue_document_list')), + (self.object.title, self.object.get_absolute_url()), + (_('scan gallery'),), + ] + def get_directory(self): return "%s%s/" % (settings.IMAGE_DIR, self.object.gallery) - diff --git a/apps/cover/urls.py b/apps/cover/urls.py index 2337d47a..f1a48d35 100644 --- a/apps/cover/urls.py +++ b/apps/cover/urls.py @@ -3,7 +3,7 @@ # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # -from django.conf.urls.defaults import patterns, url +from django.conf.urls import patterns, url urlpatterns = patterns('cover.views', diff --git a/apps/fileupload/forms.py b/apps/fileupload/forms.py index b29d318e..f5e10699 100644 --- a/apps/fileupload/forms.py +++ b/apps/fileupload/forms.py @@ -1,4 +1,4 @@ from django import forms class UploadForm(forms.Form): - file = forms.FileField() + files = forms.FileField() diff --git a/apps/fileupload/static/fileupload/css/bootstrap.min.css b/apps/fileupload/static/fileupload/css/bootstrap.min.css index 4bb154d7..99995247 100644 --- a/apps/fileupload/static/fileupload/css/bootstrap.min.css +++ b/apps/fileupload/static/fileupload/css/bootstrap.min.css @@ -19,8 +19,6 @@ textarea{overflow:auto;vertical-align:top;} .clearfix:after{clear:both;} .hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;} .input-block-level{display:block;width:100%;min-height:28px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;} -a{color:#0088cc;text-decoration:none;} -a:hover{color:#005580;text-decoration:underline;} .row{margin-left:-20px;*zoom:1;} .row:before,.row:after{display:table;content:"";} .row:after{clear:both;} diff --git a/apps/fileupload/static/fileupload/css/style.css b/apps/fileupload/static/fileupload/css/style.css index 3c9bfff7..e45d81dc 100644 --- a/apps/fileupload/static/fileupload/css/style.css +++ b/apps/fileupload/static/fileupload/css/style.css @@ -1,3 +1,10 @@ .preview img { max-height: 50px; } + +.delete button[data-type=""] { + display: none; +} +.delete button[data-type=""] + input { + display: none; +} diff --git a/apps/fileupload/templates/fileupload/picture_form.html b/apps/fileupload/templates/fileupload/picture_form.html index 52ac3cc2..ce23179f 100644 --- a/apps/fileupload/templates/fileupload/picture_form.html +++ b/apps/fileupload/templates/fileupload/picture_form.html @@ -14,8 +14,17 @@ {% block content %} -

{% trans "Gallery for:" %} {{ view.object }}

- +

+{% trans "Browse:" %} +{% for crumb in view.breadcrumbs %} + {% if crumb.1 %} + {{ crumb.0 }} + {% else %} + {{ crumb.0 }} + {% endif %} + {% if not forloop.last %}/{% endif %} +{% endfor %} +

{% csrf_token %} @@ -24,7 +33,7 @@ {% trans "Add files..." %} - +