add sidebar nav, fixes
This commit is contained in:
@@ -14,6 +14,7 @@ Events
|
||||
<ul class="list-group">
|
||||
{% for event in events %}
|
||||
<li class="list-group-item">
|
||||
<h6>{{ event.away_team|default_if_none:"" }} vs. {{ event.home_team|default_if_none:"" }}</h6>
|
||||
{{ event.start.date }}<br>{{ event.start.time }}<br>
|
||||
<a href="{% url 'edit lineup' event_id=event.id %}">Edit Lineup...</a>
|
||||
</li>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
{% block content %}
|
||||
<ul class="list-group">
|
||||
{% for object in object_list %}
|
||||
{% for object in object_list|dictsort:"name.lower" %}
|
||||
<li class="list-group-item">{{ object }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
@@ -4,9 +4,9 @@ from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('lineup/edit/<int:event_id>', views.lineup_edit, name="edit lineup"),
|
||||
path('events/list', views.EventListView.as_view(), name="event list"),
|
||||
path('events/list/', views.EventListView.as_view(), name="event list"),
|
||||
path('events/<int:pk>/detail', views.EventDetailView.as_view(), name="event detail"),
|
||||
path('players/list', views.PlayerListView.as_view(), name="player list"),
|
||||
path('teams/list', views.TeamListView.as_view(), name="team list"),
|
||||
path('venues/list', views.VenueListView.as_view(), name="venue list")
|
||||
path('players/list/', views.PlayerListView.as_view(), name="player list"),
|
||||
path('teams/list/', views.TeamListView.as_view(), name="team list"),
|
||||
path('venues/list/', views.VenueListView.as_view(), name="venue list")
|
||||
]
|
||||
@@ -133,4 +133,4 @@ MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
|
||||
LOGIN_URL = "/login"
|
||||
LOGIN_REDIRECT_URL = ""
|
||||
LOGIN_REDIRECT_URL = "/"
|
||||
@@ -18,12 +18,13 @@ from django.urls import path, include
|
||||
from django.conf.urls.static import static
|
||||
from django.conf import settings
|
||||
|
||||
from .views import welcome, login
|
||||
from .views import welcome, login_view
|
||||
|
||||
urlpatterns = [
|
||||
path("", welcome, name="home"),
|
||||
path("", include("benchcoach.urls")),
|
||||
path("admin/", admin.site.urls),
|
||||
path("teamsnap/", include("teamsnap.urls")),
|
||||
path("login", login, name="login"),
|
||||
path("login", login_view, name="login_view"),
|
||||
path("welcome", welcome, name="welcome")
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
@@ -5,11 +5,11 @@ from django.contrib.auth.decorators import login_required
|
||||
|
||||
@login_required()
|
||||
def welcome(request):
|
||||
pages = ['event list', 'team list', 'venue list', 'player list', 'teamsnap home', 'login']
|
||||
pages = ['event list', 'team list', 'venue list', 'player list', 'teamsnap home', 'login_view']
|
||||
return render(request,'home.html',{'pages':pages})
|
||||
|
||||
|
||||
def login(request):
|
||||
def login_view(request):
|
||||
if request.method == 'POST':
|
||||
username = request.POST.get('username')
|
||||
password = request.POST.get('password')
|
||||
@@ -17,11 +17,10 @@ def login(request):
|
||||
try:
|
||||
user = authenticate(request, username=username, password=password)
|
||||
if user is not None:
|
||||
print('Login')
|
||||
login(request, user)
|
||||
return redirect(reverse('home'))
|
||||
else:
|
||||
print("Someone tried to login and failed.")
|
||||
print("Someone tried to login_view and failed.")
|
||||
print("They used username: {} and password: {}".format(username, password))
|
||||
|
||||
return redirect('/')
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
<body class="bg-light">
|
||||
|
||||
<header class="min-vw-100">
|
||||
<div>
|
||||
{% block navbar %}
|
||||
{% include 'navbar.html' %}
|
||||
@@ -19,13 +19,15 @@
|
||||
{% block header %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="row flex-row flex-nowrap">
|
||||
<div class="col-auto">
|
||||
<div class="d-inline-flex min-vw-100">
|
||||
<div class="">
|
||||
{% block sidebar %}
|
||||
{% include 'sidebar.html' %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div class="container my-2 col-sm min-vh-100">
|
||||
<div class="container m-2">
|
||||
<h1>{% block page_heading %}{% endblock %}</h1>
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
@@ -1,25 +1,11 @@
|
||||
{% extends "base.html" %}{% load static %}
|
||||
|
||||
{% block title %}Bench Coach Home{% endblock %}
|
||||
{% block sidebar %}
|
||||
|
||||
<div class="d-flex flex-column flex-shrink-0 p-3 text-white bg-dark min-vh-100 " style="width: 200px;">
|
||||
<ul class="nav nav-pills flex-column mb-auto">
|
||||
{% for page in pages %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-white" style="text-transform:capitalize;" href="{% url page %}"
|
||||
aria-current="page">{{ page }} </a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="text-center my-2">
|
||||
<h1><img class="mx-auto" src="{% static 'benchcoach.svg' %}" style="width: 64px;" /><strong>Welcome to Bench Coach</strong></h1>
|
||||
<div class="col-lg-6 m-auto">
|
||||
<p class="lead mb-4 d-none">Quisque at curabitur mollis ornare, malesuada maecenas. Orci elit tristique, malesuada eu pharetra. Est praesent tortor porttitor aptent, amet quisque.</p>
|
||||
<p class="lead mb-4">Quisque at curabitur mollis ornare, malesuada maecenas. Orci elit tristique, malesuada eu pharetra. Est praesent tortor porttitor aptent, amet quisque.</p>
|
||||
{# <div class="d-grid gap-2 d-sm-flex justify-content-sm-center mx-1">#}
|
||||
{# <button class="btn btn-primary" type="button">Login</button><button class="btn btn-outline-secondary" type="button">Sign Up</button>#}
|
||||
{# </div>#}
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
{% block title %}Bench Coach Home{% endblock %}
|
||||
|
||||
{% block sidebar %}{% endblock %}
|
||||
{% block content %}
|
||||
<div class="text-center d-flex flex-column justify-content-center align-items-center mb-4">
|
||||
<form style="width: 100%; max-width: 330px; padding: 15px; margin: 0 auto;"
|
||||
method="post" action="{% url "login" %}">
|
||||
method="post" action="{% url "login_view" %}">
|
||||
{% csrf_token %}
|
||||
|
||||
<img class="mb-4" src="{% static "benchcoach.svg" %}" width="72" height="72"/>
|
||||
|
||||
39
templates/sidebar.html
Normal file
39
templates/sidebar.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<div class="bg-dark min-vh-100" >
|
||||
<ul class="nav nav-pills flex-column mb-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{ events_tab }} text-white" href="{% url 'event list' %}">
|
||||
<div class="d-inline-block">
|
||||
<i class="bi bi-calendar3"></i>
|
||||
<span class="d-none d-print-inline-block d-sm-inline-block d-md-inline-block d-lg-inline-block d-xl-inline-block d-xxl-inline-block mx-1 my-auto text-white">
|
||||
Events
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{ members_tab }} text-white" href="{% url 'player list' %}">
|
||||
<i class="bi bi-person-fill"></i>
|
||||
<span class="d-none d-print-inline-block d-sm-inline-block d-md-inline-block d-lg-inline-block d-xl-inline-block d-xxl-inline-block mx-1 my-auto text-white">
|
||||
Players
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{ opponents_tab }} text-white" href="{% url 'team list' %}">
|
||||
<i class="bi bi-people-fill"></i>
|
||||
<span class="d-none d-print-inline-block d-sm-inline-block d-md-inline-block d-lg-inline-block d-xl-inline-block d-xxl-inline-block mx-1 my-auto text-white">
|
||||
Teams
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{ venues_tab }} text-white" href="{% url 'venue list' %}">
|
||||
<i class="bi bi-geo"></i>
|
||||
<span class="d-none d-print-inline-block d-sm-inline-block d-md-inline-block d-lg-inline-block d-xl-inline-block d-xxl-inline-block mx-1 my-auto text-white">
|
||||
Venues
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
Reference in New Issue
Block a user