Code style
All checks were successful
Tests / test (push) Successful in 28s

This commit is contained in:
Tobias Kunze 2025-07-11 13:20:25 +02:00
parent 18dc93fd96
commit 5b876de18a
8 changed files with 59 additions and 52 deletions

View file

@ -3,8 +3,8 @@ import urlman
from django.conf import settings
from django.db import models, transaction
from django.utils.functional import cached_property
from django.utils.text import slugify
from django.utils.safestring import mark_safe
from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _
from django_scopes import ScopedManager, scopes_disabled

View file

@ -1,21 +1,22 @@
{% extends "frontend/base.html" %}
{% load static i18n %}
{% load allauth account socialaccount %}
{% block html_title %}
{% translate "Sign in" %}
{% endblock html_title %}
{% block page_title %}
{% translate "Welcome to Servala" %}
{% endblock page_title %}
{% block card_header %}
<div class="card-header text-center py-4" style="background: linear-gradient(135deg, var(--bs-primary), #8B5CF6); border-radius: 0.5rem 0.5rem 0 0;">
<img src="{% static 'img/Servala-4.png' %}" alt="Servala" class="mb-3" style="height: 70px;">
<div class="card-header text-center py-4"
style="background: linear-gradient(135deg, var(--bs-primary), #8B5CF6);
border-radius: 0.5rem 0.5rem 0 0">
<img src="{% static 'img/Servala-4.png' %}"
alt="Servala"
class="mb-3"
style="height: 70px">
</div>
{% endblock card_header %}
{% block card_content %}
<!-- Main Sign In Section -->
{% if SOCIALACCOUNT_ENABLED %}
@ -24,9 +25,10 @@
<div class="mb-4">
<div class="text-center mb-4">
<h5 class="text-primary mb-2">{% translate "Ready to get started?" %}</h5>
<p class="text-muted mb-0">{% translate "Sign in to access your managed service instances and the Servala service catalog" %}</p>
<p class="text-muted mb-0">
{% translate "Sign in to access your managed service instances and the Servala service catalog" %}
</p>
</div>
{% for provider in socialaccount_providers %}
{% provider_login_url provider process=process scope=scope auth_params=auth_params as href %}
<form method="post" action="{{ href }}">
@ -35,7 +37,9 @@
<button type="submit"
class="btn btn-primary btn-lg w-100 py-3 mb-4 fw-semibold"
title="{{ provider.name }}"
style="border-radius: 12px; box-shadow: 0 4px 15px rgba(154, 99, 236, 0.2); background: linear-gradient(135deg, var(--bs-primary), #8B5CF6);">
style="border-radius: 12px;
box-shadow: 0 4px 15px rgba(154, 99, 236, 0.2);
background: linear-gradient(135deg, var(--bs-primary), #8B5CF6)">
<span>{% translate "Sign in with VSHN Account" %}</span>
</button>
</form>
@ -43,7 +47,6 @@
</div>
{% endif %}
{% endif %}
<!-- Feature Preview & Learn More Section -->
<div class="mt-4 pt-3 border-top">
<div class="row g-3 text-center">
@ -72,8 +75,8 @@
<i class="bi bi-info-circle" style="font-size: 1.2rem;"></i>
</div>
<small class="text-muted fw-medium">
<a href="https://servala.com"
target="_blank"
<a href="https://servala.com"
target="_blank"
class="text-decoration-none text-muted">
{% translate "Learn more" %}
<i class="bi bi-arrow-up-right ms-1" style="font-size: 0.7rem;"></i>
@ -82,7 +85,6 @@
</div>
</div>
</div>
<!-- Alternative Login Options (Admin) -->
<div class="mt-4 pt-3 border-top text-center">
<small class="text-muted">
@ -96,7 +98,6 @@
</a>
</small>
</div>
<div class="collapse mt-3" id="login-form">
<div class="card bg-light border-0 shadow-sm" style="border-radius: 12px;">
<div class="card-body p-4">

View file

@ -5,13 +5,18 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{% static 'mazer/compiled/css/app.css' %}">
<link rel="stylesheet" href="{% static 'mazer/compiled/css/app-dark.css' %}">
<link rel="stylesheet"
href="{% static 'mazer/compiled/css/app-dark.css' %}">
<link rel="stylesheet" href="{% static 'mazer/compiled/css/iconly.css' %}">
<link rel="stylesheet" href="{% static 'css/servala.css' %}">
<link rel="icon" type="image/x-icon" href="{% static 'img/favicon.ico' %}">
<script src="{% static "js/htmx.min.js" %}" defer></script>
</head>
<title>{% block html_title %}Dashboard{% endblock html_title %} Servala</title>
<title>
{% block html_title %}
Dashboard
{% endblock html_title %}
Servala</title>
</head>
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
<script src="{% static 'mazer/static/js/initTheme.js' %}"></script>

View file

@ -116,7 +116,8 @@
{% endblocktranslate %}
</p>
<div>
<a href="{{ account_href }}" target="_blank"
<a href="{{ account_href }}"
target="_blank"
class="btn btn-primary btn-lg icon icon-left btn-keycloak">
<span class="mx-1">{% translate "VSHN Account Console" %}</span>
</a>

View file

@ -1,14 +1,12 @@
{% if show_error %}
<div class="{{ css_class }}">
{% if has_list %}
{% if message %}{{ message }}{% endif %}
<ul>
{% for error in errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% else %}
{{ message }}
{% endif %}
</div>
<div class="{{ css_class }}">
{% if has_list %}
{% if message %}{{ message }}{% endif %}
<ul>
{% for error in errors %}<li>{{ error }}</li>{% endfor %}
</ul>
{% else %}
{{ message }}
{% endif %}
</div>
{% endif %}

View file

@ -1,28 +1,29 @@
<div class="alert alert-{{ message.tags }} alert-dismissible" id="auto-dismiss-alert-{{ forloop.counter0|default:'0' }}">
<div class="alert alert-{{ message.tags }} alert-dismissible"
id="auto-dismiss-alert-{{ forloop.counter0|default:'0' }}">
{{ message }}
<button type="button"
class="btn-close"
data-bs-dismiss="alert"
aria-label="Close"></button>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const alert = document.getElementById('auto-dismiss-alert-{{ forloop.counter0|default:'0' }}');
if (alert && !alert.classList.contains('alert-danger')) {
setTimeout(function() {
let opacity = 1;
const fadeOutInterval = setInterval(function() {
if (opacity > 0.05) {
opacity -= 0.05;
alert.style.opacity = opacity;
} else {
clearInterval(fadeOutInterval);
const bsAlert = new bootstrap.Alert(alert);
bsAlert.close();
}
}, 25);
}, 5000);
}
});
</script>
document.addEventListener('DOMContentLoaded', function() {
const alert = document.getElementById('auto-dismiss-alert-{{ forloop.counter0|default:'
0 ' }}');
if (alert && !alert.classList.contains('alert-danger')) {
setTimeout(function() {
let opacity = 1;
const fadeOutInterval = setInterval(function() {
if (opacity > 0.05) {
opacity -= 0.05;
alert.style.opacity = opacity;
} else {
clearInterval(fadeOutInterval);
const bsAlert = new bootstrap.Alert(alert);
bsAlert.close();
}
}, 25);
}, 5000);
}
});
</script>

View file

@ -3,6 +3,7 @@ Template filters for safe error formatting.
"""
import html
from django import template
from django.utils.safestring import mark_safe

View file

@ -52,7 +52,7 @@ class SupportView(OrganizationViewMixin, FormView):
mark_safe(
_(
"There was an error submitting your support request. "
"Please try again or contact us directly at <a href=\"mailto:servala-support@vshn.ch\">servala-support@vshn.ch</a>."
'Please try again or contact us directly at <a href="mailto:servala-support@vshn.ch">servala-support@vshn.ch</a>.'
)
),
)