Make page titles dynamic

Remove unused files
Fix buttons in dbsettings
This commit is contained in:
Kumi 2020-04-16 11:02:22 +02:00
parent 0e7bfb617e
commit 8eab735bd8
18 changed files with 65 additions and 11 deletions

View file

@ -10,8 +10,23 @@ from core.views.auth import *
class IndexView(TemplateView):
template_name = f"{settings.EXPEPHALON_FRONTEND}/index.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Home"
return context
class DashboardView(TemplateView):
template_name = f"{settings.EXPEPHALON_BACKEND}/index.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Dashboard"
return context
class BackendNotImplementedView(TemplateView):
template_name = f"{settings.EXPEPHALON_BACKEND}/notimplemented.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Oops!"
return context

View file

@ -18,6 +18,11 @@ class LoginView(FormView):
return redirect(request.GET.get("next", "dashboard"))
return super().get(request, *args, **kwargs)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Login"
return context
def form_valid(self, form):
user = authenticate(username=form.cleaned_data['email'],password=form.cleaned_data['password'])
if user:
@ -59,6 +64,11 @@ class OTPSelectorView(FormView):
self.clean_session()
return redirect("login")
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Two-Factor Authentication"
return context
class OTPValidatorView(FormView):
template_name = f"{settings.EXPEPHALON_BACKEND}/auth/otp_verifier.html"
form_class = OTPVerificationForm
@ -107,6 +117,11 @@ class OTPValidatorView(FormView):
messages.error(self.request, "Incorrect token entered. Please try again. If the issue persists, contact support to regain access to your account.")
return redirect("login")
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Two-Factor Authentication"
return context
class LogoutView(View):
def get(self, request, *args, **kwargs):
logout(request)

View file

@ -9,22 +9,42 @@ try:
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/index.html"
model = Setting
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Database Settings"
return context
class DBSettingsEditView(UpdateView):
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/update.html"
model = Setting
success_url = reverse_lazy("dbsettings")
fields = ["key", "value"]
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Edit Setting"
return context
class DBSettingsDeleteView(DeleteView):
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/delete.html"
model = Setting
success_url = reverse_lazy("dbsettings")
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Delete Setting"
return context
class DBSettingsCreateView(CreateView):
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/create.html"
model = Setting
success_url = reverse_lazy("dbsettings")
fields = ["key", "value"]
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Create Setting"
return context
except ModuleNotFoundError:
pass

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -1,4 +1,6 @@
{% load static %}
{% load dbsetting %}
{% dbsetting "core.title" as sitetitle %}
<!doctype html>
<html lang="en">
@ -7,10 +9,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Login - ArchitectUI HTML Bootstrap 4 Dashboard Template</title>
<title>{% if title %}{{ title }} - {% endif %}{{ sitetitle }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no"
/>
<meta name="description" content="ArchitectUI HTML Bootstrap 4 Dashboard Template">
<!-- Disable tap highlight on IE -->
<meta name="msapplication-tap-highlight" content="no">
@ -26,10 +28,10 @@
<div class="slider-light">
<div class="slick-slider">
<div>
<div class="position-relative h-100 d-flex justify-content-center align-items-center bg-plum-plate" tabindex="-1">
<div class="slide-img-bg" style="background-image: url('assets/images/originals/city.jpg');"></div>
<div class="slider-content"><h3>Perfect Balance</h3>
<p>ArchitectUI is like a dream. Some think it's too good to be true! Extensive collection of unified React Boostrap Components and Elements.</p></div>
<div class="position-relative h-100 d-flex justify-content-center align-items-center bg-deep-blue" tabindex="-1">
<div class="slide-img-bg"></div>
<div class="slider-content"><h3>{{ sitetitle }}</h3>
<p>{{ sitetitle }} is like a dream. Some think it's too good to be true!</p></div>
</div>
</div>
</div>

View file

@ -1,5 +1,7 @@
{% load static %}
{% load navigation %}
{% load dbsetting %}
{% dbsetting "core.title" as sitetitle %}
<!doctype html>
<html lang="en">
@ -8,7 +10,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>{% if title %}{{ title }} - {% endif %}Expephalon</title>
<title>{% if title %}{{ title }} - {% endif %}{{ sitetitle }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no" />
<meta name="description" content="This is an example dashboard created using build-in elements and components.">
<meta name="msapplication-tap-highlight" content="no">

View file

@ -37,7 +37,7 @@
{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button type="button" class="btn-shadow mr-3 btn btn-success">
<button type="submit" class="btn-shadow mr-3 btn btn-success">
<i class="fa fa-check"></i> Save
</button>
<a href="{% url "dbsettings" %}" class="btn-shadow mr-3 btn btn-danger">

View file

@ -37,7 +37,7 @@
{% csrf_token %}
Are you sure you wish to delete {{ object.key }}?
{% buttons %}
<button type="button" class="btn-shadow mr-3 btn btn-success">
<button type="submit" class="btn-shadow mr-3 btn btn-success">
<i class="fa fa-check"></i> Save
</button>
<a href="{% url "dbsettings" %}" class="btn-shadow mr-3 btn btn-danger">

View file

@ -37,7 +37,7 @@
{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button type="button" class="btn-shadow mr-3 btn btn-success">
<button type="submit" class="btn-shadow mr-3 btn btn-success">
<i class="fa fa-check"></i> Save
</button>
<a href="{% url "dbsettings" %}" class="btn-shadow mr-3 btn btn-danger">