Merge remote branch 'remotes/gullydwarf-cfdv/is330'
This commit is contained in:
commit
e307eb42b6
@ -35,6 +35,8 @@
|
||||
<div class="mediagoblin_header_right">
|
||||
{% if request.user %}
|
||||
{{ request.user['username'] }}'s account
|
||||
<a href="{{ request.urlgen('mediagoblin.user_pages.user_gallery',
|
||||
user= request.user['username']) }}">gallery</a>
|
||||
(<a href="{{ request.urlgen('mediagoblin.auth.logout') }}">logout</a>)
|
||||
{% else %}
|
||||
<a href="{{ request.urlgen('mediagoblin.auth.login') }}">
|
||||
|
42
mediagoblin/templates/mediagoblin/user_pages/gallery.html
Normal file
42
mediagoblin/templates/mediagoblin/user_pages/gallery.html
Normal file
@ -0,0 +1,42 @@
|
||||
{#
|
||||
# GNU MediaGoblin -- federated, autonomous media hosting
|
||||
# Copyright (C) 2011 Free Software Foundation, Inc
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
{% extends "mediagoblin/base.html" %}
|
||||
|
||||
{% block mediagoblin_head %}
|
||||
<link rel="alternate" type="application/atom+xml"
|
||||
href="{{ request.urlgen(
|
||||
'mediagoblin.user_pages.atom_feed',
|
||||
user=user.username) }}">
|
||||
{% endblock mediagoblin_head %}
|
||||
|
||||
{% block mediagoblin_content -%}
|
||||
{% if user %}
|
||||
<h1>gallery for <a href="{{ request.urlgen(
|
||||
'mediagoblin.user_pages.user_home',
|
||||
user=user.username) }}">{{ user.username }}</a></h1>
|
||||
|
||||
{% include "mediagoblin/utils/object_gallery.html" %}
|
||||
|
||||
<a href={{ request.urlgen(
|
||||
'mediagoblin.user_pages.atom_feed',
|
||||
user=user.username) }}> atom feed</a>
|
||||
{% else %}
|
||||
{# This *should* not occur as the view makes sure we pass in a user. #}
|
||||
<p>Sorry, no such user found.<p/>
|
||||
{% endif %}
|
||||
{% endblock %}
|
@ -19,6 +19,8 @@ from routes.route import Route
|
||||
user_routes = [
|
||||
Route('mediagoblin.user_pages.user_home', "/{user}/",
|
||||
controller="mediagoblin.user_pages.views:user_home"),
|
||||
Route('mediagoblin.user_pages.user_gallery', "/{user}/gallery/",
|
||||
controller="mediagoblin.user_pages.views:user_gallery"),
|
||||
Route('mediagoblin.user_pages.media_home', '/{user}/m/{media}/',
|
||||
requirements=dict(m_id="[0-9a-fA-F]{24}"),
|
||||
controller="mediagoblin.user_pages.views:media_home"),
|
||||
|
@ -49,6 +49,33 @@ def user_home(request, page):
|
||||
'media_entries': media_entries,
|
||||
'pagination': pagination})
|
||||
|
||||
@uses_pagination
|
||||
def user_gallery(request, page):
|
||||
"""'Gallery' of a User()"""
|
||||
user = request.db.User.find_one({
|
||||
'username': request.matchdict['user'],
|
||||
'status': 'active'})
|
||||
if not user:
|
||||
return exc.HTTPNotFound()
|
||||
|
||||
cursor = request.db.MediaEntry.find(
|
||||
{'uploader': user['_id'],
|
||||
'state': 'processed'}).sort('created', DESCENDING)
|
||||
|
||||
pagination = Pagination(page, cursor)
|
||||
media_entries = pagination()
|
||||
|
||||
#if no data is available, return NotFound
|
||||
if media_entries == None:
|
||||
return exc.HTTPNotFound()
|
||||
|
||||
return render_to_response(
|
||||
request,
|
||||
'mediagoblin/user_pages/gallery.html',
|
||||
{'user': user,
|
||||
'media_entries': media_entries,
|
||||
'pagination': pagination})
|
||||
|
||||
|
||||
@get_user_media_entry
|
||||
def media_home(request, media):
|
||||
|
Loading…
x
Reference in New Issue
Block a user