point to correct icons

This commit is contained in:
Jens Langhammer 2019-03-14 21:18:13 +01:00
parent 4774d9a46c
commit 5c75339946
4 changed files with 25 additions and 8 deletions

View File

@ -51,7 +51,7 @@
{% for url, icon, name in sources %} {% for url, icon, name in sources %}
<li class="login-pf-social-link"> <li class="login-pf-social-link">
<a href="{{ url }}"> <a href="{{ url }}">
<img src="{% static 'img/' %}{{ icon }}.svg" alt="{{ name }}"> {{ name }} <img src="{% static 'img/logos/' %}{{ icon }}.svg" alt="{{ name }}"> {{ name }}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}

View File

@ -185,13 +185,14 @@
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
<div class="container-fluid container-cards-pf"> <div class="container-fluid container-cards-pf container-pf-nav-pf-vertical hide-nav-pf">
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</div> </div>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
{{ block.super }}
<script> <script>
$(document).ready(function () { $(document).ready(function () {
// initialize tooltips // initialize tooltips

View File

@ -30,7 +30,7 @@
{% for name, icon, link in us %} {% for name, icon, link in us %}
<li class="{% if link == request.get_full_path %} active {% endif %}"> <li class="{% if link == request.get_full_path %} active {% endif %}">
<a href="{{ link }}"> <a href="{{ link }}">
<img src="{% static icon %}" alt=""> {{ name }} <i class="{{ icon }}"></i> {{ name }}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}

View File

@ -29,9 +29,9 @@ class OAuthSource(Source):
def get_login_button(self): def get_login_button(self):
url = reverse_lazy('passbook_oauth_client:oauth-client-login', url = reverse_lazy('passbook_oauth_client:oauth-client-login',
kwargs={'source_slug': self.slug}) kwargs={'source_slug': self.slug})
if self.provider_type == 'github': # if self.provider_type == 'github':
return url, 'github-logo', _('GitHub') # return url, 'github-logo', _('GitHub')
return url, 'generic', _('Generic') return url, self.provider_type, self.name
@property @property
def additional_info(self): def additional_info(self):
@ -42,9 +42,12 @@ class OAuthSource(Source):
"""Entrypoint to integrate with User settings. Can either return False if no """Entrypoint to integrate with User settings. Can either return False if no
user settings are available, or a tuple or string, string, string where the first string user settings are available, or a tuple or string, string, string where the first string
is the name the item has, the second string is the icon and the third is the view-name.""" is the name the item has, the second string is the icon and the third is the view-name."""
icon = 'img/%s.svg' % self.get_login_button[1] icon_type = self.provider_type
if icon_type == 'azure ad':
icon_type = 'windows'
icon_class = 'fa fa-%s' % icon_type
view_name = 'passbook_oauth_client:oauth-client-user' view_name = 'passbook_oauth_client:oauth-client-user'
return self.name, icon, reverse((view_name), kwargs={ return self.name, icon_class, reverse((view_name), kwargs={
'source_slug': self.slug 'source_slug': self.slug
}) })
@ -113,6 +116,19 @@ class GoogleOAuthSource(OAuthSource):
verbose_name = _('Google OAuth Source') verbose_name = _('Google OAuth Source')
verbose_name_plural = _('Google OAuth Sources') verbose_name_plural = _('Google OAuth Sources')
class AzureADOAuthSource(OAuthSource):
"""Abstract subclass of OAuthSource to specify AzureAD Form"""
form = 'passbook.oauth_client.forms.AzureADOAuthSourceForm'
class Meta:
abstract = True
verbose_name = _('Azure AD OAuth Source')
verbose_name_plural = _('Azure AD OAuth Sources')
class UserOAuthSourceConnection(UserSourceConnection): class UserOAuthSourceConnection(UserSourceConnection):
"""Authorized remote OAuth provider.""" """Authorized remote OAuth provider."""