Browse Source

First import of old templates, basic login/logout implemented

master
Niklas Brachmann 11 years ago
parent
commit
91ae916a4a
  1. BIN
      cash/static/images/cash-register-64x64.png
  2. 237
      cash/static/style.css
  3. 116
      cash/templates/cash/base.html
  4. 1
      cash/templates/cash/index.html
  5. 20
      cash/templates/cash/login.html
  6. 2
      cash/urls.py
  7. 6
      cash/views.py
  8. 3
      lugcash2/settings.py
  9. 8
      lugcash2/urls.py

BIN
cash/static/images/cash-register-64x64.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

237
cash/static/style.css

@ -0,0 +1,237 @@ @@ -0,0 +1,237 @@
body {
//background-image: url(bg.png);
//background-color: #ffe082;
//background-repeat: repeat-x;
background-color: #ffcc33;
}
body, td {
font-size: 12px;
font-family: sans-serif;
text-align: center;
}
a:hover {
text-decoration: underline;
}
a, a:visited {
color: #ff9000;
text-decoration: none;
}
a.menulink, a.menulink:visited {
//line-height: 20px;
}
a.menulink:hover {
//background-color: #ff00ff;
}
a.actionlink {
border: 2px solid #dcdcdc;
border-radius: 4px;
padding: 6px;
line-height: 42px;
}
a.actionlink:hover {
text-decoration: none;
background-color: #ffcc33;
color: #ffffff;
}
div.menulink {
width: 100%;
padding: 5px;
}
div.menulink:hover {
background-color: #efefef;
}
span.big {
font-size: 17px;
}
span.small-gray {
font-size: 10px;
color: #a0a0a0;
}
#outbox {
width: 750px;
margin: auto;
//border: 1px solid black;
}
#top {
margin-top: 30px;
width: 100%;
height: 10px;
background-color: #ffcc33;
}
#header {
float: left;
width: 460px;
height: 70px;
text-align: left;
padding: 20px;
//border: 1px solid black;
}
#topmenu {
margin-left: 500px;
background-color: #ffffff;
margin-top: 65px;
padding: 8px;
border-radius: 8px;
}
ul.topmenu {
padding: 0px;
margin: 0px;
}
li.topmenu {
display: inline;
padding-right: 10px;
}
#topclear {
clear: left;
width: 0px;
height: 0px;
}
#leftmenu {
float: left;
width: 170px;
text-align: left;
padding: 15px;
background-color: #dcdcdc;
/*margin-top: 20px;*/
height: 100%;
border-bottom-left-radius: 8px;
border-top-left-radius: 8px;
}
#content {
margin-left: 200px;
//margin-top: 20px;
text-align: left;
padding: 15px;
background-color: #ffffff;
height: 100%;
border-bottom-right-radius: 8px;
border-top-right-radius: 8px;
}
#contentclear {
clear: left;
width: 0px;
height: 0px;
}
#foot {
width: 100%;
color: #D37800;
padding: 3px;
text-align: center;
}
#content_bg {
border-radius: 8px;
background: url('menu_bg.png') repeat-y #ffffff;
}
#infoboxleft {
background-color: #efefef;
padding: 8px;
border-radius: 8px;
}
/*#content table {
background: #DCDCDC;
width: 100%;
border-collapse: collapse;
}
#content table th {
text-align: center;
border: 2px solid #ffffff;
}
#content table td {
text-align: left;
border: 2px solid #ffffff;
}*/
.txt_item {
width: 30px;
}
/* ************************* */
#content table {
border-collapse: collapse;
background-color: inherit;
width: 100%;
}
#content table td {
border-style: solid;
border-width: 0px;
border-bottom-width: 1px;
border-bottom-color: #dcdcdc;
text-align: center;
}
#content thead td, #content th {
font-weight: bold;
color: #a0a0a0;
text-align: center;
}
div.error {
background-color: #ff9393;
padding: 15px;
text-align: center;
margin-bottom: 20px;
color: #000000;
font-weight: normal;
border-radius: 5px;
}
div.success {
background-color: #93ff93;
padding: 15px;
text-align: center;
margin-bottom: 20px;
color: #000000;
font-weight: normal;
border-radius: 5px;
}
#content table.invisibletable {
border: 0px;
background-color: #ffffff;
}
#content table.invisibletable td {
border: none;
color: #000000;
font-weight: normal;
}

116
cash/templates/cash/base.html

@ -0,0 +1,116 @@ @@ -0,0 +1,116 @@
{% load staticfiles %}
<?xml version="1.0" encoding="utf8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" href="{% static "style.css" %}"/>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<script type="text/javascript">
function toggle_visible(id)
{
var elem = document.getElementById(id);
if(elem.style.display != 'none')
{
elem.style.display = 'none';
}
else
{
elem.style.display = 'inline';
}
}
</script>
<script type="text/javascript">
function calculate_sum() {
products = new Array();
//var p = {'id': {$items[item].id}, 'price': {$items[item].price}};
products.push(p);
sum = 0.0;
for(var i = 0; i < products.length; i++){
id = "item_"+products[i].id;
count = document.getElementById(id).value;
sum = sum + products[i].price*count;
}
document.getElementById('sum').innerHTML = sum.toFixed(2);
function modifyValue(id, n) {
var elem = document.getElementById(id);
var newval = parseInt(elem.value) + n;
if((newval >= 0) && (newval < 100))
elem.value = newval;
}
</script>
<title>Kassensystem - LUG Saar</title>
</head>
<body>
<div style="position: absolute; top: 110px; right: 43%; color: #ff0000; font-size: 36px; font-weight: bold;">
DEVELOPMENT
</div>
<div id="outbox">
<div id="top"></div>
<div id="header">
<img src="{% static "images/cash-register-64x64.png" %}" alt="kasse" /> <span style="font-size: 50px;">Kassensystem</span>
</div>
<div id="topmenu" onclick="javascript: bbb();">
<!--<a href="#">Home</a>&nbsp;&nbsp;<a href="#">Einstellungen</a>&nbsp;&nbsp;<a href="#">Logout</a>-->
<ul class="topmenu">
{% if user.is_authenticated %}
<li class="topmenu"><a href="index.php">Home</a></li>
<li class="topmenu"><a href="usersettings.php">Einstellungen</a></li>
<li class="topmenu"><a href="{% url django.contrib.auth.views.logout_then_login %}">Logout</a></li>
{% else %}
<li class="topmenu"><a href="{% url django.contrib.auth.views.login %}">Login</a></li>
{% endif %}
</ul>
</div>
<div id="topclear"></div>
<div id="content_bg">
<div id="leftmenu">
{% if user.is_authenticated and user.account %}
<div id="infoboxleft">
<span class="small-gray">Username:</span><br/>
<span class="big"><b>{{ user.username }}</b></span><br/><br/>
<span class="small-gray">Guthaben:</span><br/>
<span class="big" id="credit"{% if user.account.credit < 0 %} style="color: red"{% endif %}><b>{{ user.account.credit|floatformat:2 }} &euro;</b></span><br/>
{% if user.account.credit < 5 %}
<span class="small-gray" style="color: #FF5252">Achtung! Nur noch {{ user.account.credit|floatformat:2 }} &euro; bis zum Schuldenlimit.</span>
{% endif %}
</div>
<div class="menulink"><a class="menulink" href="/">Übersicht</a></div>
<div class="menulink"><a class="menulink" href="/buy/">Kaufen</a></div>
<div class="menulink"><a class="menulink" href="/statment/">Kontoauszug</a></div>
{% else %}
Einloggen um Menüfunktionen zu benutzen.
{% endif %}
</div>
<div id="content">
{% block content %}
<h1>Konto - Übersicht</h1>
{% endblock %}
</div>
<div id="contentclear"></div>
</div>
</div>
<div id="foot">cashonly v0815</div>
</div>
</body>
</html>

1
cash/templates/cash/index.html

@ -0,0 +1 @@ @@ -0,0 +1 @@
{% extends "cash/base.html" %}

20
cash/templates/cash/login.html

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
{% extends "cash/base.html" %}
{% block content %}
{% if form.errors %}
<p>Your username and password didn't match. Please try again.</p>
{% endif %}
<form method="post" action="{% url django.contrib.auth.views.login %}">
{% csrf_token %}
<label>{{ form.username.label_tag }}:<br/>
{{ form.username }}</label><br/>
<label>{{ form.password.label_tag }}:<br/>
{{ form.password }}</label><br/>
<input type="submit" value="login" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
{% endblock %}

2
cash/urls.py

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
from django.conf.urls import patterns, url
from cash import views
urlpatterns = patterns('',
url(r'^/?$', 'cash.views.overview', name='overview'),
url(r'^product/(?P<pk>\d+)/$', views.ProductView.as_view(), name='product'),
)

6
cash/views.py

@ -1,7 +1,13 @@ @@ -1,7 +1,13 @@
from django.views import generic
from django.shortcuts import render_to_response
from django.template import RequestContext
from cash.models import *
def overview(request):
return render_to_response('cash/index.html', context_instance=RequestContext(request))
class ProductView(generic.DetailView):
model = Product

3
lugcash2/settings.py

@ -156,3 +156,6 @@ LOGGING = { @@ -156,3 +156,6 @@ LOGGING = {
},
}
}
LOGIN_URL = '/login/'
LOGIN_REDIRECT_URL = '/'

8
lugcash2/urls.py

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
@ -15,6 +16,11 @@ urlpatterns = patterns('', @@ -15,6 +16,11 @@ urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
url(r'cash/', include('cash.urls')),
url(r'', include('cash.urls')),
url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'cash/login.html'}),
url(r'^logout/$', 'django.contrib.auth.views.logout_then_login'),
)
urlpatterns += staticfiles_urlpatterns()

Loading…
Cancel
Save