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 = { labels = {
"meta_launch_url": _("Launch URL"), "meta_launch_url": _("Launch URL"),
"meta_icon_url": _("Icon URL"), "meta_icon_url": _("Icon URL"),
"meta_description": _("Description"),
"meta_publisher": _("Publisher"),
} }
help_texts = {"policies": _("Policies required to access this Application.")} help_texts = {"policies": _("Policies required to access this Application.")}

View file

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

View file

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

View file

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