resolve merge conflicts

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

View file

@ -5,9 +5,6 @@ from . import views
from .views import ContactView, IndexView, AboutView from .views import ContactView, IndexView, AboutView
urlpatterns = [ urlpatterns = [
# url(r'^$', IndexView.as_view(), name='home'),
# url(_(r'home/?$'), IndexView.as_view(), name='home'),
# url(_(r'about/?$'), AboutView.as_view(), name='about'),
url(_(r'contact/?$'), ContactView.as_view(), name='contact'), url(_(r'contact/?$'), ContactView.as_view(), name='contact'),
url(_(r'supporters/?$'), views.supporters, name='supporters'), url(_(r'supporters/?$'), views.supporters, name='supporters'),
url(r'calendar_api/(?P<month>\d+)/(?P<year>\d+)?$', views.CalendarApi.as_view(),name='calendar_api_1'), url(r'calendar_api/(?P<month>\d+)/(?P<year>\d+)?$', views.CalendarApi.as_view(),name='calendar_api_1'),

View file

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

View file

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

View file

@ -55,20 +55,25 @@
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="#how">How it works</a> <a href="{{ request.META.HTTP_REFERER }}#how">How it works</a>
</li> </li>
<li> <li>
<a href="#your">Your infrastructure</a> <a href="{{ request.META.HTTP_REFERER }}#your">Your infrastructure</a>
</li> </li>
<li> <li>
<a href="#our">Our inftrastructure</a> <a href="{{ request.META.HTTP_REFERER }}#our">Our inftrastructure</a>
</li> </li>
<li> <li>
<a href="#price">Pricing</a> <a href="{{ request.META.HTTP_REFERER }}#price">Pricing</a>
</li> </li>
<li> <li>
<a href="#contact">Contact</a> <a href="{{ request.META.HTTP_REFERER }}#contact">Contact</a>
</li> </li>
{% if request.user.is_authenticated %}
<li>
<a href="{% url 'hosting:logout' %}"> Logout</a>
</li>
{% endif %}
</ul> </ul>
</div> </div>
<!-- /.navbar-collapse --> <!-- /.navbar-collapse -->
@ -93,20 +98,20 @@
</li> </li>
<li class="footer-menu-divider">&sdot;</li> <li class="footer-menu-divider">&sdot;</li>
<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 class="footer-menu-divider">&sdot;</li>
<li> <li>
<a href="#about">Your infrastructure</a></li> <a href="{{ request.META.HTTP_REFERER }}#your">Your infrastructure</a></li>
<li>&sdot;</li> <li>&sdot;</li>
<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 class="footer-menu-divider">&sdot;</li>
<li> <li>
<a href="#services">Pricing</a> <a href="{{ request.META.HTTP_REFERER }}#services">Pricing</a>
</li> </li>
<li class="footer-menu-divider">&sdot;</li> <li class="footer-menu-divider">&sdot;</li>
<li> <li>
<a href="#contact">Contact</a> <a href="{{ request.META.HTTP_REFERER }}#contact">Contact</a>
</li> </li>
</ul> </ul>
<p class="copyright text-muted small">Copyright &copy; ungleich GmbH {% now "Y" %}. All Rights Reserved</p> <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"> <hr class="intro-divider">
<ul class="list-inline intro-social-buttons"> <ul class="list-inline intro-social-buttons">
<li> <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>
<li> <li>
<a href="#own" class="btn btn-default btn-lg page-scroll"><span class="network-name">Let me start</span></a> <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> <a name="price"></a>
<div class="content-section-a"> <div class="content-section-b">
<div class="container"> <div class="container-fluid pricing-container">
<div class="row"> <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"> <hr class="section-heading-spacer">
<div class="clearfix"></div> <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> <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> </div>
<!-- Title --> <!-- Title -->
@ -13,18 +13,19 @@
<div class="col-lg-12"></div> <div class="col-lg-12"></div>
</div> </div>
<!-- Page Features --> <!-- Page Features -->
<div class="row text-center"> <div class="row text-center">
<div class="block"> <div class="block col-md-offset-1">
{% for vm in vm_types %} {% 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}}"> <form class="form-inline" method="POST" action="{{request.path}}">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="hosting_company" value="{{vm.hosting_company}}"> <input type="hidden" name="hosting_company" value="{{vm.hosting_company}}">
<input type="hidden" name="hosting_company_name" value="{{vm.hosting_company_name}}"> <input type="hidden" name="hosting_company_name" value="{{vm.hosting_company_name}}">
<ul class="pricing {% cycle 'p-green' 'p-yel' 'p-red' 'p-blue' %}"> <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=""> --> <!-- <img src="http://bread.pp.ua/n/settings_g.svg" alt=""> -->
<h3 >{{vm.hosting_company_name}}</h3> <h3 >{{vm.hosting_company_name}}</h3>
</li> </li>
@ -44,7 +45,7 @@
</div> </div>
</li> </li>
<li class="row"> <li>
<div class="btn-group"> <div class="btn-group">
<div class="form-group"> <div class="form-group">
<label for="memory">Memory: </label> <label for="memory">Memory: </label>
@ -59,12 +60,14 @@
</div> </div>
</div> </div>
</li> </li>
<li class="row"> <li>
<div class="form-group"> <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> <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}}"/> <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> <span>GiB</span>
</div> </div>
</div>
</li> </li>
<li> <li>
<input id="{{vm.hosting_company}}-final-price-input" type="hidden" name="final_price" value="{{vm.default_price|floatformat}}"> <input id="{{vm.hosting_company}}-final-price-input" type="hidden" name="final_price" value="{{vm.default_price|floatformat}}">

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

@ -64,6 +64,17 @@
<p class="payment-errors"></p> <p class="payment-errors"></p>
</div> </div>
</div> </div>
{% if paymentError %}
<div class="row">
<div class="col-xs-12">
<p>
{% bootstrap_alert paymentError alert_type='danger' %}
</p>
</div>
</div>
{% endif %}
</form> </form>
</div> </div>
</div> </div>
@ -88,6 +99,7 @@
</div> </div>
</div> </div>
</form> </form>
</div> </div>

View file

@ -1,7 +1,8 @@
from django.conf.urls import url from django.conf.urls import url
from .views import DjangoHostingView, RailsHostingView, PaymentVMView, \ from .views import DjangoHostingView, RailsHostingView, PaymentVMView, \
NodeJSHostingView, LoginView, SignupView, IndexView NodeJSHostingView, LoginView, SignupView, IndexView, \
InvoiceVMView, OrdersHostingView
urlpatterns = [ urlpatterns = [
# url(r'pricing/?$', VMPricingView.as_view(), name='pricing'), # url(r'pricing/?$', VMPricingView.as_view(), name='pricing'),
@ -9,7 +10,11 @@ urlpatterns = [
url(r'django/?$', DjangoHostingView.as_view(), name='djangohosting'), url(r'django/?$', DjangoHostingView.as_view(), name='djangohosting'),
url(r'nodejs/?$', NodeJSHostingView.as_view(), name='nodejshosting'), url(r'nodejs/?$', NodeJSHostingView.as_view(), name='nodejshosting'),
url(r'rails/?$', RailsHostingView.as_view(), name='railshosting'), 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'login/?$', LoginView.as_view(), name='login'),
url(r'signup/?$', SignupView.as_view(), name='signup'), 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.shortcuts import get_object_or_404, render
from django.core.urlresolvers import reverse_lazy, reverse 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.views.generic import View, CreateView, FormView
from django.shortcuts import redirect from django.shortcuts import redirect
@ -12,6 +15,7 @@ from membership.forms import PaymentForm
from membership.models import CustomUser, StripeCustomer from membership.models import CustomUser, StripeCustomer
from utils.stripe_utils import StripeUtils from utils.stripe_utils import StripeUtils
from utils.forms import BillingAddressForm from utils.forms import BillingAddressForm
from utils.models import BillingAddress
from .models import VirtualMachineType, VirtualMachinePlan, HostingOrder from .models import VirtualMachineType, VirtualMachinePlan, HostingOrder
from .forms import HostingUserSignupForm, HostingUserLoginForm from .forms import HostingUserSignupForm, HostingUserLoginForm
from .mixins import ProcessVMSelectionMixin from .mixins import ProcessVMSelectionMixin
@ -106,13 +110,16 @@ class LoginView(FormView):
form_class = HostingUserLoginForm form_class = HostingUserLoginForm
moodel = CustomUser 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): def form_valid(self, form):
email = form.cleaned_data.get('email') email = form.cleaned_data.get('email')
password = form.cleaned_data.get('password') password = form.cleaned_data.get('password')
auth_user = authenticate(email=email, password=password) auth_user = authenticate(email=email, password=password)
if auth_user: if auth_user:
login(self.request, auth_user) login(self.request, auth_user)
return HttpResponseRedirect(self.get_success_url()) return HttpResponseRedirect(self.get_success_url())
@ -125,7 +132,8 @@ class SignupView(CreateView):
moodel = CustomUser moodel = CustomUser
def get_success_url(self): 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): def form_valid(self, form):
@ -155,7 +163,7 @@ class PaymentVMView(FormView):
form = self.get_form() form = self.get_form()
if form.is_valid(): if form.is_valid():
context = self.get_context_data()
specifications = request.session.get('vm_specs') specifications = request.session.get('vm_specs')
vm_type = specifications.get('hosting_company') vm_type = specifications.get('hosting_company')
vm = VirtualMachineType.objects.get(hosting_company=vm_type) vm = VirtualMachineType.objects.get(hosting_company=vm_type)
@ -185,20 +193,84 @@ class PaymentVMView(FormView):
# Make stripe charge to a customer # Make stripe charge to a customer
stripe_utils = StripeUtils() stripe_utils = StripeUtils()
charge = stripe_utils.make_charge(amount=final_price, charge_response = stripe_utils.make_charge(amount=final_price,
customer=customer.stripe_id) customer=customer.stripe_id)
order.set_stripe_charge(charge) charge = charge_response.get('response_object')
if not charge.paid: # Check if the payment was approved
# raise an error if not charge:
pass 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 # If the Stripe payment was successed, set order status approved
order.set_approved() order.set_approved()
# order.charge = request.session.update({
'charge': charge,
# Billing Address should be store here 'order': order.id,
'billing_address': billing_address.id
return HttpResponseRedirect(reverse('hosting:payment')) })
return HttpResponseRedirect(reverse('hosting:invoice'))
else: else:
return self.form_invalid(form) 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)

View file

@ -144,9 +144,10 @@ class StripeCustomer(models.Model):
stripe_utils = StripeUtils() stripe_utils = StripeUtils()
stripe_data = stripe_utils.create_customer(token, email) stripe_data = stripe_utils.create_customer(token, email)
stripe_cus_id = stripe_data.get('response_object').get('id')
stripe_customer = StripeCustomer.objects.\ stripe_customer = StripeCustomer.objects.\
create(user=user, stripe_id=stripe_data.get('id')) create(user=user, stripe_id=stripe_cus_id)
return stripe_customer return stripe_customer

View file

@ -1,18 +1,6 @@
Django==1.9.4 Django==1.9.4
aldryn-newsblog aldryn-newsblog
wheel wheel
=======
# lib
psycopg2>=2.6
Pillow>=2
html5lib==0.999
six==1.3.0 #compat
python-memcached
# django
django==1.7.10
#django-assets
django-bootstrap3 django-bootstrap3
django-cms django-cms
django-compressor django-compressor
@ -56,40 +44,6 @@ Pillow>=2
django-filer django-filer
cmsplugin-filer cmsplugin-filer
django-reversion django-reversion
=======
# django-cms-plugins
djangocms-admin-style==0.2.5
djangocms-text-ckeditor>=2.4
django-select2>=4.3.1
djangocms-blog>=0.4.0
djangocms-flash
djangocms-googlemap
djangocms-inherit
djangocms-teaser
djangocms-link
djangocms-snippet
djangocms-style
djangocms-column
djangocms-grid
djangocms-oembed
djangocms-table
cmsplugin-filer==0.10.1
# production
# circus-web
# chaussette
# meinheld
# python3 support
gevent>=1.1a2
# djangocms-page-meta
djangocms-page-meta
# memcache
pylibmc pylibmc
django_extensions django_extensions
django-debug-toolbar django-debug-toolbar

View file

@ -20,105 +20,105 @@ msgstr ""
#: templates/ungleich_page/includes/_about.html:8 #: templates/ungleich_page/includes/_about.html:8
msgid "ABOUT" msgid "ABOUT"
msgstr "" msgstr "Über ungleich"
#: templates/ungleich_page/includes/_about.html:9 #: templates/ungleich_page/includes/_about.html:9
msgid "The timeline of ungleich" msgid "The timeline of ungleich"
msgstr "" msgstr "Die Chronik von ungleich"
#: templates/ungleich_page/includes/_about.html:24 #: templates/ungleich_page/includes/_about.html:24
msgid "The first incarnation of ungleich" msgid "The first incarnation of ungleich"
msgstr "" msgstr "Die erste Inkarnation von ungleich"
#: templates/ungleich_page/includes/_about.html:25 #: templates/ungleich_page/includes/_about.html:25
msgid "in Germany" msgid "in Germany"
msgstr "" msgstr "in Deutschland"
#: templates/ungleich_page/includes/_about.html:37 #: templates/ungleich_page/includes/_about.html:37
msgid "ungleich founded" msgid "ungleich founded"
msgstr "" msgstr "ungleich gegründet"
#: templates/ungleich_page/includes/_about.html:38 #: templates/ungleich_page/includes/_about.html:38
msgid "in Switzerland" msgid "in Switzerland"
msgstr "" msgstr "in der Schweiz"
#: templates/ungleich_page/includes/_about.html:51 #: templates/ungleich_page/includes/_about.html:51
msgid "ungleich present at various conferences" msgid "ungleich present at various conferences"
msgstr "" msgstr "ungleich präsent an mehreren Konferenzen"
#: templates/ungleich_page/includes/_about.html:65 #: templates/ungleich_page/includes/_about.html:65
msgid "ungleich introduces HA-Hosting" msgid "ungleich introduces HA-Hosting"
msgstr "" msgstr "ungleich führt HA-Hosting ein"
#: templates/ungleich_page/includes/_about.html:66 #: templates/ungleich_page/includes/_about.html:66
msgid "and introduces affordable 24X7 support." msgid "and introduces affordable 24X7 support."
msgstr "" msgstr "und führt kostengünstigen 24X7 Support ein."
#: templates/ungleich_page/includes/_about.html:67 #: templates/ungleich_page/includes/_about.html:67
msgid "ungleich launches" msgid "ungleich launches"
msgstr "" msgstr "ungleich lanciert"
#: templates/ungleich_page/includes/_about.html:68 #: templates/ungleich_page/includes/_about.html:68
msgid "Digital Glarus project" msgid "Digital Glarus project"
msgstr "" msgstr "Digital Glarus Projekt"
#: templates/ungleich_page/includes/_about.html:74 #: templates/ungleich_page/includes/_about.html:74
msgid "and" msgid "and"
msgstr "" msgstr "und"
#: templates/ungleich_page/includes/_about.html:74 #: templates/ungleich_page/includes/_about.html:74
msgid "the story continues!" msgid "the story continues!"
msgstr "" msgstr "Die Geschichte geht weiter!"
#: templates/ungleich_page/includes/_contact_us.html:14 #: templates/ungleich_page/includes/_contact_us.html:14
#: templates/ungleich_page/includes/_contact_us.html:21 views.py:35 #: templates/ungleich_page/includes/_contact_us.html:21 views.py:35
msgid "Contact Us" msgid "Contact Us"
msgstr "Kontaktiere Uns" msgstr "Kontaktieren Sie uns"
#: templates/ungleich_page/includes/_contact_us.html:16 #: templates/ungleich_page/includes/_contact_us.html:16
msgid "Join us at" msgid "Join us at"
msgstr "" msgstr "Schliessen Sie sich uns an"
#: templates/ungleich_page/includes/_contact_us.html:16 #: templates/ungleich_page/includes/_contact_us.html:16
msgid "Digital Glarus" msgid "Digital Glarus"
msgstr "" msgstr "Digital Glarus"
#: templates/ungleich_page/includes/_contact_us.html:17 #: templates/ungleich_page/includes/_contact_us.html:17
msgid "a great co-working space in the middle of Alps!" msgid "a great co-working space in the middle of Alps!"
msgstr "" msgstr "ein wunderschöner Co-Working Space mitten in den Alpen"
#: templates/ungleich_page/includes/_contact_us.html:17 #: templates/ungleich_page/includes/_contact_us.html:17
msgid "You can contact us at" msgid "You can contact us at"
msgstr "" msgstr "Sie können uns kontaktieren unter"
#: templates/ungleich_page/includes/_contact_us.html:20 #: templates/ungleich_page/includes/_contact_us.html:20
msgid "or" msgid "or"
msgstr "" msgstr "oder"
#: templates/ungleich_page/includes/_contact_us.html:50 #: templates/ungleich_page/includes/_contact_us.html:50
msgid "Submit" msgid "Submit"
msgstr "" msgstr "Absenden"
#: templates/ungleich_page/includes/_footer.html:8 #: templates/ungleich_page/includes/_footer.html:8
msgid "Copyright © ungleich GmbH " msgid "Copyright © ungleich GmbH "
msgstr "" msgstr "Copyright © ungleich GmbH"
#: templates/ungleich_page/includes/_footer.html:22 #: templates/ungleich_page/includes/_footer.html:22
msgid "ungleich Home" msgid "ungleich Home"
msgstr "" msgstr "ungleich Home"
#: templates/ungleich_page/includes/_header.html:11 #: templates/ungleich_page/includes/_header.html:11
msgid "We Design, Configure &amp; Maintain <br> Your Linux Infrastructure " msgid "We Design, Configure &amp; Maintain <br> Your Linux Infrastructure "
msgstr "" msgstr "Wir designen, erstellen und warten Ihre Linux-Infrastruktur"
#: templates/ungleich_page/includes/_portfolio.html:8 #: templates/ungleich_page/includes/_portfolio.html:8
#: templates/ungleich_page/includes/_portfolio.html:9 #: templates/ungleich_page/includes/_portfolio.html:9
msgid "Hosting Products " msgid "Hosting Products "
msgstr "" msgstr "Hosting Produkte"
#: templates/ungleich_page/includes/_portfolio.html:16 #: templates/ungleich_page/includes/_portfolio.html:16
msgid "HA Hosting" msgid "HA Hosting"
msgstr "" msgstr "HA Hosting"
#: templates/ungleich_page/includes/_portfolio.html:18 #: templates/ungleich_page/includes/_portfolio.html:18
msgid "" msgid ""
@ -151,11 +151,11 @@ msgstr ""
#: templates/ungleich_page/includes/_services.html:8 #: templates/ungleich_page/includes/_services.html:8
msgid "our services" msgid "our services"
msgstr "" msgstr "Unsere Dienstleistungen"
#: templates/ungleich_page/includes/_services.html:18 #: templates/ungleich_page/includes/_services.html:18
msgid "Hosting" msgid "Hosting"
msgstr "" msgstr "Hosting"
#: templates/ungleich_page/includes/_services.html:20 #: templates/ungleich_page/includes/_services.html:20
msgid "" msgid ""
@ -165,7 +165,7 @@ msgstr ""
#: templates/ungleich_page/includes/_services.html:28 #: templates/ungleich_page/includes/_services.html:28
msgid "Configuration as a Service" msgid "Configuration as a Service"
msgstr "" msgstr "Konfiguration als Service"
#: templates/ungleich_page/includes/_services.html:30 #: templates/ungleich_page/includes/_services.html:30
msgid "" msgid ""
@ -186,7 +186,7 @@ msgstr ""
#: templates/ungleich_page/includes/_team.html:8 #: templates/ungleich_page/includes/_team.html:8
msgid "Why ungleich?*" msgid "Why ungleich?*"
msgstr "" msgstr "Warum ungleich?"
#: templates/ungleich_page/includes/_team.html:9 #: templates/ungleich_page/includes/_team.html:9
msgid "What our customers say" msgid "What our customers say"
@ -257,9 +257,8 @@ msgstr ""
#: views.py:25 #: views.py:25
msgid "Message Successfully Sent" msgid "Message Successfully Sent"
msgstr "" msgstr "Nachricht erfolgreich versendet"
#: views.py:36 #: views.py:36
msgid "If you have any question, just send us an email." msgid "If you have any question, just send us an email."
msgstr "" msgstr "Wenn Sie irgendwelche Fragen haben, schicken Sie uns einfach eine E-Mail."
"Wenn Sie irgendwelche Fragen haben, schicken Sie uns einfach eine E-Mail."

View file

@ -1,78 +0,0 @@
{% load cms_tags menu_tags sekizai_tags staticfiles bootstrap3 %}
<!doctype html>
<html>
<head>
<title>
{% block title %}
{% page_attribute "page_title" %}
{% endblock %}
</title>
{% addtoblock "external-css" %}
{% bootstrap_css %}
<link href='//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' rel="stylesheet" type="text/css">
<link href='//fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800'
rel='stylesheet' type='text/css'>
<!-- 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]-->
{% endaddtoblock %}
{% addtoblock "css" %}
<link href="{% static 'blog.ungleich.ch/css/clean-blog.css' %}" type="text/css"
rel="stylesheet" medial="all" />
{% endaddtoblock %}
{% block meta %}
<meta charset="UTF-8">
<meta name="description" content="{% page_attribute 'meta_description' %}">
{% include 'meta.html' %}
{% endblock %}
{% render_block "external-css" %}
{% render_block "css" postprocessor "compressor.contrib.sekizai.compress" %}
</head>
<body>
{% cms_toolbar %}
{% show_menu 0 0 0 1 "cms/ungleichch/_menu.html" %}
<!-- body -->
<!-- Main Content -->
{% block base_header %}
{% include "ungleich_page/_header_base.html" %}
{% endblock %}
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
{% block base_content %}
{% placeholder "default" %}
{% endblock %}
</div>
</div>
</div>
<!-- end body -->
{% include "cms/ungleichch/_footer.html" %}
{% addtoblock "external-js" %}
{% bootstrap_javascript %}
{% endaddtoblock %}
{% addtoblock "js" %}
<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-4', 'auto');
ga('send', 'pageview');
</script>
<script src="{% static 'blog.ungleich.ch/vendor/js/jquery.min.js' %}" type="text/javascript" />
<script src="{% static 'blog.ungleich.ch/js/navbar-scroll-up.js' %}" type="text/javascript" />
{% endaddtoblock %}
{% render_block "js" postprocessor "compressor.contrib.sekizai.compress" %}
{% render_block "external-js" %}
</body>
</html>

View file

@ -1,38 +0,0 @@
{% extends "ungleich_page/base_ungleich.html" %}
{% block base_content %}
<form action="{% url 'ungleich_page:contact' %}" method="post" >
{% csrf_token %}
<div class="row">
<div autofocus class="form-group col-lg-4 {% if form.name.errors %}has-error text-danger{% endif %}">
{{ form.name.label_tag }}
{{ form.name }}
{{ form.name.errors|striptags}}
</div>
<div class="form-group col-lg-4 {% if form.email.errors %}has-error text-danger {% endif %}">
{{ form.email.label_tag }}
{{ form.email }}
{{ form.email.errors|striptags}}
</div>
<div class="form-group col-lg-4 {% if form.phone_number.errors %}has-error text-danger {% endif %}">
{{ form.phone_number.label_tag }}
{{ form.phone_number }}
{{ form.phone_number.errors|striptags}}
</div>
<div class="clearfix"></div>
<div class="form-group col-lg-12 {% if form.message.errors %}has-error text-danger {% endif %}">
{{ form.message.label_tag }}
{{ form.message }}
{{ form.message.errors|striptags}}
</div>
{{ form.non_field_errors }}
<div class="form-group col-lg-12">
<input type="hidden" name="save" value="contact">
<button type="submit" class="btn btn-default" {% if form.name.errors %} autofocus {% endif %}>Submit</button>
</div>
</div>
</form>
{% block content %}
{% endblock %}
{% endblock %}

View file

@ -1,3 +0,0 @@
{% extends "base_glarus.html" %}
{% block base_content %}
{% endblock %}

View file

@ -1,5 +0,0 @@
{% extends "base_ungleich.html" %}
{% load cms_tags %}
{% block base_content %}
{% placeholder "page_content" %}
{% endblock %}

View file

@ -4,5 +4,6 @@ from django.utils.translation import ugettext_lazy as _
urlpatterns = [ urlpatterns = [
url(r'^$', LandingView.as_view(), name='landing'), url(r'^$', LandingView.as_view(), name='landing'),
url(r'^ungleich_page/?$', LandingView.as_view(), name='landing'),
url(_(r'contact/$'), ContactView.as_view(), name='contact'), url(_(r'contact/$'), ContactView.as_view(), name='contact'),
] ]

View file

@ -1,10 +1,61 @@
import stripe import stripe
from django.conf import settings from django.conf import settings
from django.db import models
stripe.api_key = settings.STRIPE_API_PRIVATE_KEY stripe.api_key = settings.STRIPE_API_PRIVATE_KEY
def handleStripeError(f):
def handleProblems(*args, **kwargs):
response = {
'paid': False,
'response_object': None,
'error': None
}
common_message = "Currently its not possible to make payments."
try:
response_object = f(*args, **kwargs)
response = {
'response_object': response_object,
'error': None
}
return response
except stripe.error.CardError as e:
# Since it's a decline, stripe.error.CardError will be caught
body = e.json_body
err = body['error']
response.update({'error': err['message']})
return response
except stripe.error.RateLimitError as e:
response.update({'error': "Too many requests made to the API too quickly"})
return response
except stripe.error.InvalidRequestError as e:
response.update({'error': "Invalid parameters"})
return response
except stripe.error.AuthenticationError as e:
# Authentication with Stripe's API failed
# (maybe you changed API keys recently)
response.update({'error': common_message})
return response
except stripe.error.APIConnectionError as e:
response.update({'error': common_message})
return response
except stripe.error.StripeError as e:
# maybe send email
response.update({'error': common_message})
return response
except Exception as e:
# maybe send email
response.update({'error': common_message})
return response
return handleProblems
class StripeUtils(object):
class StripeUtils(object): class StripeUtils(object):
CURRENCY = 'chf' CURRENCY = 'chf'
INTERVAL = 'month' INTERVAL = 'month'
@ -26,46 +77,48 @@ class StripeUtils(object):
user.stripecustomer.save() user.stripecustomer.save()
return customer return customer
@handleStripeError
def create_customer(self, token, email): def create_customer(self, token, email):
customer = stripe.Customer.create(
customer = self.stripe.Customer.create(
source=token, source=token,
description='description for testing', description='description for testing',
email=email email=email
) )
return customer return customer
@handleStripeError
def make_charge(self, amount=None, customer=None): def make_charge(self, amount=None, customer=None):
amount = int(amount * 100) # stripe amount unit, in cents amount = int(amount * 100) # stripe amount unit, in cents
import ipdb;ipdb.set_trace()
try:
charge = self.stripe.Charge.create( charge = self.stripe.Charge.create(
amount=amount, # in cents amount=amount, # in cents
currency=self.CURRENCY, currency=self.CURRENCY,
customer=customer customer=customer
) )
return charge return charge
except self.stripe.error.CardError as e:
# Since it's a decline, stripe.error.CardError will be caught
body = e.json_body
err = body['error']
return err['message']
except self.stripe.error.RateLimitError as e:
return "Too many requests made to the API too quickly"
except self.stripe.error.InvalidRequestError as e:
return "Invalid parameters"
except self.stripe.error.AuthenticationError as e:
# Authentication with Stripe's API failed
# (maybe you changed API keys recently)
pass
except self.stripe.error.APIConnectionError as e:
return "Currently its not possible to make payments."
except self.stripe.error.StripeError as e:
# maybe send email
return "Currently its not possible to make payments."
except Exception as e:
# maybe send email
return "Currently its not possible to make payments."
@handleStripeError
def create_plan(self, amount, name, id):
self.stripe.Plan.create(
amount=amount,
interval=self.INTERVAL,
name=name,
currency=self.CURRENCY,
id=id)
@handleStripeError
def make_payment(self, user, amount, token):
charge = self.stripe.Charge.create(
amount=amount, # in cents
currency=self.CURRENCY,
customer=customer
)
return charge
@handleStripeError
def create_plan(self, amount, name, id): def create_plan(self, amount, name, id):
self.stripe.Plan.create( self.stripe.Plan.create(
amount=amount, amount=amount,