Added alplora and datacenter beta program

This commit is contained in:
Levi 2017-02-14 23:34:06 -05:00
commit ea2f6444db
152 changed files with 20967 additions and 160 deletions

View file

@ -1,9 +1,9 @@
from django.contrib import admin
from .models import BetaAccess
from .models import BetaAccess, BetaAccessVMType, BetaAccessVM
# Register your models here.
admin.site.register(BetaAccess)
admin.site.register(BetaAccessVMType)
admin.site.register(BetaAccessVM)

View file

@ -1,6 +1,6 @@
from django import forms
from .models import BetaAccess
from .models import BetaAccess, BetaAccessVM
class BetaAccessForm(forms.ModelForm):
@ -9,3 +9,11 @@ class BetaAccessForm(forms.ModelForm):
class Meta:
fields = ['email']
model = BetaAccess
# class BetaAccessVMForm(forms.ModelForm):
# type = forms.CharField(widget=forms.EmailInput())
# class Meta:
# fields = ['email']
# model = BetaAccessVM

View file

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2017-02-14 16:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='BetaAccessVM',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ssd', models.IntegerField()),
('ram', models.IntegerField()),
('cpu', models.IntegerField()),
('price', models.FloatField()),
],
),
]

View file

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2017-02-14 16:38
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0002_betaaccessvm'),
]
operations = [
migrations.RenameModel(
old_name='BetaAccessVM',
new_name='BetaAccessVMType',
),
]

View file

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2017-02-14 16:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0003_auto_20170214_1638'),
]
operations = [
migrations.CreateModel(
name='BetaAccessVM',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('amount', models.IntegerField()),
('access', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='datacenterlight.BetaAccess')),
('type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='datacenterlight.BetaAccessVMType')),
],
),
]

View file

@ -1,10 +1,43 @@
from django.db import models
# Create your models here.
class BetaAccessVMType(models.Model):
ssd = models.IntegerField()
ram = models.IntegerField()
cpu = models.IntegerField()
price = models.FloatField()
def __str__(self):
return "ID: %s - ssd %s - ram %s - cpu %s - price %s " % \
(self.id, str(self.ssd), self.ram, self.cpu, self.price)
class BetaAccess(models.Model):
email = models.CharField(max_length=250)
# vm = models.ForeignKey(BetaAccessVM)
def __str__(self):
return self.email
vms = self.betaaccessvm_set.all()
rep = "Email: %s " % self.email
for vm in vms:
rep += "(vm:%s - amount:%s) - " % (vm.type.id, vm.amount)
return rep
class BetaAccessVM(models.Model):
type = models.ForeignKey(BetaAccessVMType)
access = models.ForeignKey(BetaAccess)
amount = models.IntegerField()
@classmethod
def create(cls, data):
VM_KEY_ID = 0
VM_AMOUNT = 1
email = data.get('email')
beta_access = BetaAccess.objects.create(email=email)
vm_data = [(key, value) for key, value in data.items() if 'vm' in key]
for vm in vm_data:
vm_id = vm[VM_KEY_ID].split('-').pop()
vm_type = BetaAccessVMType.objects.get(id=vm_id)
cls.objects.create(access=beta_access, amount=vm[VM_AMOUNT], type=vm_type)

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -0,0 +1,55 @@
(function($){
'use strict'; // Start of use strict
$(document).ready(function(){
init_options_interested();
init_nav();
change_values();
form_submit();
});
function init_options_interested(){
$('.row-vms').click(function(){
$('.row-vms').removeClass('row-vms__active');
$(this).addClass('row-vms__active');
var number = $('.row-vms__active input').val();
var price = $('.row-vms__active input').data('price');
_calculate(number, price);
});
}
function init_nav(){
$('.nav-local').click(function(){
$('html, body').animate({
scrollTop: $('#'+$(this).data('href')).offset().top
});
});
}
function change_values(){
$('.number-vms').keyup(function () {
var number = $(this).val();
var price = $(this).data('price');
_calculate(number, price);
});
}
function form_submit(){
// $('#submit').click(function(){
// $('.contain-form').fadeOut();
// $('.loading').fadeIn();
// setTimeout(function(){
// $('.loading').fadeOut();
// $('.succes-message').fadeIn();
// }, 3000);
// });
}
function _calculate(numbers, price){
$('#valueTotal').text(numbers*price*31);
}
})(jQuery); // End of use strict

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,141 +1,85 @@
<!DOCTYPE html>
<html lang="en">
{% load staticfiles i18n%}
<!doctype html>
<html class="no-js">
<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]-->
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
<title>landings</title>
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="stylesheet" href="{% static 'datacenterlight/css/main.css' %}">
<script src="{% static 'datacenterlight/js/vendor/modernizr.js' %}"></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="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 -->
<!--[if IE]><p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p><![endif]-->
<nav class="navbar navbar-toggleable-md navbar-light bg-faded navbar-landing d-flex justify-content-between"><a class="navbar-brand nav-local" href="javascript:void(0)" data-href="home">DCL Interest</a> <a class="navbar-brand nav-local" href="javascript:void(0)" data-href="beta">Beta Program</a></nav>
<section class="section-home" id="home">
<div class="container d-flex justify-content-center align-items-center">
<div class="title">
<h1>Your affordable Swiss VM</h1></div>
</div>
<!-- /.container -->
</nav>
<!-- Header -->
<a name="about"></a>
<div class="intro-header">
</section>
<section class="section-description">
<div class="container">
<div class=".col-md-6">
<div class="intro-message"><img src="img/checkmark.png" class="responsive">
<p>Thank you for your interest in joining Rails-Hosting Beta.<br>
    We will come back to you shortly to give you access to our  infrastructure.
</p>
<hr class="intro-divider">
<ul class="list-inline intro-social-buttons">
</ul>
</div>
</div>
</div>
<p>Are you looking for a secure and affordable VM in the midst of the Swiss mountains?</p>
<p>While there are many offers in Switzerland for secure hosting, we haven't found any that is affordable. So we decided we will built one in the Glarus mountains.</p>
<p>Right now we are in a preparing the tech stack and talking to infrastructure providers to find the optimal location.</p>
<p>Our objective is to launch this offer starting in 2017. Are you curious how it works? Be one of the first to try it and <a class="nav-local" href="javascript:void(0)" data-href="beta">request access to our beta program.</a></p>
</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>
</section>
<section class="section-beta" id="beta">
<div class="contain-form">
<div class="title">
<h1>Beta Program</h1></div>
<div class="form-interested">
<h2>I am interested in running</h2>
<form action="." method="POST">
{% for vm in vms %}
<div class="row-vms d-flex align-items-center">
<div class="form-group">
<input type="number" name="vm-{{vm.id}}" class="form-control number-vms" value="1" data-price="{{vm.price}}">
</div>
<div class="text"><span>number of VMs ({{vm.ssd}} GB SSD, {{vm.ram}} GB RAM, {{vm.cpu}} CPU) - {{vm.price}}chf / day</span></div>
</div>
{% endfor %}
<p class="total">At a monthly total of <span id="valueTotal">0</span>chf per day</p>
<div class="form-group row email align-items-center">
<label for="example-email-input" class="col-form-label">You can reach me at</label>
<div>
<input class="form-control" name="email" type="email" placeholder="email" id="example-email-input">
</div>
</div>
<div class="notice">
<p>Notice: this is <strong>no</strong> an order - you don't have to pay anything, it just helps us to setup the right infrastructure</p>
</div>
{% csrf_token %}
<div class="submit">
<button type="submit" class="btn btn-block btn-success">Submit</button>
</div>
</form>
</div>
</div>
</footer>
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<div class="loading"><img src="{% static 'datacenterlight/img/loading.gif' %}" alt=""></div>
<div class="succes-message">
<div class="title">
<h1>Thank You</h1></div>
<div class="container" style="margin-top:3rem">
<p>Thanks for letting us know about your interest! We will come back to you as soon as our beta program starts!</p>
<p>Meanwhile, you can checkout news about it on <a href="#">Twitter</a>, <a href="#">Facebook</a> and <a href="#">Instagram</a></p>
</div>
</div>
</section>
<script>
! function(e, t, a, n, c, o) {
e.GoogleAnalyticsObject = n, e[n] || (e[n] = function() {
(e[n].q = e[n].q || []).push(arguments)
}), e[n].l = +new Date, c = t.createElement(a), o = t.getElementsByTagName(a)[0], c.src = "https://www.google-analytics.com/analytics.js", o.parentNode.insertBefore(c, o)
}(window, document, "script", "ga"), ga("create", "UA-XXXXX-X"), ga("send", "pageview")
</script>
<script src="{% static 'datacenterlight/js/vendor.js' %}"></script>
<script src="{% static 'datacenterlight/js/main.js' %}"></script>
</body>
</html>
</html>

View file

@ -0,0 +1,64 @@
{% load staticfiles i18n%}
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
<title>landings</title>
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="stylesheet" href="{% static 'datacenterlight/css/main.css' %}">
<script src="{% static 'datacenterlight/js/vendor/modernizr.js' %}"></script>
</head>
<body>
<!--[if IE]><p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p><![endif]-->
<nav class="navbar navbar-toggleable-md navbar-light bg-faded navbar-landing d-flex justify-content-between"><a class="navbar-brand nav-local" href="javascript:void(0)" data-href="home">DCL Interest</a> <a class="navbar-brand" href="index.html" data-href="beta">Beta Program</a></nav>
<section class="section-home" id="home">
<div class="container d-flex justify-content-center align-items-center">
<div class="title title-landings">
<h1>Swiss 2 GB VM for 0.5 CHF per day</h1></div>
</div>
</section>
<section class="section-beta" id="beta">
<div class="contain-form">
<div class="form-interested">
<h2>Details about the offer..<ul><li><span>2 GB RAM</span></li><li><span>1 CPU</span></li><li><span>10 GB Dus</span></li></ul><h2>I am interested in running</h2>
<form action="">
<div class="row-vms d-flex align-items-center justify-content-between row-vms__active">
<div class="form-group">
<input type="number" class="form-control number-vms" value="1" data-price="0.5">
<div class="text"><span>number of VMs</span></div>
</div>
<div class="submit">
<button type="button" id="submit" class="btn btn-block btn-success">Submit</button>
</div>
</div>
<p>Interested in other offers? <a href="index.html">Checkout our beta program offers!</a></p>
</form>
</h2>
</div>
</div>
<div class="loading"><img src="{% static 'datacenterlight/img/loading.gif' %}" alt=""></div>
<div class="succes-message">
<div class="title">
<h1>Thank You</h1></div>
<div class="container" style="margin-top:3rem">
<p>Thanks for letting us know about your interest! We will come back to you as soon as our beta program starts!</p>
<p>Meanwhile, you can checkout news about it on <a href="#">Twitter</a>, <a href="#">Facebook</a> and <a href="#">Instagram</a></p>
</div>
</div>
</section>
<script>
! function(e, t, a, n, c, o) {
e.GoogleAnalyticsObject = n, e[n] || (e[n] = function() {
(e[n].q = e[n].q || []).push(arguments)
}), e[n].l = +new Date, c = t.createElement(a), o = t.getElementsByTagName(a)[0], c.src = "https://www.google-analytics.com/analytics.js", o.parentNode.insertBefore(c, o)
}(window, document, "script", "ga"), ga("create", "UA-XXXXX-X"), ga("send", "pageview")
</script>
<script src="{% static 'datacenterlight/js/vendor.js' %}"></script>
<script src="{% static 'datacenterlight/js/main.js' %}"></script>
</body>
</html>

View file

@ -1,8 +1,10 @@
from django.conf.urls import url
from .views import IndexView
from .views import IndexView, BetaProgramView, LandingProgramView
urlpatterns = [
url(r'^/?$', IndexView.as_view(), name='index'),
url(r'^/beta-program/?$', BetaProgramView.as_view(), name='beta'),
url(r'^/landing/?$', LandingProgramView.as_view(), name='landing'),
]

View file

@ -1,11 +1,77 @@
from django.views.generic import FormView, CreateView
from django.views.generic import FormView, CreateView, TemplateView
from django.http import HttpResponseRedirect
from .forms import BetaAccessForm
from .models import BetaAccess
from .models import BetaAccess, BetaAccessVMType, BetaAccessVM
from django.contrib import messages
from django.core.urlresolvers import reverse_lazy, reverse
from utils.mailer import BaseEmail
class LandingProgramView(TemplateView):
template_name = "datacenterlight/landing.html"
class BetaProgramView(CreateView):
template_name = "datacenterlight/beta.html"
model = BetaAccessVM
fields = '__all__'
# form_class = BetaAccessForm
# success_url = "/datacenterlight#requestform"
success_message = "Thank you, we will contact you as soon as possible"
def get_success_url(self):
success_url = reverse('datacenterlight:beta')
success_url += "#success"
return success_url
def get_context_data(self, **kwargs):
vms = BetaAccessVMType.objects.all()
context = super(BetaProgramView, self).get_context_data(**kwargs)
context.update({
'base_url': "{0}://{1}".format(self.request.scheme, self.request.get_host()),
'vms': vms
})
return context
def post(self, request, *args, **kwargs):
data = request.POST
BetaAccessVM.create(data)
return HttpResponseRedirect(self.get_success_url())
# def form_valid(self, form):
# context = {
# 'base_url': "{0}://{1}".format(self.request.scheme, self.request.get_host())
# }
# email_data = {
# 'subject': 'DatacenterLight Beta Access Request',
# 'to': form.cleaned_data.get('email'),
# 'context': context,
# 'template_name': 'request_access_confirmation',
# 'template_path': 'datacenterlight/emails/'
# }
# email = BaseEmail(**email_data)
# email.send()
# context.update({
# 'email': form.cleaned_data.get('email')
# })
# email_data = {
# 'subject': 'DatacenterLight Beta Access Request',
# 'to': 'info@ungleich.ch',
# 'context': context,
# 'template_name': 'request_access_notification',
# 'template_path': 'datacenterlight/emails/'
# }
# email = BaseEmail(**email_data)
# email.send()
# messages.add_message(self.request, messages.SUCCESS, self.success_message)
# return super(IndexView, self).form_valid(form)
class IndexView(CreateView):
template_name = "datacenterlight/index.html"
model = BetaAccess