core: fix application icons not loading, fix with_sources being broken

This commit is contained in:
Jens Langhammer 2020-02-20 14:30:06 +01:00
parent 9d8675e54b
commit 6c889eff27
4 changed files with 46 additions and 39 deletions

View File

@ -37,5 +37,7 @@ class ApplicationForm(forms.ModelForm):
labels = {
"meta_launch_url": _("Launch URL"),
"meta_icon_url": _("Icon URL"),
"meta_description": _("Description"),
"meta_publisher": _("Publisher"),
}
help_texts = {"policies": _("Policies required to access this Application.")}

View File

@ -48,13 +48,16 @@
<!--login-pf-section-->
<section class="login-pf-social-section" role="contentinfo" aria-label="Log in with third party account">
<ul class="login-pf-social login-pf-social-double-col list-unstyled">
{% for url, icon, name in sources %}
{% for source in sources %}
<li class="login-pf-social-link">
<a href="{{ url }}">
{% if icon %}
<img src="{% static 'img/logos/' %}{{ icon }}.svg" alt="{{ name }}">
<a href="{{ source.url }}">
{% if source.icon_path %}
<img src="{% static source.icon_path %}" alt="{{ source.name }}">
{% endif %}
{{ name }}
{% if source.icon_url %}
<img src="icon_url" alt="{{ source.name }}">
{% endif %}
{{ source.name }}
</a>
</li>
{% endfor %}

View File

@ -2,42 +2,44 @@
{% load i18n %}
{% block head %}
{{ block.super }}
<style>
img.app-icon {
max-height: 72px;
}
</style>
{% endblock %}
{% block content %}
<div class="container">
<div class="row row-cards-pf">
{% for app in applications %}
<div class="col-xs-12 col-sm-6 col-md-3">
<div class="card-pf card-pf-accented card-pf-aggregate-status">
<h2 class="card-pf-title">
<span class="fa fa-shield"></span> {{ app.name }}
</h2>
<div class="card-pf card-pf-view card-pf-view-select card-pf-view-single-select">
<div class="card-pf-body">
<p class="card-pf-aggregate-status-notifications">
<span class="card-pf-aggregate-status-notification">
<a href="{{ app.launch_url }}" class="add" data-toggle="tooltip" data-placement="top" title="{% trans 'Open App...' %}">
{% if not app.icon_url %}
<span class="pficon pficon-arrow"></span>
<div class="card-pf-top-element">
<a href="{{ app.meta_launch_url }}">
{% if not app.meta_icon_url %}
<span class="pficon pficon-arrow card-pf-icon-circle"></span>
{% else %}
<img class="app-icon" src="{{ app.icon_url }}" alt="{% trans 'Application Icon' %}">
<img class="app-icon card-pf-icon-circle" src="{{ app.meta_icon_url }}" alt="{% trans 'Application Icon' %}">
{% endif %}
</a>
</span>
</p>
</div>
<h2 class="card-pf-title text-center">
<a href="{{ app.meta_launch_url }}">
{{ app.name }}
</a>
</h2>
{% if app.meta_publisher %}
<div class="card-pf-items text-center">
<small>{{ app.meta_publisher }}</small>
</div>
{% endif %}
{% if app.meta_description %}
<div class="card-pf-items text-center">
<p>{{ app.meta_description }}</p>
</div>
{% endif %}
</div>
<div class="card-pf-view-checkbox">
<a href="{{ app.meta_launch_url }}"></a>
</div>
</div>
</div>
{% empty %}
<h1>{% trans 'No Applications available.' %}</h1>
{% endfor %}
</div><!-- /row -->
</div>
</div>
{% endblock %}

View File

@ -35,7 +35,7 @@ class OAuthSource(Source):
"passbook_sources_oauth:oauth-client-login",
kwargs={"source_slug": self.slug},
),
icon_path=f"{self.provider_type}.svg",
icon_path=f"img/logos/{self.provider_type}.svg",
name=self.name,
)