Skip to content

Commit

Permalink
Merge branch 'release/0.4.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
mblomdahl committed Oct 24, 2017
2 parents fdd55d8 + 3cf3bee commit 1b9e3c6
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 53 deletions.
9 changes: 9 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ DB Models
Changelog
=========

v. 0.4.3
--------

* Personalized user icons (Gravatar, `#70 <https://github.com/libris/xl_auth/issues/70>`_)
* Updated ``/about/`` page with current version number + links
(`#71 <https://github.com/libris/xl_auth/issues/71>`_)
* Only list permissions on active collections on ``/users/profile/`` page


v. 0.4.2
--------

Expand Down
7 changes: 5 additions & 2 deletions assets/css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ textarea {
display: inline-block;
width: 50px;
padding: 0.1em;
.logotype {
}
}
.navbar-user-gravatar {
border-radius: 50%;
float: left;
margin: -.4em 0.5em;
}
}

Expand Down
49 changes: 33 additions & 16 deletions messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: xl_auth 0.4.2\n"
"Project-Id-Version: xl_auth 0.4.3\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2017-10-23 12:41+0200\n"
"POT-Creation-Date: 2017-10-24 06:53+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -22,7 +22,7 @@ msgstr ""
#: tests/end2end/test_editing_permission.py:91 tests/end2end/test_editing_user.py:183
#: tests/end2end/test_registering_permission.py:25 tests/end2end/test_registering_permission.py:58
#: tests/end2end/test_registering_permission.py:85 xl_auth/templates/nav.html:28
#: xl_auth/templates/permissions/home.html:4 xl_auth/templates/users/profile.html:34
#: xl_auth/templates/permissions/home.html:4
msgid "Permissions"
msgstr ""

Expand Down Expand Up @@ -54,7 +54,7 @@ msgstr ""

#: tests/end2end/test_editing_collection.py:80 tests/end2end/test_registering_collection.py:79
#: xl_auth/collection/forms.py:17 xl_auth/templates/collections/home.html:21
#: xl_auth/templates/collections/home.html:65 xl_auth/templates/users/profile.html:40
#: xl_auth/templates/collections/home.html:65 xl_auth/templates/users/profile.html:42
msgid "Code"
msgstr ""

Expand Down Expand Up @@ -115,16 +115,16 @@ msgstr ""
#: tests/end2end/test_editing_user.py:45 xl_auth/templates/permissions/home.html:30
#: xl_auth/templates/permissions/home.html:31 xl_auth/templates/permissions/home.html:32
#: xl_auth/templates/users/home.html:33 xl_auth/templates/users/home.html:76
#: xl_auth/templates/users/profile.html:53 xl_auth/templates/users/profile.html:56
#: xl_auth/templates/users/profile.html:59
#: xl_auth/templates/users/profile.html:55 xl_auth/templates/users/profile.html:58
#: xl_auth/templates/users/profile.html:61
msgid "Yes"
msgstr ""

#: tests/end2end/test_editing_user.py:45 xl_auth/templates/permissions/home.html:30
#: xl_auth/templates/permissions/home.html:31 xl_auth/templates/permissions/home.html:32
#: xl_auth/templates/users/home.html:33 xl_auth/templates/users/home.html:76
#: xl_auth/templates/users/profile.html:53 xl_auth/templates/users/profile.html:56
#: xl_auth/templates/users/profile.html:59
#: xl_auth/templates/users/profile.html:55 xl_auth/templates/users/profile.html:58
#: xl_auth/templates/users/profile.html:61
msgid "No"
msgstr ""

Expand Down Expand Up @@ -295,17 +295,17 @@ msgid "Collection"
msgstr ""

#: xl_auth/permission/forms.py:22 xl_auth/templates/permissions/home.html:18
#: xl_auth/templates/users/profile.html:42
#: xl_auth/templates/users/profile.html:44
msgid "Registrant"
msgstr ""

#: xl_auth/permission/forms.py:23 xl_auth/templates/permissions/home.html:19
#: xl_auth/templates/users/profile.html:43
#: xl_auth/templates/users/profile.html:45
msgid "Cataloger"
msgstr ""

#: xl_auth/permission/forms.py:24 xl_auth/templates/permissions/home.html:20
#: xl_auth/templates/users/profile.html:44
#: xl_auth/templates/users/profile.html:46
msgid "Cataloguing Administrator"
msgstr ""

Expand Down Expand Up @@ -362,9 +362,8 @@ msgstr ""
msgid "Collections"
msgstr ""

#: xl_auth/templates/nav.html:35
#, python-format
msgid "Logged in as %(user)s"
#: xl_auth/templates/nav.html:39
msgid "Log out"
msgstr ""

#: xl_auth/templates/collections/edit.html:5
Expand All @@ -391,7 +390,7 @@ msgid "Active Collections"
msgstr ""

#: xl_auth/templates/collections/home.html:22 xl_auth/templates/collections/home.html:66
#: xl_auth/templates/users/profile.html:41
#: xl_auth/templates/users/profile.html:43
msgid "Friendly Name"
msgstr ""

Expand Down Expand Up @@ -439,6 +438,14 @@ msgid ""
"href=\"https://github.com/libris/xl_auth/issues\">GitHub repo</a> for ongoing progress."
msgstr ""

#: xl_auth/templates/public/about.html:13
#, python-format
msgid ""
"Current release version is <code>%(version)s</code>. Please check out the <a "
"href=\"https://github.com/libris/xl_auth/releases\">releases overview</a> page for recent "
"changes."
msgstr ""

#: xl_auth/templates/public/home.html:8
msgid "Welcome to xl_auth"
msgstr ""
Expand Down Expand Up @@ -488,7 +495,7 @@ msgid "Change User Password"
msgstr ""

#: xl_auth/templates/users/home.html:8
msgid "Existing Users"
msgid "Active Users"
msgstr ""

#: xl_auth/templates/users/home.html:20 xl_auth/templates/users/home.html:63
Expand Down Expand Up @@ -521,6 +528,16 @@ msgid ""
"are not correctly listed below."
msgstr ""

#: xl_auth/templates/users/profile.html:34
msgid "Permissions (Active Collections Only)"
msgstr ""

#: xl_auth/templates/users/profile.html:35
msgid ""
"Note: <em>Cataloguing Admin</em> is a new privilege that, in the tear future, will allow you to "
"create new user accounts and grant registrant/cataloger privileges to others. "
msgstr ""

#: xl_auth/templates/users/register.html:5
msgid "Register New User"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xl_auth",
"version": "0.4.2",
"version": "0.4.3",
"author": "National Library of Sweden",
"license": "Apache-2.0",
"description": "OAuth2 authorization for LibrisXL, replacing BibDB counterpart",
Expand Down
9 changes: 9 additions & 0 deletions tests/models/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ def test_removing_permissions(collection):
assert permission not in user.permissions


@pytest.mark.usefixtures('db')
def test_get_gravatar_url():
"""Check get_gravatar_url output."""
user = UserFactory(email='[email protected]')

assert user.get_gravatar_url(64) == 'https://www.gravatar.com/avatar/' \
'b48def645758b95537d4424c84d1a9ff?d=mm&s=64'


@pytest.mark.usefixtures('db')
def test_roles():
"""Add a role to a user."""
Expand Down
5 changes: 2 additions & 3 deletions xl_auth/public/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from __future__ import absolute_import, division, print_function, unicode_literals

from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask import Blueprint, current_app, flash, redirect, render_template, request, url_for
from flask_babel import lazy_gettext as _
from flask_login import login_required, login_user, logout_user

Expand Down Expand Up @@ -49,5 +49,4 @@ def logout():
@blueprint.route('/about/')
def about():
"""About page."""
login_form = LoginForm(request.form)
return render_template('public/about.html', login_form=login_form)
return render_template('public/about.html', version=current_app.config['APP_VERSION'])
17 changes: 8 additions & 9 deletions xl_auth/templates/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,21 @@
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li><a href="{{ url_for('collection.home') }}">{{ _('Collections') }}</a></li>
<li><a class="navbar-link" href="{{ url_for('collection.home') }}">{{ _('Collections') }}</a></li>
{% if current_user.is_admin %}
<li><a href="{{ url_for('user.home') }}">{{ _('Users') }}</a></li>
<li><a href="{{ url_for('permission.home') }}">{{ _('Permissions') }}</a></li>
<li><a class="navbar-link" href="{{ url_for('user.home') }}">{{ _('Users') }}</a></li>
<li><a class="navbar-link" href="{{ url_for('permission.home') }}">{{ _('Permissions') }}</a></li>
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<p class="navbar-text">
<a class="navbar-link" href="{{ url_for('user.profile') }}">
{{ _('Logged in as %(user)s', user=current_user.full_name) }}
</a>
</p>
<a class="navbar-link" href="{{ url_for('user.profile') }}">
<img class="navbar-user-gravatar" src="{{ current_user.get_gravatar_url(32) }}" />
{{ current_user.full_name }}
</a>
</li>
<li>
<a class="navbar-link" href="{{ url_for('public.logout') }}">
<a class="navbar-link" title="{{ _('Log out') }}" href="{{ url_for('public.logout') }}">
<i class="fa fa-sign-out"></i>
</a>
</li>
Expand Down
8 changes: 7 additions & 1 deletion xl_auth/templates/public/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
<div class="row">
<h1>{{ _('About') }}</h1>
<p>
{{ _('Under construction. Please refer to our <a href="https://github.com/libris/xl_auth/issues">GitHub repo</a> for ongoing progress.') }}
{{ _('Under construction. Please refer to our <a href="https://github.com/libris/\
xl_auth/issues">GitHub repo</a> for ongoing progress.') }}
</p>
<p>
{{ _('Current release version is <code>%(version)s</code>. Please check out \
the <a href="https://github.com/libris/xl_auth/releases">releases overview</a> page for \
recent changes.', version=version) }}
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion xl_auth/templates/users/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h1>{{ _('Users') }}</h1>
<br/>
<div class="panel panel-default">
<div class="panel-heading">
<strong>{{ _('Existing Users') }}</strong>
<strong>{{ _('Active Users') }}</strong>
{% if current_user.is_admin %}
<a class="btn btn-xs btn-primary pull-right"
href="{{ url_for('user.register') }}">{{ _('New User') }}</a>
Expand Down
6 changes: 4 additions & 2 deletions xl_auth/templates/users/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ <h3>{{ _('Important') }}!</h3>

<div class="panel panel-default">
<div class="panel-heading">
<h3>{{ _('Permissions') }}</h3>
<h3>{{ _('Permissions (Active Collections Only)') }}</h3>
<p>{{ _('Note: <em>Cataloguing Admin</em> is a new privilege that, in the near future, \
will allow you to create new user accounts and grant registrant/cataloger privileges to others. ') }}</p>
</div>
<div class="panel-body">
<table class="table table-hover">
Expand All @@ -45,7 +47,7 @@ <h3>{{ _('Permissions') }}</h3>
</tr>
</thead>
<tbody>
{% for permission in user.permissions %}
{% for permission in user.permissions if permission.collection.active %}
<tr>
<td>{{ permission.collection.code }}</td>
<td>{{ permission.collection.friendly_name }}</td>
Expand Down
Loading

0 comments on commit 1b9e3c6

Please sign in to comment.