resolve merge conflicts

This commit is contained in:
Tomislav R 2016-05-04 17:36:54 +02:00
commit 52ea4eec49
23 changed files with 393 additions and 834 deletions

View file

@ -16,5 +16,6 @@ class ProcessVMSelectionMixin(object):
request.session['vm_specs'] = vm_specs
if not request.user.is_authenticated():
request.session['vm_specs'] = vm_specs
request.session['next'] = reverse('hosting:payment')
return redirect(reverse('hosting:login'))
return redirect(reverse('hosting:payment'))

View file

@ -1,3 +1,7 @@
.pricing-container{
margin-left: 5%;
}
.pricing {
text-align: center;
border: 1px solid #f0f0f0;
@ -7,6 +11,8 @@
margin-bottom: 30px;
font-family: 'Lato';
}
.pricing img {
display: block;
margin: auto;
@ -23,6 +29,13 @@
.pricing li + li {
border-top: 1px solid #f0f0f0;
}
.pricing li.type {
list-style: none;
padding: 13px;
height: 200px;
}
.pricing big {
font-size: 32px;
}
@ -81,6 +94,7 @@
.pricing .short-input{
min-width: 0;
width: 90px;
display: inline;
}
.p-red button {

View file

@ -55,20 +55,25 @@
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#how">How it works</a>
<a href="{{ request.META.HTTP_REFERER }}#how">How it works</a>
</li>
<li>
<a href="#your">Your infrastructure</a>
<a href="{{ request.META.HTTP_REFERER }}#your">Your infrastructure</a>
</li>
<li>
<a href="#our">Our inftrastructure</a>
<a href="{{ request.META.HTTP_REFERER }}#our">Our inftrastructure</a>
</li>
<li>
<a href="#price">Pricing</a>
<a href="{{ request.META.HTTP_REFERER }}#price">Pricing</a>
</li>
<li>
<a href="#contact">Contact</a>
<a href="{{ request.META.HTTP_REFERER }}#contact">Contact</a>
</li>
{% if request.user.is_authenticated %}
<li>
<a href="{% url 'hosting:logout' %}"> Logout</a>
</li>
{% endif %}
</ul>
</div>
<!-- /.navbar-collapse -->
@ -93,20 +98,20 @@
</li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#about">How it works</a></li>
<a href="{{ request.META.HTTP_REFERER }}#how">How it works</a>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#about">Your infrastructure</a></li>
<a href="{{ request.META.HTTP_REFERER }}#your">Your infrastructure</a></li>
<li>&sdot;</li>
<li>
<a href="#about">Our infrastructure</a></li>
<a href="{{ request.META.HTTP_REFERER }}#our">Our infrastructure</a></li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#services">Pricing</a>
<a href="{{ request.META.HTTP_REFERER }}#services">Pricing</a>
</li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#contact">Contact</a>
<a href="{{ request.META.HTTP_REFERER }}#contact">Contact</a>
</li>
</ul>
<p class="copyright text-muted small">Copyright &copy; ungleich GmbH {% now "Y" %}. All Rights Reserved</p>

View file

@ -1,158 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<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="">
<meta name="author" content="">
<title>Rails Hosting.ch - Ruby on Rails as easy as possible</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/landing-page.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
<div class="container topnav">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<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 topnav" href="#"><img src="img/logo_black.svg"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#how">How it works</a>
</li>
<li>
<a href="#your">Your infrastructure</a>
</li>
<li>
<a href="#our">Our inftrastructure</a>
</li>
<li>
<a href="#price">Pricing</a>
</li>
<li>
<a href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Header -->
<a name="about"></a>
<div class="intro-header-2">
<div class="container">
<div class="col-md-4">&nbsp;</div><div class="col-md-4">
<div class="intro-"><img class="responsive" src="img/Beta.png">
<h2>Check Out</h2>
<form>
<ul class="fa-ul">
<li><i class="fa-li fa fa-check-square-o fa-lg"></i>
<p class="lead">OS : Ubuntu 14.04</p>
</li>
<li><i class="fa-li fa fa-check-square-o fa-lg"></i>
<p class="lead">RAM : 1GiB </p></li>
<li><i class="fa-li fa fa-check-square-o fa-lg"></i><p class="lead">CPU Cores : 4</p></li>
<li><i class="fa-li fa fa-check-square-o fa-lg"></i><p class="lead">Additional Disk: 20 GB
</ul><div class="checkbox">
<label>
<input type="checkbox">
Everything Correct!
</label>
</div>
<div class>
<p>&nbsp;</p>
</div>
<button type="submit" class="btn btn-default">Confirm Check Out</button>
</form></p></div>
<ul class="list-inline intro-social-buttons">
</ul>
</div>
</div>
</div>
</div>
<!-- /.container -->
</div>
<!-- /.intro-header -->
<!-- Footer -->
<footer>
<div class="container">
<div class="row">
<div class="col-lg-12">
<ul class="list-inline">
<li>
<a href="#">Home</a>
</li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#about">How it works</a></li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#about">Your infrastructure</a></li>
<li>&sdot;</li>
<li>
<a href="#about">Our infrastructure</a></li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#services">Pricing</a>
</li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#contact">Contact</a>
</li>
</ul>
<p class="copyright text-muted small">Copyright &copy; ungleich GmbH 2015. All Rights Reserved</p>
</div>
</div>
</div>
</footer>
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>

View file

@ -13,7 +13,7 @@
<hr class="intro-divider">
<ul class="list-inline intro-social-buttons">
<li>
<a href="#howitworks" class="btn btn-default btn-lg"><i class="#Services"></i> <span class="network-name">how it works</span></a>
<a href="#how" class="btn btn-default btn-lg"><i class="#Services"></i> <span class="network-name">how it works</span></a>
</li>
<li>
<a href="#own" class="btn btn-default btn-lg page-scroll"><span class="network-name">Let me start</span></a>

View file

@ -1,11 +1,11 @@
<a name="price"></a>
<div class="content-section-a">
<div class="container">
<div class="content-section-b">
<div class="container-fluid pricing-container">
<div class="row">
<div class="col-lg-5 col-sm-6">
<div class="col-lg-5 col-sm-6 col-md-offset-1">
<hr class="section-heading-spacer">
<div class="clearfix"></div>
<h2 class="section-heading">Hosting Price Samples</h2>
<h2 class="section-heading">Hosting Price</h2>
<p class="lead">Here are samples of our {{ hosting_long }} hosting offers, suited for different projects. Our offer examples come in different size, speed, and storage. </p>
</div>
<!-- Title -->
@ -13,18 +13,19 @@
<div class="col-lg-12"></div>
</div>
<!-- Page Features -->
<div class="row text-center">
<div class="block">
<div class="block col-md-offset-1">
{% for vm in vm_types %}
<div class="col-xs-12 col-sm-6 col-md-3">
<div class="col-xs-12 col-sm-6 col-md-2">
<form class="form-inline" method="POST" action="{{request.path}}">
{% csrf_token %}
<input type="hidden" name="hosting_company" value="{{vm.hosting_company}}">
<input type="hidden" name="hosting_company_name" value="{{vm.hosting_company_name}}">
<ul class="pricing {% cycle 'p-green' 'p-yel' 'p-red' 'p-blue' %}">
<li style="height:200px;">
<li class="type">
<!-- <img src="http://bread.pp.ua/n/settings_g.svg" alt=""> -->
<h3 >{{vm.hosting_company_name}}</h3>
</li>
@ -44,7 +45,7 @@
</div>
</li>
<li class="row">
<li>
<div class="btn-group">
<div class="form-group">
<label for="memory">Memory: </label>
@ -59,11 +60,13 @@
</div>
</div>
</li>
<li class="row">
<div class="form-group">
<label for="Disk Size">Disk Size: </label>
<input class="form-control short-input disk-space-selector" name="disk_space" type="number" id="{{vm.hosting_company}}-disk_space" min="10" value="10" data-vm-type="{{vm.hosting_company}}"/>
<span>GiB</span>
<li>
<div class="form-group row">
<div class="col-xs-offset-1 col-xs-9 col-sm-12 col-md-12 col-md-offset-0">
<label for="Disk Size">Disk Size: </label>
<input class="form-control short-input text-center disk-space-selector" name="disk_space" type="number" id="{{vm.hosting_company}}-disk_space" min="10" value="10" data-vm-type="{{vm.hosting_company}}"/>
<span>GiB</span>
</div>
</div>
</li>
<li>

View file

@ -1,391 +0,0 @@
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<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="">
<meta name="author" content="">
<title>Rails Hosting.ch - Ruby on Rails as easy as possible</title>
<!-- Bootstrap Core CSS -->
<link href="{% static 'hosting/css/bootstrap.min.css' %}" rel="stylesheet">
<!-- Custom CSS -->
<link href="{% static 'hosting/css/landing-page.css' %}" rel="stylesheet">
<!-- Custom Fonts -->
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
<link href="{% static 'hosting/font-awesome/css/font-awesome.min.css' %}" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="{% static 'hosting/img/favicon.ico' %}" type="image/x-icon" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62285904-5', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
<div class="container topnav">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<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 topnav" href="#"><img src="{% static 'railshosting/img/logo_black.svg' %}"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#how">How it works</a>
</li>
<li>
<a href="#your">Your infrastructure</a>
</li>
<li>
<a href="#our">Our inftrastructure</a>
</li>
<li>
<a href="#price">Pricing</a>
</li>
<li>
<a href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Header -->
<a name="about"></a>
<div class="intro-header">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="intro-message">
<img class="responsive" src="{% static 'railshosting/img/Beta.png' %}">
<h1>rails-hosting.ch</h1>
<h3>Ruby on Rails as easy as possible</h3>
<hr class="intro-divider">
<ul class="list-inline intro-social-buttons">
<li>
<a href="#howitworks" class="btn btn-default btn-lg"><i class="#Services"></i> <span class="network-name">tell me how it works</span></a>
</li>
<li>
<a href="#own" class="btn btn-default btn-lg page-scroll"><span class="network-name">Let me start</span></a>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- /.container -->
</div>
<!-- /.intro-header -->
<!-- Page Content -->
<a name="how"></a>
<div class="content-section-b">
<div class="container">
<div class="row">
<div class="col-lg-5 col-lg-offset-1 col-sm-push-6 col-sm-6">
<hr class="section-heading-spacer">
<div class="clearfix"></div>
<h2 class="section-heading">How it works : </h2> <ul class="fa-ul">
<li><i class="fa-li fa fa-check-square-o fa-lg"></i>
<p class="lead">Ubuntu 14.04 as the operating system, full root access!</p>
</li>
<li><i class="fa-li fa fa-check-square-o fa-lg"></i><p class="lead">rbenv to let you decide which Ruby version you want to use</p></li>
<li><i class="fa-li fa fa-check-square-o fa-lg"></i><p class="lead">nginx as the frontend Server (optional with SSL Support)</p></li>
<li><i class="fa-li fa fa-check-square-o fa-lg"></i><p class="lead">unicorn to have your application talk to nginx and vice versa
<li><i class="fa-li fa fa-check-square-o fa-lg"></i><p class="lead">PostgreSQL as the database</p>
</li></ul>
</div>
<div class="col-lg-5 col-sm-pull-6 col-sm-6">
<img class="img-responsive" src="{% static 'railshosting/img/how3.png' %}" alt="">
</div>
</div>
</div>
<!-- /.container -->
<!-- /.option 1 -->
</div>
<a name="your"></a>
<div class="content-section-a" id="own">
<div class="container">
<div class="row">
<div class="col-lg-5 col-sm-6">
<hr class="section-heading-spacer">
<div class="clearfix"></div>
<h2 class="section-heading"> Option 1 : Your own infrastructure</h2>
<p class="lead">We configure your own infrastructure for Ruby on Rails. Keep the comfort and safety of being at your home, while we set things up for you.</p>
</div>
<div class="col-lg-5 col-lg-offset-2 col-sm-6">
<img class="img-responsive" src="{% static 'railshosting/img/home.png' %}" alt="">
</div>
</div>
</div>
<!-- /.container -->
</div>
<!-- /.option 2 -->
<!-- /.content-section-a -->
<!-- / pricing -->
<a name="our"></a>
<div class="content-section-b">
<div class="container">
<div class="row">
<div class="col-lg-5 col-lg-offset-1 col-sm-push-6 col-sm-6">
<hr class="section-heading-spacer">
<div class="clearfix"></div>
<h2 class="section-heading">Option 2 : Our infrastructure</h2>
<p class="lead">We take care of everything for you! You don't need your infrastructure. We give you everything you need in Ruby on Rails hosting. Full root access, 24x7 support.</p>
</div>
<div class="col-lg-5 col-sm-pull-6 col-sm-6">
<img class="img-responsive" src="{% static 'railshosting/img/dog.png' %}" alt="">
</div>
</div>
</div>
<!-- /.container -->
</div>
<!-- /.content-section-b -->
<a name="price"></a>
<div class="content-section-a">
<div class="container">
<div class="row">
<div class="col-lg-5 col-sm-6">
<hr class="section-heading-spacer">
<div class="clearfix"></div>
<h2 class="section-heading">Hosting Price Samples</h2>
<p class="lead">Here are samples of our Ruby on Rails hosting offers, suited for different projects. Our offer examples come in different size, speed, and storage. </p>
</div>
<!-- Title -->
<div class="row">
<div class="col-lg-12"></div>
</div>
<!-- /.row -->
<!-- Page Features -->
<div class="row text-center">
<div class="col-md-3 col-sm-6 hero-feature">
<div class="thumbnail">
<img class="relsonsive" src="{% static 'railshosting/img/economy.jpg' %}" alt="">
<div class="caption">
<h3>Economy </h3>
<p>Suited for smaller applications </p>
<p>1 core, </p>
<p>1 GiB RAM, </p>
<p>10 GiB system image (25 CHF)</p>
<p>
<a href="#" class="btn btn-primary">Buy Now!</a> <a href="#" class="btn btn-default">More Info</a> </p>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 hero-feature">
<div class="thumbnail">
<img class="relsonsive" src="{% static 'railshosting/img/standardroom.jpg' %}" alt="">
<div class="caption">
<h3>Standard</h3>
<p>Suited for standard Ruby on Rails applications</p>
<p>1 core, </p>
<p>2 GiB RAM,</p>
<p> 10 GiB system image (30 CHF)</p>
<p>
<a href="#" class="btn btn-primary">Buy Now!</a> <a href="#" class="btn btn-default">More Info</a>
</p>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 hero-feature">
<div class="thumbnail">
<img class="reponsive" src="{% static 'railshosting/img/deluxeroom.jpg' %}" alt="">
<div class="caption">
<h3>Deluxe</h3>
<p>Suited for performance critical project</p>
<p>2 cores,</p>
<p> 4 GiB Ram, </p>
<p>10 GiB system image (50 CHF) </p>
<p>
<a href="#" class="btn btn-primary">Buy Now!</a> <a href="#" class="btn btn-default">More Info</a> </p>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 hero-feature">
<div class="thumbnail">
<img class="responsive" src="{% static 'railshosting/img/presidentialroom.jpg' %}" alt="">
<div class="caption">
<h3>Presidential Premium</h3>
<p> Suited for performance critical &amp; </p>
<p>high storage demand projects</p>
<p>4 Cores, 8 GiB RAM, 10 GiB System image, </p>
<p>100 GiB Data image (190 CHF)</p>
<p>
<a href="#" class="btn btn-primary">Buy Now!</a> <a href="#" class="btn btn-default">More Info</a>
</p>
</div>
</div>
</div>
</div>
<!-- /.row -->
</div>
</div>
<!-- /.container -->
</div>
<!-- Configure -->
<a name="about"></a>
<div class="intro-header-1">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="intro-message">
<h1>Let me try!</h1>
<p>&nbsp;</p>
<p>&nbsp;</p>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
{{ form.non_field_errors }}
{{ form.email.errors }}
<form action="" method="post" role="form" class="form-inline">
{% csrf_token %}
<div class="form-group">
<label class="sr-only" for="email">Email address</label>
<input type="email" name="email" class="form-control" id="id_email" placeholder="Enter email">
</div>
<button type="submit" class="btn btn-default">Request Beta Access</button>
</form>
</ul>
</div>
</div>
</div>
</div>
<!-- /.container -->
</div>
<!-- /.content-section-a -->
<!-- / contact section -->
<a name="contact"></a>
<div class="banner">
<div class="container">
<div class="row">
<div class="col-lg-6">
<h2>QUESTIONS? </h2>
<h2>CONTACT US! </h2>
<h3>ungleich GmbH </h3>
<p><i class="fa fa-envelope-o"></i> info@rails-hosting.ch</p>
<p>14 Hauptstrasse Luchsingen 8775</p>
<p>Switzerland</p>
<button type="button" class="btn btn-default">
<a href="https://twitter.com/ungleich">
<i class="fa fa-twitter fa-fw"></i><span class="network-name">Twitter</span></a>
</button>
<button type="button" class="btn btn-default">
<a href="https://github.com/ungleich"><i class="fa fa-github fa-fw"></i><span class="network-name">Github</span></a></button>
</div>
</div>
</div>
<!-- /.container -->
</div>
<!-- /.banner -->
<!-- Footer -->
<footer>
<div class="container">
<div class="row">
<div class="col-lg-12">
<ul class="list-inline">
<li>
<a href="#">Home</a>
</li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#about">How it works</a></li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#about">Your infrastructure</a></li>
<li>&sdot;</li>
<li>
<a href="#about">Our infrastructure</a></li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#services">Pricing</a>
</li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#contact">Contact</a>
</li>
</ul>
<p class="copyright text-muted small">Copyright &copy; ungleich GmbH 2015. All Rights Reserved</p>
</div>
</div>
</div>
</footer>
<!-- jQuery -->
<script src="{% static 'railshosting/js/jquery.js' %}"></script>
<!-- Bootstrap Core JavaScript -->
<script src="{% static 'railshosting/js/bootstrap.min.js' %}"></script>
</body>
</html>

View file

@ -0,0 +1,79 @@
{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 %}
{% block content %}
<style type="text/css">
.invoice-title h2, .invoice-title h3 {
display: inline-block;
}
.table > tbody > tr > .no-line {
border-top: none;
}
.table > thead > tr > .no-line {
border-bottom: none;
}
.table > tbody > tr > .thick-line {
border-top: 2px solid;
}
</style>
<div class="container payment-container">
<div class="row">
<div class="col-xs-8 col-xs-offset-2">
<div class="invoice-title">
<h2>Invoice</h2><h3 class="pull-right">Order # {{order.id}}</h3>
</div>
<hr>
<div class="row">
<div class="col-xs-6">
<address>
<h3><b>Billed To:</b></h3>
John Smith<br>
1234 Main<br>
Apt. 4B<br>
Springfield, ST 54321
</address>
</div>
<div class="col-xs-6 text-right">
<address>
<strong>Order Date:</strong><br>
{{order.created_at}}<br><br>
</address>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<address>
<strong>Payment Method:</strong><br>
{{brand}} ending **** {{last4}}<br>
{{user.email}}
</address>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h3><b>Order summary</b></h3>
<hr>
<div class="content">
<p><b>Type</b> <span class="pull-right">{{request.session.vm_specs.hosting_company_name}}</span></p>
<hr>
<p><b>Cores</b> <span class="pull-right">{{request.session.vm_specs.cores}}</span></p>
<hr>
<p><b>Memory</b> <span class="pull-right">{{request.session.vm_specs.memory}} GiB</span></p>
<hr>
<p><b>Disk space</b> <span class="pull-right">{{request.session.vm_specs.disk_size}} GiB</span></p>
<hr>
<h4>Total<p class="pull-right"><b>{{request.session.vm_specs.final_price}} CHF</b></p></h4>
</div>
</div>
</div>
</div>
{%endblock%}

View file

@ -0,0 +1,36 @@
{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 %}
{% block content %}
<div>
<div class="container payment-container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<table class="table">
<caption>My orders.</caption>
<thead>
<tr>
<th>#</th>
<th>Date</th>
<th>Amount</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for order in orders %}
<tr>
<th scope="row">{{order.id}}</th>
<td>{{order.created_at}}</td>
<td>{{order.VMPlan.price}}</td>
<td>{{order.approved}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{%endblock%}

View file

@ -1,6 +1,6 @@
{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 %}
{%block content %}
{% block content %}
<!-- Credit card form -->
<div>
<div class="container payment-container">
@ -64,6 +64,17 @@
<p class="payment-errors"></p>
</div>
</div>
{% if paymentError %}
<div class="row">
<div class="col-xs-12">
<p>
{% bootstrap_alert paymentError alert_type='danger' %}
</p>
</div>
</div>
{% endif %}
</form>
</div>
</div>
@ -88,6 +99,7 @@
</div>
</div>
</form>
</div>

View file

@ -1,7 +1,8 @@
from django.conf.urls import url
from .views import DjangoHostingView, RailsHostingView, PaymentVMView, \
NodeJSHostingView, LoginView, SignupView, IndexView
NodeJSHostingView, LoginView, SignupView, IndexView, \
InvoiceVMView, OrdersHostingView
urlpatterns = [
# url(r'pricing/?$', VMPricingView.as_view(), name='pricing'),
@ -9,7 +10,11 @@ urlpatterns = [
url(r'django/?$', DjangoHostingView.as_view(), name='djangohosting'),
url(r'nodejs/?$', NodeJSHostingView.as_view(), name='nodejshosting'),
url(r'rails/?$', RailsHostingView.as_view(), name='railshosting'),
url(r'payment/?$', PaymentVMView.as_view(), name='payment'),
url(r'invoice/?$', InvoiceVMView.as_view(), name='invoice'),
url(r'orders/?$', OrdersHostingView.as_view(), name='orders'),
url(r'login/?$', LoginView.as_view(), name='login'),
url(r'signup/?$', SignupView.as_view(), name='signup'),
url(r'payment/?$', PaymentVMView.as_view(), name='payment'),
url(r'^logout/?$', 'django.contrib.auth.views.logout',
{'next_page': '/ungleich_page'}, name='logout')
]

View file

@ -1,6 +1,9 @@
from django.shortcuts import get_object_or_404, render
from django.core.urlresolvers import reverse_lazy, reverse
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.views.generic import View, CreateView, FormView
from django.shortcuts import redirect
@ -12,6 +15,7 @@ from membership.forms import PaymentForm
from membership.models import CustomUser, StripeCustomer
from utils.stripe_utils import StripeUtils
from utils.forms import BillingAddressForm
from utils.models import BillingAddress
from .models import VirtualMachineType, VirtualMachinePlan, HostingOrder
from .forms import HostingUserSignupForm, HostingUserLoginForm
from .mixins import ProcessVMSelectionMixin
@ -106,13 +110,16 @@ class LoginView(FormView):
form_class = HostingUserLoginForm
moodel = CustomUser
def get_success_url(self):
next_url = self.request.session.get('next', self.success_url)
return next_url
def form_valid(self, form):
email = form.cleaned_data.get('email')
password = form.cleaned_data.get('password')
auth_user = authenticate(email=email, password=password)
if auth_user:
login(self.request, auth_user)
return HttpResponseRedirect(self.get_success_url())
@ -125,7 +132,8 @@ class SignupView(CreateView):
moodel = CustomUser
def get_success_url(self):
return reverse_lazy('hosting:signup')
next_url = self.request.session.get('next', reverse_lazy('hosting:signup'))
return next_url
def form_valid(self, form):
@ -155,7 +163,7 @@ class PaymentVMView(FormView):
form = self.get_form()
if form.is_valid():
context = self.get_context_data()
specifications = request.session.get('vm_specs')
vm_type = specifications.get('hosting_company')
vm = VirtualMachineType.objects.get(hosting_company=vm_type)
@ -185,20 +193,84 @@ class PaymentVMView(FormView):
# Make stripe charge to a customer
stripe_utils = StripeUtils()
charge = stripe_utils.make_charge(amount=final_price,
customer=customer.stripe_id)
order.set_stripe_charge(charge)
charge_response = stripe_utils.make_charge(amount=final_price,
customer=customer.stripe_id)
charge = charge_response.get('response_object')
if not charge.paid:
# raise an error
pass
# Check if the payment was approved
if not charge:
context.update({
'paymentError': charge_response.get('error'),
'form': form
})
return render(request, self.template_name, context)
charge = charge_response.get('response_object')
# Associate an order with a stripe payment
order.set_stripe_charge(charge)
# If the Stripe payment was successed, set order status approved
order.set_approved()
# order.charge =
# Billing Address should be store here
return HttpResponseRedirect(reverse('hosting:payment'))
request.session.update({
'charge': charge,
'order': order.id,
'billing_address': billing_address.id
})
return HttpResponseRedirect(reverse('hosting:invoice'))
else:
return self.form_invalid(form)
class InvoiceVMView(LoginRequiredMixin, View):
template_name = "hosting/invoice.html"
login_url = reverse_lazy('hosting:login')
def get_context_data(self, **kwargs):
charge = self.request.session.get('charge')
order_id = self.request.session.get('order')
billing_address_id = self.request.session.get('billing_address')
last4 = charge.get('source').get('last4')
brand = charge.get('source').get('brand')
order = get_object_or_404(HostingOrder, pk=order_id)
billing_address = get_object_or_404(BillingAddress, pk=billing_address_id)
if not charge:
return
context = {
'last4': last4,
'brand': brand,
'order': order,
'billing_address': billing_address,
}
return context
def get(self, request, *args, **kwargs):
context = self.get_context_data()
return render(request, self.template_name, context)
class OrdersHostingView(LoginRequiredMixin, View):
template_name = "hosting/orders.html"
login_url = reverse_lazy('hosting:login')
def get_context_data(self, **kwargs):
user = self.request.user
orders = HostingOrder.objects.filter(customer__user=user)
context = {
'orders':orders
}
return context
def get(self, request, *args, **kwargs):
context = self.get_context_data()
return render(request, self.template_name, context)