[TASK] Restructure views, add more urls.

This commit is contained in:
Jan Philipp Timme 2014-07-27 19:46:43 +02:00
parent d71d101fb8
commit b233e3ea90
8 changed files with 82 additions and 50 deletions

View File

@ -5,12 +5,14 @@ from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
from frontend.views import MainSite
from frontend.views import IndexView, RegisterView, LoginView
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'citavi_mapper.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', MainSite.as_view(), name='frontend-index'),
url(r'^$', IndexView.as_view(), name='frontend-index'),
url(r'^register/', RegisterView.as_view(), name='frontend-register'),
url(r'^login/', LoginView.as_view(), name='frontend-login'),
url(r'^admin/', include(admin.site.urls)),
)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,42 +0,0 @@
{% load staticfiles compressed %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Merging Citavi projects and mapping existing datasets.">
<title>{% block title %}Citavi Mapper :: {{title}}{% endblock %}</title>
<!-- Bootstrap core CSS with overrides. -->
{% compressed_css 'bootstrap' %}
{% compressed_js 'bootstrap' %}
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
<span class="sr-only">Toggle navigation</span> <span
class="icon-bar"></span> <span class="icon-bar"></span> <span
class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Citavi Mapper :: {{title}}</a>
</div>
</div>
</nav>
<div class="page-header">
<div id="header" class="container">
<img src="{% static 'images/logo.png' %}" class="hidden-sm hidden-xs">
<h1>{{page.title}}</h1>
<p>{{page.lead}}</p>
</div>
</div>
<div id="content" class="container">
{% block content %}{% endblock %}
</div>
<div id="footer">
afsfooooter
</div>
</body>
</html>

View File

@ -0,0 +1,7 @@
{% extends "layout/base.html" %}
{% block content %}
<p>
Welcome to Citavi Mapper!<br>
Feel free to discover.
</p>
{% endblock %}

View File

@ -0,0 +1,40 @@
{% load staticfiles compressed %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Merging Citavi projects and mapping existing datasets.">
<title>{% block title %}{{page_name}} :: {{page_title}}{% endblock %}</title>
<!-- Bootstrap -->
{% compressed_css 'bootstrap' %}
{% compressed_js 'bootstrap' %}
<!-- /Bootstrap -->
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="/">{{page_name}}</a>
<ul class="nav navbar-nav">
<li><a href="/">Index</a></li>
<li><a href="/register">Register</a></li>
<li><a href="/login">Login</a></li>
</ul>
</div>
</div>
</nav>
<div class="page-header">
<div id="header" class="container">
<h1>{{page_title}}</h1>
</div>
</div>
<div id="content" class="container">
{% block content %}{% endblock %}
</div>
<div id="footer">
{% block footer %}{% endblock %}
</div>
</body>
</html>

View File

@ -0,0 +1,6 @@
{% extends "layout/base.html" %}
{% block content %}
<p>
LOGIN FORM HERE
</p>
{% endblock %}

View File

@ -0,0 +1,6 @@
{% extends "layout/base.html" %}
{% block content %}
<p>
REGISTER FORM HERE
</p>
{% endblock %}

View File

@ -2,16 +2,29 @@
from django.views.generic import TemplateView
class MainSite(TemplateView):
class BaseSiteView(TemplateView):
template_name = "base.html"
page_name = "Citavi Mapper"
page_title = "BASE"
def get(self, request, **kwargs):
self._request = request
return super(MainSite, self).get(request, **kwargs)
return super(BaseSiteView, self).get(request, **kwargs)
def get_context_data(self, **kwargs):
context = super(MainSite, self).get_context_data(**kwargs)
context['title'] = 'Titeltest'
context['content'] = 'Foobar!'
context['headline'] = 'Yo!'
context = super(BaseSiteView, self).get_context_data(**kwargs)
context['page_name'] = self.page_name
context['page_title'] = self.page_title
return context
class IndexView(BaseSiteView):
template_name = "index.html"
page_title = "Index"
class RegisterView(BaseSiteView):
template_name = "register.html"
page_title = "Register"
class LoginView(BaseSiteView):
template_name = "login.html"
page_title = "Login"