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): class IndexView(TemplateView):
template_name = f"{settings.EXPEPHALON_FRONTEND}/index.html" 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): class DashboardView(TemplateView):
template_name = f"{settings.EXPEPHALON_BACKEND}/index.html" 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): class BackendNotImplementedView(TemplateView):
template_name = f"{settings.EXPEPHALON_BACKEND}/notimplemented.html" 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 redirect(request.GET.get("next", "dashboard"))
return super().get(request, *args, **kwargs) 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): def form_valid(self, form):
user = authenticate(username=form.cleaned_data['email'],password=form.cleaned_data['password']) user = authenticate(username=form.cleaned_data['email'],password=form.cleaned_data['password'])
if user: if user:
@ -59,6 +64,11 @@ class OTPSelectorView(FormView):
self.clean_session() self.clean_session()
return redirect("login") 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): class OTPValidatorView(FormView):
template_name = f"{settings.EXPEPHALON_BACKEND}/auth/otp_verifier.html" template_name = f"{settings.EXPEPHALON_BACKEND}/auth/otp_verifier.html"
form_class = OTPVerificationForm 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.") 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") 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): class LogoutView(View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
logout(request) logout(request)

View file

@ -9,22 +9,42 @@ try:
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/index.html" template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/index.html"
model = Setting model = Setting
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Database Settings"
return context
class DBSettingsEditView(UpdateView): class DBSettingsEditView(UpdateView):
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/update.html" template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/update.html"
model = Setting model = Setting
success_url = reverse_lazy("dbsettings") success_url = reverse_lazy("dbsettings")
fields = ["key", "value"] fields = ["key", "value"]
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Edit Setting"
return context
class DBSettingsDeleteView(DeleteView): class DBSettingsDeleteView(DeleteView):
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/delete.html" template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/delete.html"
model = Setting model = Setting
success_url = reverse_lazy("dbsettings") 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): class DBSettingsCreateView(CreateView):
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/create.html" template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/create.html"
model = Setting model = Setting
success_url = reverse_lazy("dbsettings") success_url = reverse_lazy("dbsettings")
fields = ["key", "value"] fields = ["key", "value"]
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Create Setting"
return context
except ModuleNotFoundError: except ModuleNotFoundError:
pass 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 static %}
{% load dbsetting %}
{% dbsetting "core.title" as sitetitle %}
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
@ -7,10 +9,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Language" content="en"> <meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <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="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 --> <!-- Disable tap highlight on IE -->
<meta name="msapplication-tap-highlight" content="no"> <meta name="msapplication-tap-highlight" content="no">
@ -26,10 +28,10 @@
<div class="slider-light"> <div class="slider-light">
<div class="slick-slider"> <div class="slick-slider">
<div> <div>
<div class="position-relative h-100 d-flex justify-content-center align-items-center bg-plum-plate" tabindex="-1"> <div class="position-relative h-100 d-flex justify-content-center align-items-center bg-deep-blue" tabindex="-1">
<div class="slide-img-bg" style="background-image: url('assets/images/originals/city.jpg');"></div> <div class="slide-img-bg"></div>
<div class="slider-content"><h3>Perfect Balance</h3> <div class="slider-content"><h3>{{ sitetitle }}</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> <p>{{ sitetitle }} is like a dream. Some think it's too good to be true!</p></div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,5 +1,7 @@
{% load static %} {% load static %}
{% load navigation %} {% load navigation %}
{% load dbsetting %}
{% dbsetting "core.title" as sitetitle %}
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
@ -8,7 +10,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Language" content="en"> <meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <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="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="description" content="This is an example dashboard created using build-in elements and components.">
<meta name="msapplication-tap-highlight" content="no"> <meta name="msapplication-tap-highlight" content="no">

View file

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

View file

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

View file

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