Skip to content

Commit

Permalink
Merge pull request #60 from Go-In/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
monthol8th authored Sep 29, 2017
2 parents 93ebd50 + d768946 commit 81662f7
Show file tree
Hide file tree
Showing 16 changed files with 129 additions and 200 deletions.
3 changes: 3 additions & 0 deletions go_coup/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def groups(request):
groups = list(request.user.groups.values_list('name', flat=True))
return {'is_customer':'customer' in groups, 'is_store':'store' in groups}
1 change: 1 addition & 0 deletions go_coup/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'go_coup.context_processors.groups'
],
},
},
Expand Down
14 changes: 14 additions & 0 deletions static/css/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
.black-ribbon {
position: fixed;
z-index: 9999;
width: 70px;
}
@media only all and (min-width: 768px) {
.black-ribbon {
width: auto;
}
}

.stick-left { left: 0; }
.stick-bottom { bottom: 0; }
.logo-nav {
width: 40px;
}
Expand Down Expand Up @@ -28,6 +41,7 @@
padding: 10px 20px;
font-size: 18px;
cursor: pointer;
height: 100%;
}
.nav-btn:hover {
background: #f51c61;
Expand Down
Binary file added static/images/black_ribbon_bottom_left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion templates/components/footer.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{% load staticfiles %}
<div class="footer">
<div class="container">
<div class="footer-right">
<div class="nav-btn">contact us</div>
</div>
</div>
</div>
<img alt="ribbon" src="{% static 'images/black_ribbon_bottom_left.png' %}" class="black-ribbon stick-bottom stick-left"/>
</body>
</html>
</html>
36 changes: 24 additions & 12 deletions templates/components/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,35 @@
</div>
</div>
<div class="right">
<div class="nav-btn">
{% if user.is_authenticated %}
{% if user.is_authenticated %}
<div class="nav-btn">
<a href="/profile">
Profile
<img class="logo-nav" src="../../static/images/profile.png" alt="">
</a>
{% else %}
<a href="/user/signin">
Sign In
</div>
<div class="nav-btn" onclick="goToCart()">
<a href="#">
<img class="logo-nav" src="{% static 'images/cart.png' %}" alt="">
</a>
</div>
<div class="nav-btn">
<a href="{% url 'user:logout' %}">
Logout
</a>
{% endif %}
</div>
<div class="nav-btn" onclick="goToCart()">
<a href="#">
<img class="logo-nav" src="{% static 'images/cart.png' %}" alt="">
</a>
</div>
</div>
{% else %}
<a href="/user/login">
<div class="nav-btn">
Login
</div>
</a>
<a href="/user/register">
<div class="nav-btn">
Register
</div>
</a>
{% endif %}
</div>
</div>
</div>
Expand Down
28 changes: 0 additions & 28 deletions templates/index/login.html

This file was deleted.

33 changes: 33 additions & 0 deletions templates/usermanage/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!-- <form action="" method="POST">
{% csrf_token %}
<input type="text" name="username" /><br />
<input type="password" name="password" /> <br />
<input type="submit" value="Signin" />
</form> -->

{% load staticfiles %}
{% include 'components/header.html' %}
<div class="full-container">

<div class="content row">
<div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-12 login-wrapper">
<div class="login">
<div class="login-header">LOGIN</div>
<form action="" method="POST">
{% csrf_token %}
<input type="text" class="form-control login-input" id="username" name="username" placeholder="username">
<input type="password" class="form-control login-input" id="password" name="password" placeholder="password">
<center>
<button class="btn btn-gocoup login-btn">login</button>
</form>
<a href="{% url 'user:customer-register' %}" class="btn btn-gocoup signup-btn">register</a></br>
<a href="#" style="font-size:12px;">Forget password?</a>
</center>
<br>
</div>
</div>
</div>
</div>

</div>
{% include 'components/footer.html' %}
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,7 @@

{% load staticfiles %}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="{% static 'css/style.css' %}">
<link rel="stylesheet" href="{% static 'css/login.css' %}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<title>Go Coup</title>
</head>
<body>
<div class="header">
<div class="container">
<div class="navigation">
<div class="left">
<div class="nav-btn">
<a href="/">
<img class="logo" src="{% static 'images/logo-white.png' %}" alt="logo">
</a>
</div>
</div>
<div class="right">
<div class="nav-btn">
{% if user.is_authenticated %}
<a href="/profile">
Profile
<img class="logo-nav" src="{% static 'images/profile.png' %}" alt="">
</a>
{% else %}
<a href="/user/signin">
Sign In
</a>
{% endif %}
</div>
<div class="nav-btn">
<img class="logo-nav" src="{% static 'images/cart.png' %}" alt="">
</div>
</div>
</div>
</div>
</div>
{% include 'components/header.html' %}
<div class="full-container">

<div class="content row">
Expand Down Expand Up @@ -98,12 +55,5 @@
</div>

</div>
<div class="footer">
<div class="container">
<div class="footer-right">
<div class="nav-btn">contact us</div>
</div>
</div>
</div>
</body>
</html>
{% include 'components/footer.html' %}

File renamed without changes.
85 changes: 0 additions & 85 deletions templates/usermanage/signin.html

This file was deleted.

25 changes: 25 additions & 0 deletions usermanage/migrations/0010_auto_20170929_1421.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-29 14:21
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('usermanage', '0009_merge_20170928_1444'),
]

operations = [
migrations.AddField(
model_name='customer',
name='tel',
field=models.CharField(max_length=12, null=True),
),
migrations.AddField(
model_name='store',
name='tel',
field=models.CharField(max_length=12, null=True),
),
]
2 changes: 2 additions & 0 deletions usermanage/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ class Customer(models.Model):
first_name = models.CharField(max_length=30, null=True)
last_name = models.CharField(max_length=30, null=True)
birthdate = models.DateField(null=True)
tel = models.CharField(max_length=12, null=True)
def __str__(self):
return self.user

class Store(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
store_name = models.CharField(max_length=30)
tel = models.CharField(max_length=12, null=True)
def __str__(self):
return self.user

Expand Down
8 changes: 4 additions & 4 deletions usermanage/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from . import models

class usermanageViewsTestCase(TestCase):
def test_user_signup(self):
resp = self.client.get('/user/signup', follow = True)
def test_user_register(self):
resp = self.client.get('/user/register', follow = True)
self.assertEqual(resp.status_code, 200)

def test_store_signup(self):
resp = self.client.get('/user/store-signup', follow = True)
def test_store_register(self):
resp = self.client.get('/user/store-register', follow = True)
self.assertEqual(resp.status_code, 200)

def test_user_str(self):
Expand Down
10 changes: 5 additions & 5 deletions usermanage/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

app_name = 'user'
urlpatterns = [
url(r'^signup/$', views.customerSignup, name='customer-signup'),
url(r'^store-signup/$', views.storeSignup, name='store-signup'),
url(r'^signin/$',views.signin, name='signin'),
url(r'^signout/$',views.signout, name='signout'),
url(r'^register/$', views.customerRegister, name='customer-register'),
url(r'^store-register/$', views.storeRegister, name='store-register'),
url(r'^login/$',views.singin, name='login'),
url(r'^logout/$',views.signout, name='logout'),
url(r'^tempprofile/$',views.profile, name='profile'),
url(r'^profile/$',views.customerProfile, name='customer-profile'),
url(r'^customertest/$',views.customertest, name='customertest'),
url(r'^storetest/$',views.storetest, name='storetest'),
url(r'^setting/$',views.customerSetting, name='customer-setting'),
url(r'^setting/$',views.customerSetting, name='customer-setting'),
]
Loading

0 comments on commit 81662f7

Please sign in to comment.