Commit d4fa7172 authored by Rafal's avatar Rafal

add front

parent 42b4f077
...@@ -5,7 +5,7 @@ from django.conf.urls.static import static ...@@ -5,7 +5,7 @@ from django.conf.urls.static import static
from BeHub import settings from BeHub import settings
from Hub import views as hub_views from Hub import views as hub_views
from Hub.views import login_page from Hub.views import login_page, main_page, dashboard
router = routers.DefaultRouter() router = routers.DefaultRouter()
router.register(r'beacons', hub_views.BeaconViewSet) router.register(r'beacons', hub_views.BeaconViewSet)
...@@ -16,7 +16,9 @@ router.register(r'uuid', hub_views.UuidBeaconViewSet) ...@@ -16,7 +16,9 @@ router.register(r'uuid', hub_views.UuidBeaconViewSet)
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^$', main_page),
url(r'^login/$', login_page), url(r'^login/$', login_page),
url(r'^dashboard/$', dashboard),
url(r'^api/', include(router.urls)), url(r'^api/', include(router.urls)),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'^api/uuid/(?P<pk>[0-9]+)/$', hub_views.UuidBeaconViewSet.as_view()), url(r'^api/uuid/(?P<pk>[0-9]+)/$', hub_views.UuidBeaconViewSet.as_view()),
......
from django.contrib.auth.models import User
from django.db import models from django.db import models
...@@ -7,6 +8,7 @@ class Site(models.Model): ...@@ -7,6 +8,7 @@ class Site(models.Model):
link_url = models.CharField(max_length=2000) link_url = models.CharField(max_length=2000)
description = models.CharField(max_length=300, null=True) description = models.CharField(max_length=300, null=True)
category = models.ManyToManyField('Category', null=True) category = models.ManyToManyField('Category', null=True)
author = models.ForeignKey(User)
def __str__(self): def __str__(self):
return self.link_url return self.link_url
...@@ -36,3 +38,12 @@ class BeaconManager(models.Model): ...@@ -36,3 +38,12 @@ class BeaconManager(models.Model):
def __str__(self): def __str__(self):
return str(self.beacon) return str(self.beacon)
class UserProject(models.Model):
author = models.ForeignKey(User)
beacons = models.ManyToManyField('Beacon')
name = models.CharField(max_length=300)
description = models.CharField(max_length=300, null=True)
def __str__(self):
return self.name
\ No newline at end of file
/* Sticky footer styles
-------------------------------------------------- */
/* Wrapper for page content to push down footer */
/* Set the fixed height of the footer here */
#footer {
height: 60px;
background-color: #f5f5f5;
position : fixed;
width:100%;
bottom:0px;
}
/* Custom page CSS
-------------------------------------------------- */
/* Not required for template or sticky footer method. */
.caret-up {
/* Safari */
-webkit-transform: rotate(-180deg);
/* Firefox */
-moz-transform: rotate(-180deg);
/* IE */
-ms-transform: rotate(-180deg);
/* Opera */
-o-transform: rotate(-180deg);
/* Internet Explorer */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=6);
}
.drop-up {
top: auto;
bottom: 100% !important;
}
html{
overflow-x: hidden;
}
body {
height: 100%;
color : white;
background-color :white;
/* The html and body elements cannot have any padding or margin. */
}
#wrap {
min-height: 100%;
height: auto;
/* Negative indent footer by its height */
margin: 0 auto -60px;
/* Pad bottom by footer height */
padding: 100 0 60px;
}
/*!
* Start Bootstrap - The Big Picture HTML Template (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
.full {
background: url('../img/background_main_page.png') no-repeat center center fixed;
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
\ No newline at end of file
This diff is collapsed.
{% extends 'welcome_page/default/base.html' %}
{% block content %}
<h2>Hi Your login details are invalid!</h2>
<p>Click <a href="/login/">here</a> to login again</p>
{% endblock %}
\ No newline at end of file
{% load staticfiles%} {% extends 'page/default/base.html' %}
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{% static 'css/login.css' %}" />
{% block content %}
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4"> <div class="col-sm-6 col-md-4 col-md-offset-4">
<div class="account-wall"> <div class="account-wall">
<img class="profile-img" src="{{STATIC_URL}}login.jpg" <img class="profile-img" src="{{STATIC_URL}}img/login.jpg"
alt=""> alt="">
<form action="/login/" method="post" class="form-signin"> <form action="/login/" method="post" class="form-signin">
{% csrf_token %} {% csrf_token %}
...@@ -24,3 +20,4 @@ ...@@ -24,3 +20,4 @@
</div> </div>
</div> </div>
</div> </div>
{% endblock content %}
\ No newline at end of file
{% extends 'page/default/base.html' %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-12">
<h1>Chcesz ukrasc beacona?</h1>
<p>Smialo <h1>xD</h1> Logowanie z prawej <h1>xD</h1></p>
</div>
</div>
<!-- /.row -->
</div>
{% endblock content %}
\ No newline at end of file
{% extends 'welcome_page/default/base.html' %}
{% block content %}
<div class="container">
<div class="row">
<form role="form" method="post">
{% csrf_token %}
<div class="col-lg-6">
<div class="well well-sm"><strong><span class="glyphicon glyphicon-asterisk"></span>Required Field</strong></div>
<div class="form-group">
<label for="InputName">Enter Name</label>
<div class="input-group">
<input type="text" class="form-control" name="username" id="InputName" placeholder="Enter Name" required>
<span class="input-group-addon"><span class="glyphicon glyphicon-asterisk"></span></span>
</div>
</div>
<div class="form-group">
<label for="InputEmail">Enter Email</label>
<div class="input-group">
<input type="email" class="form-control" id="InputEmailFirst" name="email" placeholder="Enter Email" required>
<span class="input-group-addon"><span class="glyphicon glyphicon-asterisk"></span></span>
</div>
</div>
<div class="form-group">
<label for="InputPassword">Input password</label>
<div class="input-group">
<input type="password" class="form-control" id="InputPasswordFirst" name="password" placeholder="Password" required>
<span class="input-group-addon"><span class="glyphicon glyphicon-asterisk"></span></span>
</div>
</div>
<div class="form-group">
<label for="ConfirmPassword">ConfirmPassword</label>
<div class="input-group">
<input type="password" class="form-control" id="InputPasswordSecond" name="confirmed_password" placeholder="Password" required>
<span class="input-group-addon"><span class="glyphicon glyphicon-asterisk"></span></span>
</div>
</div>
<input type="submit" name="submit" id="submit" value="Submit" class="btn btn-info pull-right">
</div>
</form>
<div class="col-lg-5 col-md-push-1">
<div class="col-md-12">
<div class="alert alert-success">
<strong><span class="glyphicon "></span> Welcome to register form!</strong>
</div>
{% for error, content in errors.items %}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-remove"></span><strong> {{ content }}</strong>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock content %}
\ No newline at end of file
<html >
{% load staticfiles %}
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/login.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/footer.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/the-big-picture.css' %}" />
<title>Free Beacons</title>
</head>
<body class="full">
{% include 'page/default/main_bar.html' %}
<div id="wrap">
{% block content %}
{% endblock %}
</div>
{% include 'page/default/footer.html' %}
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="{% static 'js/bootstrap.min.js' %}"></script>
</body>
</html>
\ No newline at end of file
<div id="footer">
<div class="container">
<p class="text-muted credit">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Links <span class="caret caret-up"></span>
</button>
<ul class="dropdown-menu drop-up" role="menu">
<li><a href="">Authors:</a></li>
<li><a href="https://pl.linkedin.com/pub/kamil-rogalski/a4/a06/a6a">Kamil Rogalski</a></li>
<li><a href="https://pl.linkedin.com/pub/rafał-lizoń/82/20a/ab">Rafał Lizoń</a></li>
<li class="divider"></li>
<li><a href="#">TMBK</a></li>
</ul>
</div>
</p>
</div>
</div>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
</button>
<a class="navbar-brand" href="/">Free Beacons</a>
</div>
<ul class="nav navbar-nav navbar-right">
<li><a href="/login">Login</a></li>
<li><a href="/register">Register</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
\ No newline at end of file
{% extends 'user_panel/default/base.html' %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-6">
<h2>Twoje projekty</h2>
{% for user_activity in activity_data.taken_activity %}
{% with template="user_panel/content/activity//"|add:user_activity.activity.kind|add:".html" activity=user_activity.activity %}
{% include template %}
{% endwith %}
{% endfor %}
</div>
</div>
</div>
{% endblock content %}
\ No newline at end of file
<html >
{% load staticfiles %}
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{% static 'css/dashboard.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/login.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/footer.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/left_bar.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/user_profile.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/friend_conversation.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/friends.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/profile.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/hobby_list.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/hobby_detail.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/hobby_display.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/font-awesome.min.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/article.css' %}" />
<title>Activy</title>
</head>
<body>
{% include 'user_panel/default/user_bar.html' %}
{% include 'user_panel/default/left_bar.html' %}
<div id="wrap" style="margin-top:20px;">
{% block content %}
{% endblock %}
</div>
{% include 'user_panel/default/footer.html' %}
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/hobby_detail.js' %}"></script>
<
</body>
</html>
\ No newline at end of file
<div id="footer">
<div class="container">
<p class="text-muted credit">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Links <span class="caret caret-up"></span>
</button>
<ul class="dropdown-menu drop-up" role="menu">
<li><a href="">Authors:</a></li>
<li><a href="https://pl.linkedin.com/pub/kamil-rogalski/a4/a06/a6a">Kamil Rogalski</a></li>
<li><a href="https://pl.linkedin.com/pub/rafał-lizoń/82/20a/ab">Rafał Lizoń</a></li>
<li class="divider"></li>
<li><a href="#">TMBK</a></li>
</ul>
</div>
</p>
</div>
</div>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li class="sidebar-brand">
</li>
{% for user_hobby in default_data.user_hobby %}
<li>
<a href="/hobby/{{ user_hobby.hobby.id }}"><img src="{{ user_hobby.hobby.icon.photo_url }}"></a>
</li>
{% endfor %}
</ul>
</div>
</div>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
</button>
<a class="navbar-brand" href="/">Activy</a>
</div>
<ul class="nav navbar-nav navbar-right">
<li><a href="/">Projekty</a></li>
<li><a href="/maps">Mapa beaconow</a></li>
<li><a href="/logout">Logout</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
\ No newline at end of file
...@@ -2,7 +2,7 @@ from django.contrib import auth ...@@ -2,7 +2,7 @@ from django.contrib import auth
from django.contrib.auth import login from django.contrib.auth import login
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseRedirect, HttpResponse from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render, render_to_response from django.shortcuts import render, render_to_response, redirect
from django.template import RequestContext from django.template import RequestContext
# Create your views here. # Create your views here.
...@@ -83,7 +83,7 @@ def login_page(request): ...@@ -83,7 +83,7 @@ def login_page(request):
context = RequestContext(request) context = RequestContext(request)
if not request.method == 'POST': if not request.method == 'POST':
return render_to_response('page/login.html', {}, context) return render_to_response('page/content/login.html', {}, context)
username = request.POST.get('username', '') username = request.POST.get('username', '')
password = request.POST.get('password', '') password = request.POST.get('password', '')
...@@ -95,3 +95,13 @@ def login_page(request): ...@@ -95,3 +95,13 @@ def login_page(request):
else: else:
return HttpResponse("Invalid login details supplied.") return HttpResponse("Invalid login details supplied.")
def main_page(request):
context = RequestContext(request)
if request.user.is_authenticated():
return redirect('/dashboard')
else:
return render_to_response('page/content/main_page.html', {}, context)
def dashboard(request):
context = RequestContext(request)
return render_to_response('user_panel/content/dashboard.html', {}, context)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment