make Admin UI more consistent, better show when provider has no application assigned
This commit is contained in:
parent
95de6a14fd
commit
2db1738e4a
|
@ -21,6 +21,7 @@
|
|||
<tr>
|
||||
<th>{% trans 'Name' %}</th>
|
||||
<th>{% trans 'Provider' %}</th>
|
||||
<th>{% trans 'Provider Type' %}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -28,7 +29,8 @@
|
|||
{% for application in object_list %}
|
||||
<tr>
|
||||
<td>{{ application.name }}</td>
|
||||
<td>{{ application.provider }}</td>
|
||||
<td>{{ application.get_provider }}</td>
|
||||
<td>{{ application.get_provider|verbose_name }}</td>
|
||||
<td>
|
||||
<a class="btn btn-default btn-sm"
|
||||
href="{% url 'passbook_admin:application-update' pk=application.uuid %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
{% for factor in object_list %}
|
||||
<tr>
|
||||
<td>{{ factor.name }} ({{ factor.slug }})</td>
|
||||
<td>{{ factor.type }}</td>
|
||||
<td>{{ factor|verbose_name }}</td>
|
||||
<td>{{ factor.order }}</td>
|
||||
<td>{{ factor.enabled }}</td>
|
||||
<td>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th>{% trans 'Name' %}</th>
|
||||
<th>{% trans 'Class' %}</th>
|
||||
<th>{% trans 'Type' %}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -37,7 +37,7 @@
|
|||
{% for policy in object_list %}
|
||||
<tr>
|
||||
<td>{{ policy.name }}</td>
|
||||
<td>{{ policy|fieldtype }}</td>
|
||||
<td>{{ policy|verbose_name }}</td>
|
||||
<td>
|
||||
<a class="btn btn-default btn-sm"
|
||||
href="{% url 'passbook_admin:policy-update' pk=policy.uuid %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
|
||||
|
|
|
@ -29,16 +29,24 @@
|
|||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>{% trans 'Name' %}</th>
|
||||
<th>{% trans 'Class' %}</th>
|
||||
<th>{% trans 'Type' %}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for provider in object_list %}
|
||||
<tr>
|
||||
<tr {% if not provider.application %} class="warning" {% endif %}>
|
||||
<th>
|
||||
{% if not provider.application %}
|
||||
<span class="pficon-warning-triangle-o" data-toggle="tooltip" data-placement="right" title="{% trans 'Warning: Provider has no application assigned.' %}"></span>
|
||||
{% else %}
|
||||
<span class="pficon-ok" data-toggle="tooltip" data-placement="right" title="{% blocktrans with app=provider.application %}Assigned to Application {{ app }}{% endblocktrans %}"></span>
|
||||
{% endif %}
|
||||
</th>
|
||||
<td>{{ provider.name }}</td>
|
||||
<td>{{ provider|fieldtype }}</td>
|
||||
<td>{{ provider|verbose_name }}</td>
|
||||
<td>
|
||||
<a class="btn btn-default btn-sm"
|
||||
href="{% url 'passbook_admin:provider-update' pk=provider.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
|
||||
|
|
|
@ -14,6 +14,7 @@ class ApplicationListView(AdminRequiredMixin, ListView):
|
|||
"""Show list of all applications"""
|
||||
|
||||
model = Application
|
||||
ordering = 'name'
|
||||
template_name = 'administration/application/list.html'
|
||||
|
||||
def get_queryset(self):
|
||||
|
|
|
@ -161,6 +161,10 @@ class Application(PolicyModel):
|
|||
from passbook.core.policies import PolicyEngine
|
||||
return PolicyEngine(self.policies.all()).for_user(user).result
|
||||
|
||||
def get_provider(self):
|
||||
"""Get casted provider instance"""
|
||||
return Provider.objects.get_subclass(pk=self.provider.pk)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
|
|
@ -207,3 +207,8 @@ def gravatar(email, size=None, rating=None):
|
|||
gravatar_url += '?' + urlencode(parameters, doseq=True)
|
||||
|
||||
return escape(gravatar_url)
|
||||
|
||||
@register.filter
|
||||
def verbose_name(obj):
|
||||
"""Return Object's Verbose Name"""
|
||||
return obj._meta.verbose_name
|
||||
|
|
|
@ -40,11 +40,11 @@ class SAMLProvider(Provider):
|
|||
|
||||
def link_download_metadata(self):
|
||||
"""Get link to download XML metadata for admin interface"""
|
||||
# pylint: disable=no-member
|
||||
if self.application:
|
||||
try:
|
||||
# pylint: disable=no-member
|
||||
return reverse('passbook_saml_idp:metadata_xml',
|
||||
kwargs={'application': self.application.slug})
|
||||
except Provider.application.RelatedObjectDoesNotExist:
|
||||
return None
|
||||
|
||||
class Meta:
|
||||
|
|
Reference in New Issue