core: UIUserSettings: remove icon, rename view_name to URL for complete URL

This commit is contained in:
Jens Langhammer 2020-06-29 16:20:33 +02:00
parent 693a92ada5
commit d6a8d8292d
5 changed files with 7 additions and 16 deletions

View File

@ -25,8 +25,7 @@
<ul class="pf-c-nav__list">
{% for stage in user_stages_loc %}
<li class="pf-c-nav__item">
<a href="{% url stage.view_name %}" class="pf-c-nav__link {% is_active stage.view_name %}">
<i class="{{ stage.icon }}"></i>
<a href="{{ stage.url }}" class="pf-c-nav__link {% is_active stage.view_name %}">
{{ stage.name }}
</a>
</li>
@ -43,7 +42,6 @@
<li class="pf-c-nav__item">
<a href="{{ source.view_name }}"
class="pf-c-nav__link {% if user_settings.view_name == request.get_full_path %} pf-m-current {% endif %}">
<i class="{{ source.icon }}"></i>
{{ source.name }}
</a>
</li>

View File

@ -8,8 +8,7 @@ class UIUserSettings:
"""Dataclass for Stage and Source's user_settings"""
name: str
icon: str
view_name: str
url: str
@dataclass

View File

@ -15,6 +15,7 @@ from django.views.decorators.clickjacking import xframe_options_sameorigin
from django.views.generic import TemplateView, View
from structlog import get_logger
from passbook.audit.models import sanitize_dict
from passbook.core.views.utils import PermissionDeniedView
from passbook.flows.exceptions import EmptyFlowException, FlowNonApplicableException
from passbook.flows.models import Flow, FlowDesignation, Stage
@ -161,7 +162,7 @@ class FlowExecutorView(View):
LOGGER.debug(
"f(exec): User passed all stages",
flow_slug=self.flow.slug,
context=self.plan.context,
context=sanitize_dict(self.plan.context),
)
return self._flow_done()

View File

@ -62,15 +62,9 @@ class OAuthSource(Source):
@property
def ui_user_settings(self) -> UIUserSettings:
icon_type = self.provider_type
if icon_type == "azure ad":
icon_type = "windows"
icon_class = f"fab fa-{icon_type}"
view_name = "passbook_sources_oauth:oauth-client-user"
return UIUserSettings(
name=self.name,
icon=icon_class,
view_name=reverse((view_name), kwargs={"source_slug": self.slug}),
name=self.name, url=reverse(view_name, kwargs={"source_slug": self.slug}),
)
def __str__(self) -> str:

View File

@ -1,5 +1,6 @@
"""OTP Stage"""
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext as _
from passbook.core.types import UIUserSettings
@ -20,9 +21,7 @@ class OTPStage(Stage):
@property
def ui_user_settings(self) -> UIUserSettings:
return UIUserSettings(
name="OTP",
icon="pficon-locked",
view_name="passbook_stages_otp:otp-user-settings",
name="OTP", url=reverse("passbook_stages_otp:otp-user-settings"),
)
def __str__(self):