ui: include font-awesome

This commit is contained in:
Jens Langhammer 2020-02-21 18:00:09 +01:00
parent a09a1793ec
commit 1285ba6fbb
8 changed files with 139 additions and 101 deletions

View File

@ -13,6 +13,7 @@
<link rel="shortcut icon" type="image/png" href="{% static 'passbook/logo.png' %}"> <link rel="shortcut icon" type="image/png" href="{% static 'passbook/logo.png' %}">
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/@patternfly/patternfly/patternfly.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'node_modules/@patternfly/patternfly/patternfly.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/@patternfly/patternfly/patternfly-addons.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'node_modules/@patternfly/patternfly/patternfly-addons.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'passbook/pf.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'passbook/pf.css' %}">
{% block head %} {% block head %}
{% endblock %} {% endblock %}

View File

@ -6,44 +6,62 @@
{% load passbook_user_settings %} {% load passbook_user_settings %}
{% block content %} {% block content %}
<div class="container"> <section class="pf-c-page__main-section">
<div class="col-md-3 "> <div class="pf-l-split pf-m-gutter">
<div class="nav-category"> <div class="pf-l-split__item">
<h2>{% trans 'User Settings'%}</h2> <div class="pf-c-card">
<ul class="nav nav-pills nav-stacked"> <div class="pf-c-card__body">
<li class="{% is_active 'passbook_core:user-settings' %}"> <nav class="pf-c-nav" aria-label="Global">
<a href="{% url 'passbook_core:user-settings' %}"> <section class="pf-c-nav__section">
<i class="fa pficon-edit"></i> {% trans 'Details' %} <h2 class="pf-c-nav__section-title">{% trans 'General Settings' %}</h2>
</a> <ul class="pf-c-nav__list">
</li> <li class="pf-c-nav__item">
{% user_factors as uf %} <a href="{% url 'passbook_core:user-settings' %}" class="pf-c-nav__link {% is_active 'passbook_core:user-settings' %}">{% trans 'User Details' %}</a>
{% if uf %} </li>
<li class="nav-divider"></li> </ul>
{% endif %} </section>
{% for user_settings in uf %} {% user_factors as user_factors_loc %}
<li class="{% is_active user_settings.view_name %}"> {% if user_factors_loc %}
<a href="{% url user_settings.view_name %}"> <section class="pf-c-nav__section">
<i class="{{ user_settings.icon }}"></i> {{ user_settings.name }} <h2 class="pf-c-nav__section-title">{% trans 'Factors' %}</h2>
</a> <ul class="pf-c-nav__list">
</li> {% for factor in user_factors_loc %}
{% endfor %} <li class="pf-c-nav__item">
{% user_sources as us %} <a href="{% url factor.view_name %}" class="pf-c-nav__link {% is_active factor.view_name %}">
{% if us %} <i class="{{ factor.icon }}"></i>
<li class="nav-divider"></li> {{ factor.name }}
{% endif %} </a>
{% for user_settings in us %} </li>
<li class="{% if user_settings.view_name == request.get_full_path %} active {% endif %}"> {% endfor %}
<a href="{{ user_settings.view_name }}"> </ul>
<i class="{{ user_settings.icon }}"></i> {{ user_settings.name }} </section>
</a> {% endif %}
</li> {% user_sources as user_sources_loc %}
{% endfor %} {% if user_sources_loc %}
</ul> <section class="pf-c-nav__section">
<h2 class="pf-c-nav__section-title">{% trans 'Sources' %}</h2>
<ul class="pf-c-nav__list">
{% for source in user_sources_loc %}
<li class="pf-c-nav__item">
<a href="{{ source.view_name }}" class="pf-c-nav__link {% if user_settings.view_name == request.get_full_path %} pf-m-current {% endif %}">
<i class="{{ source.icon }}"></i>
{{ source.name }}
</a>
</li>
{% endfor %}
</ul>
</section>
{% endif %}
</nav>
</div>
</div>
</div>
<div class="pf-l-split__item">
<div class="pf-c-card">
{% block page %}
{% endblock %}
</div>
</div> </div>
</div> </div>
<div class="col-md-9"> </section>
{% block page %}
{% endblock %}
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -3,11 +3,22 @@
{% load i18n %} {% load i18n %}
{% block page %} {% block page %}
<h1>{% trans 'Update details' %}</h1> <div class="pf-c-card__header pf-c-title pf-m-md">
<form action="" method="post" class="form-horizontal"> <h1>{% trans 'Update details' %}</h1>
{% csrf_token %} </div>
{% include 'partials/form.html' %} <div class="pf-c-card__body">
<input class="btn btn-primary" type="submit" value="{% trans 'Update' %}"> <form action="" method="post" class="pf-c-form pf-m-horizontal">
<a class="btn btn-danger" href="{% url 'passbook_core:user-delete' %}?back={{ request.get_full_path }}">{% trans 'Delete user' %}</a> {% include 'partials/form_horizontal.html' with form=form %}
</form> {% block beneath_form %}
{% endblock %}
<div class="pf-c-form__group pf-m-action">
<div class="pf-c-form__horizontal-group">
<div class="pf-c-form__actions">
<input class="pf-c-button pf-m-primary" type="submit" value="{% trans 'Update' %}" />
<a class="pf-c-button pf-m-danger" href="{% url 'passbook_core:user-delete' %}?back={{ request.get_full_path }}">{% trans "Delete account" %}</a>
</div>
</div>
</div>
</form>
</div>
{% endblock %} {% endblock %}

View File

@ -3,48 +3,46 @@
{% load utils %} {% load utils %}
{% load i18n %} {% load i18n %}
{% block title %}
{% title "OTP" %}
{% endblock %}
{% block page %} {% block page %}
<h1> <div class="pf-c-card__header pf-c-title pf-m-md">
<clr-icon shape="two-way-arrows" size="48"></clr-icon>{% trans "One-Time Passwords" %} <h1>{% trans "One-Time Passwords" %}</h1>
</h1>
<div class="row">
<div class="col-md-6">
<div class="card-footer">
<p>
{% blocktrans with state=state|yesno:"Enabled,Disabled" %}
Status: {{ state }}
{% endblocktrans %}
{% if state %}
<clr-icon shape="check" size="32" class="is-success"></clr-icon>
{% else %}
<clr-icon shape="times" size="32" class="is-error"></clr-icon>
{% endif %}
</p>
<p>
{% if not state %}
<a href="{% url 'passbook_factors_otp:otp-enable' %}"
class="btn btn-success btn-sm">{% trans "Enable OTP" %}</a>
{% else %}
<a href="{% url 'passbook_factors_otp:otp-disable' %}"
class="btn btn-danger btn-sm">{% trans "Disable OTP" %}</a>
{% endif %}
</p>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-header">
{% trans "Your Backup tokens:" %}
</div>
<div class="card-block">
<pre>{% for token in static_tokens %}{{ token.token }}
{% empty %}{% trans 'N/A' %}{% endfor %}</pre>
</div>
</div>
</div>
</div> </div>
{% endblock %} <div class="pf-c-card__body">
<div class="row">
<div class="col-md-6">
<div class="card-footer">
<p>
{% blocktrans with state=state|yesno:"Enabled,Disabled" %}
Status: {{ state }}
{% endblocktrans %}
{% if state %}
<clr-icon shape="check" size="32" class="is-success"></clr-icon>
{% else %}
<clr-icon shape="times" size="32" class="is-error"></clr-icon>
{% endif %}
</p>
<p>
{% if not state %}
<a href="{% url 'passbook_factors_otp:otp-enable' %}"
class="btn btn-success btn-sm">{% trans "Enable OTP" %}</a>
{% else %}
<a href="{% url 'passbook_factors_otp:otp-disable' %}"
class="btn btn-danger btn-sm">{% trans "Disable OTP" %}</a>
{% endif %}
</p>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-header">
{% trans "Your Backup tokens:" %}
</div>
<div class="card-block">
<pre>{% for token in static_tokens %}{{ token.token }}
{% empty %}{% trans 'N/A' %}{% endfor %}</pre>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -52,7 +52,7 @@ class OAuthSource(Source):
icon_type = self.provider_type icon_type = self.provider_type
if icon_type == "azure ad": if icon_type == "azure ad":
icon_type = "windows" icon_type = "windows"
icon_class = f"fa fa-{icon_type}" icon_class = f"fab fa-{icon_type}"
view_name = "passbook_sources_oauth:oauth-client-user" view_name = "passbook_sources_oauth:oauth-client-user"
return UIUserSettings( return UIUserSettings(
name=self.name, name=self.name,

View File

@ -3,16 +3,20 @@
{% load i18n %} {% load i18n %}
{% block page %} {% block page %}
<h1>{{ source.name }}</h1> <div class="pf-c-card__header pf-c-title pf-m-md">
{% if connections.exists %} <h1>{{ source.name }}</h1>
<p>{% trans 'Connected.' %}</p> </div>
<a class="btn btn-danger" href="{% url 'passbook_sources_oauth:oauth-client-disconnect' source_slug=source.slug %}"> <div class="pf-c-card__body">
{% trans 'Disconnect' %} {% if connections.exists %}
</a> <p>{% trans 'Connected.' %}</p>
{% else %} <a class="pf-c-button pf-m-danger" href="{% url 'passbook_sources_oauth:oauth-client-disconnect' source_slug=source.slug %}">
<p>Not connected.</p> {% trans 'Disconnect' %}
<a class="btn btn-primary" href="{% url 'passbook_sources_oauth:oauth-client-login' source_slug=source.slug %}"> </a>
{% trans 'Connect' %} {% else %}
</a> <p>Not connected.</p>
{% endif %} <a class="pf-c-button pf-m-primary" href="{% url 'passbook_sources_oauth:oauth-client-login' source_slug=source.slug %}">
{% trans 'Connect' %}
</a>
{% endif %}
</div>
{% endblock %} {% endblock %}

View File

@ -1,6 +1,7 @@
{ {
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^5.12.1",
"@patternfly/patternfly": "^2.65.3", "@patternfly/patternfly": "^2.65.3",
"codemirror": "^5.52.0" "codemirror": "^5.52.0"
} }

View File

@ -2,6 +2,11 @@
# yarn lockfile v1 # yarn lockfile v1
"@fortawesome/fontawesome-free@^5.12.1":
version "5.12.1"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.12.1.tgz#2a98fea9fbb8a606ddc79a4680034e9d5591c550"
integrity sha512-ZtjIIFplxncqxvogq148C3hBLQE+W3iJ8E4UvJ09zIJUgzwLcROsWwFDErVSXY2Plzao5J9KUYNHKHMEUYDMKw==
"@patternfly/patternfly@^2.65.3": "@patternfly/patternfly@^2.65.3":
version "2.65.3" version "2.65.3"
resolved "https://registry.yarnpkg.com/@patternfly/patternfly/-/patternfly-2.65.3.tgz#0856d6ca13d971f18b1d7889a60a73eb78cad3c8" resolved "https://registry.yarnpkg.com/@patternfly/patternfly/-/patternfly-2.65.3.tgz#0856d6ca13d971f18b1d7889a60a73eb78cad3c8"