From: Christopher Allan Webber Date: Mon, 29 Aug 2011 03:05:54 +0000 (-0500) Subject: Merge remote branch 'remotes/jwandborg/f403_ability_to_delete' X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7dc3a66f924c734cbee68677e84f5b656eefe280;p=mediagoblin.git Merge remote branch 'remotes/jwandborg/f403_ability_to_delete' Conflicts: mediagoblin/edit/views.py mediagoblin/templates/mediagoblin/user_pages/media.html mediagoblin/user_pages/routing.py --- 7dc3a66f924c734cbee68677e84f5b656eefe280 diff --cc mediagoblin/edit/views.py index b0145a04,2a835816..f766afdc --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@@ -64,23 -54,17 +65,23 @@@ def edit_media(request, media) form.slug.errors.append( _(u'An entry with that slug already exists for this user.')) else: - media['title'] = request.POST['title'] - media['description'] = request.POST.get('description') + media['title'] = unicode(request.POST['title']) + media['description'] = unicode(request.POST.get('description')) media['tags'] = convert_to_tag_list_of_dicts( request.POST.get('tags')) - + media['description_html'] = cleaned_markdown_conversion( media['description']) + if 'attachment_name' in request.POST: + media['attachment_files'][0]['name'] = \ + request.POST['attachment_name'] + + if 'attachment_delete' in request.POST \ + and 'y' == request.POST['attachment_delete']: + del media['attachment_files'][0] + - media['slug'] = request.POST['slug'] + media['slug'] = unicode(request.POST['slug']) - task_id = unicode(uuid.uuid4()) - media['queued_task_id'] = task_id media.save() return redirect(request, "mediagoblin.user_pages.media_home", @@@ -167,12 -101,12 +168,12 @@@ def edit_profile(request) user = request.user form = forms.EditProfileForm(request.POST, - url = user.get('url'), - bio = user.get('bio')) + url=user.get('url'), + bio=user.get('bio')) if request.method == 'POST' and form.validate(): - user['url'] = request.POST['url'] - user['bio'] = request.POST['bio'] + user['url'] = unicode(request.POST['url']) + user['bio'] = unicode(request.POST['bio']) user['bio_html'] = cleaned_markdown_conversion(user['bio']) diff --cc mediagoblin/templates/mediagoblin/user_pages/media.html index 0425500e,c80144aa..fe953e77 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@@ -116,45 -116,24 +116,48 @@@
{% include "mediagoblin/utils/prev_next.html" %} - {% if media['uploader'] == request.user['_id'] or - request.user['is_admin'] %} -

Temporary button holder

-

- edit -

-

- {% trans %}delete{% endtrans %} -

- {% endif %} + + {% if media['uploader'] == request.user['_id'] or + request.user['is_admin'] %} +

Temporary button holder

+

+ edit +

+

- {% trans %}delete{% endtrans %} ++ {% trans %}delete{% endtrans %} +

+ {% endif %} + + {% if media.attachment_files|count %} +

Attachments

+ + {% endif %} + + {% if app_config['allow_attachments'] + and (media['uploader'] == request.user['_id'] + or request.user['is_admin']) %} +

+ Add attachment +

+ {% endif %} {% if media.tags %} {% include "mediagoblin/utils/tags.html" %} diff --cc mediagoblin/user_pages/routing.py index 65c0fa64,1283355a..55ee8e4d --- a/mediagoblin/user_pages/routing.py +++ b/mediagoblin/user_pages/routing.py @@@ -28,10 -28,9 +28,12 @@@ user_routes = '/{user}/m/{media}/c/{comment}/', controller="mediagoblin.user_pages.views:media_home"), Route('mediagoblin.edit.edit_media', "/{user}/m/{media}/edit/", - controller="mediagoblin.edit.views:edit_media"), + controller="mediagoblin.edit.views:edit_media"), + Route('mediagoblin.edit.attachments', + '/{user}/m/{media}/attachments/', + controller="mediagoblin.edit.views:edit_attachments"), + Route('mediagoblin.confirm.confirm_delete', "/{user}/m/{media}/confirm/", + controller="mediagoblin.confirm.views:confirm_delete"), Route('mediagoblin.user_pages.atom_feed', '/{user}/atom/', controller="mediagoblin.user_pages.views:atom_feed"), Route('mediagoblin.user_pages.media_post_comment',