commit
775aa61acb
|
@ -54,6 +54,9 @@
|
|||
<a href="{% url supporter ungluer %}"><span class="ungluer-name">{{ungluer|truncatechars:20}}</span>
|
||||
</a></li>
|
||||
{% endfor %}
|
||||
{% if library %}
|
||||
<li class="first"><a href="{% url library_users library %}"><span>More from {{ library }}</span></a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% block title %} Comments {% endblock %}
|
||||
{% block title %} Libraries {% endblock %}
|
||||
{% block extra_css %}
|
||||
<link type="text/css" rel="stylesheet" href="/static/css/supporter_layout.css" />
|
||||
<link type="text/css" rel="stylesheet" href="/static/css/liblist.css" />
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
{% extends "base.html" %}
|
||||
{% block title %} Users of {{ library }} {% endblock %}
|
||||
{% block extra_css %}
|
||||
<link type="text/css" rel="stylesheet" href="/static/css/supporter_layout.css" />
|
||||
<link type="text/css" rel="stylesheet" href="/static/css/liblist.css" />
|
||||
{% endblock %}
|
||||
{% block extra_head %}
|
||||
<script type="text/javascript" src="{{ jquery_ui_home }}"></script>
|
||||
{% endblock %}
|
||||
{% block topsection %}
|
||||
|
||||
<div id="js-topsection">
|
||||
<div class="js-main">
|
||||
<div class="js-topnews">
|
||||
<div class="js-topnews1">
|
||||
<div class="js-topnews2">
|
||||
<div class="js-topnews3">
|
||||
<div class="user-block">
|
||||
<div id="user-block1">
|
||||
<div id="block-intro-text"><span class="special-user-name">{{ library }} </span> </div>
|
||||
</div>
|
||||
<div class="user-block24"><span class="user-short-info">These ungluers are are using <a href="{% url library library %}">{{ library }}</a>. </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div id="main-container">
|
||||
<div class="js-main">
|
||||
<div id="js-leftcol">
|
||||
{% include "explore.html" %}
|
||||
</div>
|
||||
|
||||
<div id="js-maincol-fr">
|
||||
<div class="js-maincol-inner">
|
||||
<div id="content-block">
|
||||
<div id="content-block-content">
|
||||
<div style="height:46px;"></div>
|
||||
{% if is_member %}
|
||||
{% for libuser in library.library_users.all %}
|
||||
<div class="items {% cycle 'row1' 'row2' %}">
|
||||
<div class="avatar">
|
||||
<a href="{% url supporter libuser.user.username %}">
|
||||
<img class="user-avatar" src="{{ libuser.user.profile.avatar_url }}" height="50" width="50" alt="Avatar for {{ libuser.user.username }}" title="{{ libuser.user }}" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="nonavatar">
|
||||
<div class="libname"><a href="{% url supporter libuser.user.username %}">{{ libuser.user.username }}</a> {{ libuser.user.profile.tagline }}</div>
|
||||
<div class="libstat">{{ libuser.user.wishlist.works.count }} books on list</div>
|
||||
{% if is_admin %}
|
||||
<div class="libstat">authorized {{ libuser.date_modified|date:"M j, Y" }}</div>
|
||||
<div class="libstat">credential: {{ libuser.credential }}</div>
|
||||
<div class="libstat"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% empty %}
|
||||
No users yet.
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
You need to be a member of {{ library }} to see all its members. They can borrow and donate books. Perhaps you'd like to <a href="{% url join_library library %}">join them</a>?
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -7,6 +7,7 @@ urlpatterns = patterns(
|
|||
"",
|
||||
url(r"^libraryauth/(?P<library>[^/]+)/join/$", views.join_library, name="join_library"),
|
||||
url(r"^libraryauth/(?P<library>[^/]+)/deny/$", direct_to_template, {'template':'libraryauth/denied.html'}, name="bad_library"),
|
||||
url(r"^libraryauth/(?P<library>[^/]+)/users/$", views.library, {'template':'libraryauth/users.html'}, name="library_users"),
|
||||
url(r"^libraryauth/list/$", direct_to_template, {
|
||||
'template':'libraryauth/list.html',
|
||||
'extra_context':{'libraries':models.Library.objects.order_by('user__username')}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import logging
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.contrib.auth.views import login
|
||||
from django.http import HttpResponseRedirect
|
||||
from . import backends
|
||||
|
@ -10,6 +10,17 @@ from .forms import AuthForm
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def library(request, library,
|
||||
extra_context={},
|
||||
template='libraryauth/library.html',
|
||||
**kwargs):
|
||||
library=get_object_or_404(Library, user__username=library)
|
||||
context={ 'library':library,
|
||||
'is_admin': request.user.is_staff or request.user==library.user,
|
||||
'is_member': request.user.is_staff or library.has_user(request.user),
|
||||
}
|
||||
context.update(extra_context)
|
||||
return render(request, template, context)
|
||||
|
||||
def join_library(request, library):
|
||||
library=get_object_or_404(Library, user__username=library)
|
||||
|
|
Loading…
Reference in New Issue