Skip to content
This repository has been archived by the owner on Apr 15, 2018. It is now read-only.

Commit

Permalink
users in a city
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed May 15, 2013
1 parent c8d8c6e commit aa1d65b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 8 deletions.
8 changes: 5 additions & 3 deletions june/templates/macro/ui.html
Expand Up @@ -90,15 +90,17 @@ <h3 class="title"><a href="{{url_for('node.view', urlname=item.urlname)}}">{{ite
<div class="item-list user-list">
{% for user in items %}
<div class="item">
<a href="{{url_for('user.view', username=user.username)}}">
<div class="account-group">
<img src="{{ user.avatar(48)}}" alt="{{user}}" />
<strong>{{user}}</strong>
<a href="{{url_for('user.view', username=user.username)}}"><strong>{{user}}</strong></a>
<div class="meta">
<time>{{ user.created.strftime('%Y-%m-%d') }}</time>
{% if user.city %}
<span class="sep">&middot;</span>
<a href="{{ url_for('user.city', city=user.city) }}">{{user.city}}</a>
{% endif %}
</div>
</div>
</a>
{% if show_badge and user.is_staff %}
<span class="label label-success">staff</span>
{% endif %}
Expand Down
20 changes: 20 additions & 0 deletions june/templates/user/city.html
@@ -0,0 +1,20 @@
{% extends "layout.html" %}

{% block subtitle %}{{city}}{% endblock %}

{% from "macro/ui.html" import nav, user_list %}

{% block nav %}
{{ nav('user') }}
{% endblock %}

{% block content %}
<div class="module">
<div class="module-header inner">
<strong>{{city}}</strong>
</div>
<div class="module-body">
{{ user_list(paginator.items) }}
</div>
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion june/templates/user/users.html
Expand Up @@ -11,7 +11,7 @@
{% block content %}
<div class="module">
<div class="module-header inner">
<strong>{{_('Recent Joins')}}</strong>
<strong>{{_('Members')}}</strong>
</div>
<div class="module-body">
{{ user_list(paginator.items) }}
Expand Down
2 changes: 1 addition & 1 deletion june/templates/user/view.html
Expand Up @@ -21,7 +21,7 @@
</div>
<div style="margin-top:8px">
{% if user.city %}
<a href="/user/in/{{user.city}}">@{{user.city}}</a>
<a href="{{ url_for('user.city', city=user.city) }}">@{{user.city}}</a>
<span class="sep">&middot;</span>
{% endif %}
{% if user.website %}
Expand Down
12 changes: 12 additions & 0 deletions june/views/user.py
Expand Up @@ -28,6 +28,18 @@ def users():
)


@bp.route('/in/<city>')
def city(city):
"""
Users in a city.
"""
page = force_int(request.args.get('page', 1), 0)
if not page:
return abort(404)
paginator = Account.query.filter_by(city=city).paginate(page)
return render_template('user/city.html', paginator=paginator, city=city)


@bp.route('/<username>')
def view(username):
"""
Expand Down
3 changes: 0 additions & 3 deletions static/css/site.css
Expand Up @@ -227,9 +227,6 @@ textarea.input-block-level {
top: 10px;
right: 20px;
}
.user-list a {
text-decoration: none;
}
.user-list .account-group {
margin-left: 46px;
}
Expand Down

0 comments on commit aa1d65b

Please sign in to comment.