Add navbar to top of main template

Also, add stub functions to views to make all the links and reverse routes
work.
This commit is contained in:
Jason McBrayer 2018-04-24 19:20:22 -04:00
parent 267e94077f
commit 43e4726c2f
3 changed files with 43 additions and 3 deletions

View File

@ -11,6 +11,29 @@
<link rel="stylesheet" href="/static/css/brutaldon.css"> <link rel="stylesheet" href="/static/css/brutaldon.css">
</head> </head>
<body> <body>
{% block navbar %}
<nav class="navbar" role="navigation" aria-label="main navigation is-active">
<div class="navbar-brand">
<a class="navbar-item">
<img src="https://bulma.io/images/bulma-logo.png"
width="32" height="32" alt="Brutaldon">
</a>
<!-- navbar items, navbar burger... -->
</div>
<div class="navbar-menu">
<!-- navbar start, navbar end -->
<div class="navbar-start">
<a href="{% url "home" %}" class="navbar-item">Home</a>
<a class="navbar-item" href="{% url "note" %}">Notifications</a>
<a class="navbar-item" href="{% url "local" %}">Local</a>
<a class="navbar-item" href="{% url "fed" %}">Federated</a>
</div>
<div class="navbar-end" >
<a class="navbar-item" href="{% url "logout" %}">Log out</a>
</div>
</div>
</nav>
{% endblock %}
<section class="section"> <section class="section">
<div class="container"> <div class="container">
{% block content %} {% block content %}

View File

@ -19,8 +19,12 @@ from brutaldon import views
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('home/', views.home), path('home', views.home, name='home'),
path('login', views.login, name="login"), path('login', views.login, name="login"),
path('error', views.error), path('logout', views.logout, name='logout'),
path('error', views.error, name='error'),
path('note', views.note, name='note'),
path('local', views.local, name='local'),
path('fed', views.fed, name='fed'),
path('', views.home), path('', views.home),
] ]

View File

@ -83,5 +83,18 @@ def login(request):
else: else:
return render(request, 'setup/login.html', {'form': form}) return render(request, 'setup/login.html', {'form': form})
def logout(request):
return redirect(error)
def error(request): def error(request):
return render('error.html', { 'error': "Not logged in yet."}) return render(request, 'error.html', { 'error': "Not logged in yet."})
def note(request):
return render(request, 'main/timeline.html', {'timeline': 'Notifications'})
def local(request):
return render(request, 'main/timeline.html', {'timeline': 'Local'})
def fed(request):
return render(request, 'main/timeline.html', {'timeline': 'Federated'})