X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/e5ba4e015ad743e8581275272c61a660f32d9fed..ec8cad46977a27be477df04381deb4079fb87579:/apps/wiki/views.py diff --git a/apps/wiki/views.py b/apps/wiki/views.py index d99bca61..4b825e5e 100644 --- a/apps/wiki/views.py +++ b/apps/wiki/views.py @@ -9,6 +9,7 @@ from django.http import Http404, HttpResponseForbidden from django.middleware.gzip import GZipMiddleware from django.utils.decorators import decorator_from_middleware from django.utils.encoding import smart_unicode +from django.utils.formats import localize from django.utils.translation import ugettext as _ from django.views.decorators.http import require_POST, require_GET from django.views.generic.simple import direct_to_template @@ -68,6 +69,7 @@ def editor(request, slug, chunk=None, template_name='wiki/document_details.html' "text_revert": forms.DocumentTextRevertForm(prefix="textrevert"), "pubmark": forms.DocumentPubmarkForm(prefix="pubmark"), }, + 'can_pubmark': request.user.has_perm('catalogue.can_pubmark'), 'REDMINE_URL': settings.REDMINE_URL, }) @@ -124,6 +126,8 @@ def text(request, chunk_id): parent = None stage = form.cleaned_data['stage_completed'] tags = [stage] if stage else [] + publishable = (form.cleaned_data['publishable'] and + request.user.has_perm('catalogue.can_pubmark')) doc.commit(author=author, text=text, parent=parent, @@ -131,6 +135,7 @@ def text(request, chunk_id): tags=tags, author_name=form.cleaned_data['author_name'], author_email=form.cleaned_data['author_email'], + publishable=publishable, ) revision = doc.revision() return JSONResponse({ @@ -197,12 +202,12 @@ def gallery(request, directory): try: base_url = ''.join(( smart_unicode(settings.MEDIA_URL), - smart_unicode(settings.FILEBROWSER_DIRECTORY), + smart_unicode(settings.IMAGE_DIR), smart_unicode(directory))) base_dir = os.path.join( smart_unicode(settings.MEDIA_ROOT), - smart_unicode(settings.FILEBROWSER_DIRECTORY), + smart_unicode(settings.IMAGE_DIR), smart_unicode(directory)) def map_to_url(filename): @@ -270,7 +275,7 @@ def history(request, chunk_id): "version": change.revision, "description": change.description, "author": change.author_str(), - "date": change.created_at, + "date": localize(change.created_at), "publishable": _("Publishable") + "\n" if change.publishable else "", "tag": ',\n'.join(unicode(tag) for tag in change.tags.all()), })