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"> <div class="card-pf-body">
<span class="fa fa-shield"></span> {{ app.name }} <div class="card-pf-top-element">
</h2> <a href="{{ app.meta_launch_url }}">
<div class="card-pf-body"> {% if not app.meta_icon_url %}
<p class="card-pf-aggregate-status-notifications"> <span class="pficon pficon-arrow card-pf-icon-circle"></span>
<span class="card-pf-aggregate-status-notification"> {% else %}
<a href="{{ app.launch_url }}" class="add" data-toggle="tooltip" data-placement="top" title="{% trans 'Open App...' %}"> <img class="app-icon card-pf-icon-circle" src="{{ app.meta_icon_url }}" alt="{% trans 'Application Icon' %}">
{% if not app.icon_url %} {% endif %}
<span class="pficon pficon-arrow"></span> </a>
{% else %} </div>
<img class="app-icon" src="{{ app.icon_url }}" alt="{% trans 'Application Icon' %}"> <h2 class="card-pf-title text-center">
{% endif %} <a href="{{ app.meta_launch_url }}">
</a> {{ app.name }}
</span> </a>
</p> </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> {% endfor %}
</div> </div>
{% empty %}
<h1>{% trans 'No Applications available.' %}</h1>
{% endfor %}
</div><!-- /row -->
</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,
) )