Merge remote branch 'remotes/jwandborg/f403_ability_to_delete'
authorChristopher Allan Webber <cwebber@dustycloud.org>
Mon, 29 Aug 2011 03:05:54 +0000 (22:05 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Mon, 29 Aug 2011 03:05:54 +0000 (22:05 -0500)
Conflicts:
mediagoblin/edit/views.py
mediagoblin/templates/mediagoblin/user_pages/media.html
mediagoblin/user_pages/routing.py

1  2 
mediagoblin/edit/views.py
mediagoblin/submit/views.py
mediagoblin/templates/mediagoblin/user_pages/media.html
mediagoblin/user_pages/routing.py
mediagoblin/user_pages/views.py

index b0145a0482c937ea7b0d3c05b4b1375bc1279ca2,2a8358163566cd304938df0b5c1b4a3343777046..f766afdc99a187734c7f51011075932a7e008298
@@@ -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'])
  
-             media['slug'] = request.POST['slug']
 +            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]
 +
 -            task_id = unicode(uuid.uuid4())
 -            media['queued_task_id'] = task_id
+             media['slug'] = unicode(request.POST['slug'])
              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'])
  
Simple merge
index 0425500e98d2cf815090904de140d762ab293843,c80144aa6694abbda32bfa6ab4caf2ada9dd50b2..fe953e777a5246bb6265fa5b5e23ea97b43c36fa
  
      <div class="grid_5 omega">
        {% include "mediagoblin/utils/prev_next.html" %}
 -        {% if media['uploader'] == request.user['_id'] or 
 -                                   request.user['is_admin'] %}
 -          <h3>Temporary button holder</h3>
 -          <p>
 -            <a href="{{ request.urlgen('mediagoblin.edit.edit_media',
 -                                       user= media.uploader().username,
 -                                       media= media._id) }}"
 -               ><img src="{{ request.staticdirect('/images/icon_edit.png') }}"
 -                     class="media_icon" />edit</a>
 -          </p>
 -          <p>
 -            <a href="{{ request.urlgen('mediagoblin.confirm.confirm_delete',
 -                                       user= media.uploader().username,
 -                                       media= media._id) }}"
 -               ><img src="{{ request.staticdirect('/images/icon_delete.png') }}"
 -                 class="media_icon" />{% trans %}delete{% endtrans %}</a>
 -          </p>
 -        {% endif %}
 +
 +      {% if media['uploader'] == request.user['_id'] or 
 +                                 request.user['is_admin'] %}
 +        <h3>Temporary button holder</h3>
 +        <p>
 +          <a href="{{ request.urlgen('mediagoblin.edit.edit_media',
 +                                     user= media.uploader().username,
 +                                     media= media._id) }}"
 +             ><img src="{{ request.staticdirect('/images/icon_edit.png') }}"
 +                   class="media_icon" />edit</a>
 +        </p>
 +        <p>
-           <img src="{{ request.staticdirect('/images/icon_delete.png') }}"
-                class="media_icon" />{% trans %}delete{% endtrans %}
++          <a href="{{ request.urlgen('mediagoblin.confirm.confirm_delete',
++                                     user= media.uploader().username,
++                                     media= media._id) }}"
++             ><img src="{{ request.staticdirect('/images/icon_delete.png') }}"
++               class="media_icon" />{% trans %}delete{% endtrans %}</a>
 +        </p>
 +      {% endif %}
 +
 +      {% if media.attachment_files|count %}
 +        <h3>Attachments</h3>
 +        <ul>
 +          {% for attachment in media.attachment_files %}
 +            <li>
 +              <a href="{{ request.app.public_store.file_url(attachment.filepath) }}">
 +                {{ attachment.name }}
 +              </a>
 +            </li>
 +          {% endfor %}
 +        </ul>
 +      {% endif %}
 +
 +      {% if app_config['allow_attachments']
 +            and (media['uploader'] == request.user['_id']
 +                 or request.user['is_admin']) %}
 +        <p>
 +          <a href="{{ request.urlgen('mediagoblin.edit.attachments',
 +                        user=media.uploader().username,
 +                        media=media._id) }}">Add attachment</a>
 +        </p>
 +      {% endif %}
  
        {% if media.tags %}
          {% include "mediagoblin/utils/tags.html" %}
index 65c0fa64ac7242ffc5a257fc42850005115b2468,1283355ad9a8b6617c8bd8b85c59ab6efce551a6..55ee8e4d6b06c799da5b21e28049f42217690131
@@@ -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',
Simple merge