merged master
This commit is contained in:
		
				commit
				
					
						d6b3ee5e09
					
				
			
		
					 17 changed files with 820 additions and 544 deletions
				
			
		|  | @ -8,7 +8,7 @@ msgid "" | |||
| msgstr "" | ||||
| "Project-Id-Version: PACKAGE VERSION\n" | ||||
| "Report-Msgid-Bugs-To: \n" | ||||
| "POT-Creation-Date: 2017-07-13 23:55+0530\n" | ||||
| "POT-Creation-Date: 2017-07-24 18:51+0300\n" | ||||
| "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||||
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||||
| "Language-Team: LANGUAGE <LL@li.org>\n" | ||||
|  | @ -103,9 +103,8 @@ msgid "Please enter a valid email address." | |||
| msgstr "Bitte gib eine gültige E-Mailadresse ein." | ||||
| 
 | ||||
| #: templates/datacenterlight/calculator_form.html:88 | ||||
| #: templates/datacenterlight/pricing.html:79 | ||||
| msgid "Order Now!" | ||||
| msgstr "Bestelle jetzt!" | ||||
| msgid "Continue" | ||||
| msgstr "Weiter" | ||||
| 
 | ||||
| #: templates/datacenterlight/emails/request_access_confirmation.html:99 | ||||
| #: templates/datacenterlight/emails/request_access_confirmation.txt:99 | ||||
|  | @ -325,46 +324,46 @@ msgid "Confirm Order" | |||
| msgstr "Bestellung Bestätigen" | ||||
| 
 | ||||
| #: templates/datacenterlight/order_detail.html:30 | ||||
| msgid "Billed To:" | ||||
| msgstr "Rechnungsadresse" | ||||
| 
 | ||||
| #: templates/datacenterlight/order_detail.html:39 | ||||
| msgid "Date" | ||||
| msgstr "Datum" | ||||
| 
 | ||||
| #: templates/datacenterlight/order_detail.html:48 | ||||
| #: templates/datacenterlight/order_detail.html:36 | ||||
| msgid "Billed To:" | ||||
| msgstr "Rechnungsadresse" | ||||
| 
 | ||||
| #: templates/datacenterlight/order_detail.html:47 | ||||
| msgid "Payment Method:" | ||||
| msgstr "Bezahlmethode" | ||||
| 
 | ||||
| #: templates/datacenterlight/order_detail.html:49 | ||||
| #: templates/datacenterlight/order_detail.html:48 | ||||
| msgid "ending" | ||||
| msgstr "endend in" | ||||
| 
 | ||||
| #: templates/datacenterlight/order_detail.html:59 | ||||
| #: templates/datacenterlight/order_detail.html:58 | ||||
| msgid "Order summary" | ||||
| msgstr "Bestellungsübersicht" | ||||
| 
 | ||||
| #: templates/datacenterlight/order_detail.html:63 | ||||
| #: templates/datacenterlight/order_detail.html:62 | ||||
| msgid "Cores" | ||||
| msgstr "Prozessorkerne" | ||||
| 
 | ||||
| #: templates/datacenterlight/order_detail.html:65 | ||||
| #: templates/datacenterlight/order_detail.html:64 | ||||
| msgid "Memory" | ||||
| msgstr "Arbeitsspeicher" | ||||
| 
 | ||||
| #: templates/datacenterlight/order_detail.html:67 | ||||
| #: templates/datacenterlight/order_detail.html:66 | ||||
| msgid "Disk space" | ||||
| msgstr "Festplattenkapazität" | ||||
| 
 | ||||
| #: templates/datacenterlight/order_detail.html:69 | ||||
| #: templates/datacenterlight/order_detail.html:68 | ||||
| msgid "Configuration" | ||||
| msgstr "Konfiguration" | ||||
| 
 | ||||
| #: templates/datacenterlight/order_detail.html:71 | ||||
| #: templates/datacenterlight/order_detail.html:70 | ||||
| msgid "Total" | ||||
| msgstr "" | ||||
| 
 | ||||
| #: templates/datacenterlight/order_detail.html:78 | ||||
| #: templates/datacenterlight/order_detail.html:77 | ||||
| msgid "Place order" | ||||
| msgstr "Bestellen" | ||||
| 
 | ||||
|  | @ -372,6 +371,10 @@ msgstr "Bestellen" | |||
| msgid "We are cutting down the costs significantly!" | ||||
| msgstr "Wir sorgen dafür, dass die Kosten für Dich signifikant abnehmen" | ||||
| 
 | ||||
| #: templates/datacenterlight/pricing.html:79 | ||||
| msgid "Order Now!" | ||||
| msgstr "Bestelle jetzt!" | ||||
| 
 | ||||
| #: templates/datacenterlight/pricing.html:89 | ||||
| msgid "" | ||||
| "Our VMs are hosted in Glarus, Switzerland, and our website is currently " | ||||
|  |  | |||
							
								
								
									
										29
									
								
								datacenterlight/management/commands/fetchvmtemplates.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								datacenterlight/management/commands/fetchvmtemplates.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | |||
| from django.core.management.base import BaseCommand | ||||
| from opennebula_api.models import OpenNebulaManager | ||||
| from datacenterlight.models import VMTemplate | ||||
| import logging | ||||
| 
 | ||||
| logger = logging.getLogger(__name__) | ||||
| 
 | ||||
| 
 | ||||
| class Command(BaseCommand): | ||||
|     help = 'Fetches the VM templates from OpenNebula and populates the dcl VMTemplate model' | ||||
| 
 | ||||
|     def handle(self, *args, **options): | ||||
|         try: | ||||
|             manager = OpenNebulaManager() | ||||
|             templates = manager.get_templates() | ||||
|             dcl_vm_templates = [] | ||||
|             for template in templates: | ||||
|                 template_name = template.name.strip('public-') | ||||
|                 template_id = template.id | ||||
|                 dcl_vm_template = VMTemplate.create(template_name, template_id) | ||||
|                 dcl_vm_templates.append(dcl_vm_template) | ||||
| 
 | ||||
|             old_vm_templates = VMTemplate.objects.all() | ||||
|             old_vm_templates.delete() | ||||
| 
 | ||||
|             for dcl_vm_template in dcl_vm_templates: | ||||
|                 dcl_vm_template.save() | ||||
|         except Exception as e: | ||||
|             logger.error('Error connecting to OpenNebula. Error Details: {err}'.format(err=str(e))) | ||||
|  | @ -9,12 +9,13 @@ class BetaAccessVMType(models.Model): | |||
| 
 | ||||
|     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) | ||||
|                (self.id, str(self.ssd), self.ram, self.cpu, self.price) | ||||
| 
 | ||||
| 
 | ||||
| class BetaAccess(models.Model): | ||||
|     email = models.CharField(max_length=250) | ||||
|     name = models.CharField(max_length=250) | ||||
| 
 | ||||
|     # vm = models.ForeignKey(BetaAccessVM) | ||||
| 
 | ||||
|     def __str__(self): | ||||
|  | @ -48,3 +49,13 @@ class BetaAccessVM(models.Model): | |||
|                                                   amount=vm[VM_AMOUNT], type=vm_type)) | ||||
| 
 | ||||
|         return created_vms | ||||
| 
 | ||||
| 
 | ||||
| class VMTemplate(models.Model): | ||||
|     name = models.CharField(max_length=50) | ||||
|     opennebula_vm_template_id = models.IntegerField() | ||||
| 
 | ||||
|     @classmethod | ||||
|     def create(cls, name, opennebula_vm_template_id): | ||||
|         vm_template = cls(name=name, opennebula_vm_template_id=opennebula_vm_template_id) | ||||
|         return vm_template | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -1,22 +1,22 @@ | |||
| (function($){ | ||||
| (function($) { | ||||
|     "use strict"; // Start of use strict
 | ||||
| 
 | ||||
| 
 | ||||
|     /* --------------------------------------------- | ||||
|      Scripts initialization | ||||
|      --------------------------------------------- */ | ||||
|     var cardPricing ={ | ||||
|     var cardPricing = { | ||||
|         'cpu': { | ||||
|             'id': 'coreValue', | ||||
|             'value': 1, | ||||
|             'min':1, | ||||
|             'min': 1, | ||||
|             'max': 48, | ||||
|             'interval': 1 | ||||
|         }, | ||||
|         'ram': { | ||||
|             'id': 'ramValue', | ||||
|             'value': 2, | ||||
|             'min':2, | ||||
|             'min': 2, | ||||
|             'max': 200, | ||||
|             'interval': 1 | ||||
|         }, | ||||
|  | @ -28,21 +28,21 @@ | |||
|             'interval': 10 | ||||
|         } | ||||
|     }; | ||||
|     $(window).load(function(){ | ||||
|     $(window).load(function() { | ||||
| 
 | ||||
| 
 | ||||
|     }); | ||||
| 
 | ||||
|     $(document).ready(function(){ | ||||
|     $(document).ready(function() { | ||||
|         verifiedUrl(); | ||||
|        _navScroll(); | ||||
|        _initScroll(); | ||||
|        _initNavUrl(); | ||||
|        _initPricing(); | ||||
|         _navScroll(); | ||||
|         _initScroll(); | ||||
|         _initNavUrl(); | ||||
|         _initPricing(); | ||||
| 
 | ||||
|     }); | ||||
| 
 | ||||
|     $(window).resize(function(){ | ||||
|     $(window).resize(function() { | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  | @ -53,102 +53,112 @@ | |||
|     /* --------------------------------------------- | ||||
|      Nav panel classic | ||||
|      --------------------------------------------- */ | ||||
|      if (window.matchMedia("(min-width: 767px)").matches) { | ||||
| 		 $('ul.nav li.dropdown').hover(function() { | ||||
| 		  $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(500); | ||||
| 		}, function() { | ||||
| 		  $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut(500); | ||||
| 		}); | ||||
| } else { | ||||
|   /* the viewport is less than 400 pixels wide */ | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     function _initScroll(){ | ||||
|         $(window).scroll(function(){ | ||||
|           _navScroll(); | ||||
|     if (window.matchMedia("(min-width: 767px)").matches) { | ||||
|         $('ul.nav li.dropdown').hover(function() { | ||||
|             $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(500); | ||||
|         }, function() { | ||||
|             $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut(500); | ||||
|         }); | ||||
| 
 | ||||
|     } else { | ||||
|         /* the viewport is less than 400 pixels wide */ | ||||
|     } | ||||
| 
 | ||||
|     function _navScroll(){ | ||||
|        	if($(window).scrollTop() > 10 ){ | ||||
| 
 | ||||
| 
 | ||||
|     function _initScroll() { | ||||
|         $(window).scroll(function() { | ||||
|             _navScroll(); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     function _navScroll() { | ||||
|         if ($(window).scrollTop() > 10) { | ||||
|             $(".navbar").removeClass("navbar-transparent"); | ||||
|             $(".navbar-default .btn-link").css("color", "#777"); | ||||
|             $(".dropdown-menu").removeClass("navbar-transparent"); | ||||
|             $(".dropdown-menu > li > a").css("color", "#777"); | ||||
|         }else{ | ||||
|         } else { | ||||
|             $(".navbar").addClass("navbar-transparent"); | ||||
|             $(".navbar-default .btn-link").css("color", "#fff"); | ||||
|             $(".dropdown-menu").addClass("navbar-transparent"); | ||||
|             $(".dropdown-menu > li > a").css("color", "#fff"); | ||||
|         } | ||||
|     } | ||||
| 	function _initNavUrl(){ | ||||
|         $('.url').click(function(){ | ||||
|              var href = $(this).attr('data-url'); | ||||
|              $('.navbar-collapse').removeClass('in'); | ||||
|              $('.navbar-collapse').addClass('collapsing'); | ||||
|              $('html, body').animate({ | ||||
|                 scrollTop: $(href).offset().top | ||||
|             }, 1000); | ||||
| 
 | ||||
|     function _initNavUrl() { | ||||
|         $('.url').click(function(event) { | ||||
|             event.preventDefault(); | ||||
|             var href = $(this).attr('data-url'); | ||||
|             $('.navbar-collapse').removeClass('in'); | ||||
|             $('.navbar-collapse').addClass('collapsing'); | ||||
|             var url = window.location.pathname; | ||||
|             var urlSplit = url.split('/'); | ||||
|             if (urlSplit.length === 3 && urlSplit[2] === 'datacenterlight') { | ||||
|                 $('html, body').animate({ | ||||
|                     scrollTop: $(href).offset().top | ||||
|                 }, 1000); | ||||
|             } else { | ||||
|                 var allUrl = window.location.href; | ||||
|                 var redirect = allUrl.split('whydatacenterlight') | ||||
|                 window.location.href = '/en-us/datacenterlight' + href; | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|     function verifiedUrl(){ | ||||
|         if(window.location.href.indexOf('#success') > -1){ | ||||
| 
 | ||||
|     function verifiedUrl() { | ||||
|         if (window.location.href.indexOf('#success') > -1) { | ||||
|             form_success(); | ||||
|             console.log('epa'); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     function _initPricing(){ | ||||
|     function _initPricing() { | ||||
|         _fetchPricing(); | ||||
| 
 | ||||
|         $('.fa-minus-circle.left').click(function(event){ | ||||
|         $('.fa-minus-circle.left').click(function(event) { | ||||
|             var data = $(this).data('minus'); | ||||
| 
 | ||||
|             if(cardPricing[data].value > cardPricing[data].min){ | ||||
|             if (cardPricing[data].value > cardPricing[data].min) { | ||||
|                 cardPricing[data].value = Number(cardPricing[data].value) - cardPricing[data].interval; | ||||
|             } | ||||
|             _fetchPricing(); | ||||
|         }); | ||||
|         $('.fa-plus-circle.right').click(function(event){ | ||||
|         $('.fa-plus-circle.right').click(function(event) { | ||||
|             var data = $(this).data('plus'); | ||||
|             if(cardPricing[data].value < cardPricing[data].max){ | ||||
|             if (cardPricing[data].value < cardPricing[data].max) { | ||||
|                 cardPricing[data].value = Number(cardPricing[data].value) + cardPricing[data].interval; | ||||
|             } | ||||
|             _fetchPricing(); | ||||
|         }); | ||||
| 
 | ||||
|         $('.input-price').change(function(){ | ||||
|         $('.input-price').change(function() { | ||||
|             var data = $(this).attr("name"); | ||||
|             cardPricing[data].value = $('input[name='+data+']').val(); | ||||
|             cardPricing[data].value = $('input[name=' + data + ']').val(); | ||||
|             _fetchPricing(); | ||||
|         }); | ||||
|     } | ||||
|     function _fetchPricing(){ | ||||
|         Object.keys(cardPricing).map(function(element){ | ||||
| 
 | ||||
|     function _fetchPricing() { | ||||
|         Object.keys(cardPricing).map(function(element) { | ||||
|             //$('#'+cardPricing[element].id).val(cardPricing[element].value);
 | ||||
|             $('input[name='+element+']').val(cardPricing[element].value); | ||||
|             $('input[name=' + element + ']').val(cardPricing[element].value); | ||||
|         }); | ||||
|         _calcPricing(); | ||||
|     } | ||||
| 
 | ||||
|     function _calcPricing(){ | ||||
|         var total = (cardPricing['cpu'].value * 5) + (2* cardPricing['ram'].value) + (0.6* cardPricing['storage'].value); | ||||
|     function _calcPricing() { | ||||
|         var total = (cardPricing['cpu'].value * 5) + (2 * cardPricing['ram'].value) + (0.6 * cardPricing['storage'].value); | ||||
|         total = parseFloat(total.toFixed(2)); | ||||
| 
 | ||||
|         $("#total").text(total); | ||||
|         $('input[name=total]').val(total); | ||||
|     } | ||||
|     function form_success(){ | ||||
| 
 | ||||
|     function form_success() { | ||||
|         $('#sucessModal').modal('show'); | ||||
|     } | ||||
|     function _calculate(numbers, price){ | ||||
|         $('#valueTotal').text(numbers*price*31); | ||||
| 
 | ||||
|     function _calculate(numbers, price) { | ||||
|         $('#valueTotal').text(numbers * price * 31); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| })(jQuery); | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ | |||
| <form id="order_form" method="POST" action="" data-toggle="validator" role="form"> | ||||
|     {% csrf_token %} | ||||
|     <div class="title"> | ||||
|        <h3>{% trans "VM hosting" %} </h3> | ||||
|         <h3>{% trans "VM hosting" %} </h3> | ||||
|     </div> | ||||
|     <div class="price"> | ||||
|         <span id="total">15</span> | ||||
|  | @ -17,36 +17,63 @@ | |||
|         </div> | ||||
|         <div class="form-group"> | ||||
|             <div class="description input"> | ||||
|             <i class="fa fa-minus-circle left" data-minus="cpu" aria-hidden="true"></i> | ||||
|             <input class="input-price select-number" type="number"  min="1" max="48" id="coreValue" name="cpu" data-error="{% trans 'Please enter a value in range 1 - 48.' %}" required> | ||||
|             <span> Core</span> | ||||
|             <i class="fa fa-plus-circle right" data-plus="cpu"  aria-hidden="true"></i> | ||||
|                 <i class="fa fa-minus-circle left" data-minus="cpu" aria-hidden="true"></i> | ||||
|                 <input class="input-price select-number" type="number" min="1" max="48" id="coreValue" name="cpu" | ||||
|                        data-error="{% trans 'Please enter a value in range 1 - 48.' %}" required> | ||||
|                 <span> Core</span> | ||||
|                 <i class="fa fa-plus-circle right" data-plus="cpu" aria-hidden="true"></i> | ||||
|             </div> | ||||
|             <div class="help-block with-errors"> | ||||
|                 {% for message in messages %} | ||||
|                     {% if 'cores' in message.tags %} | ||||
|                      <ul class="list-unstyled"><li> | ||||
|                         {{ message|safe }} | ||||
|                     </li></ul> | ||||
|                     {% endif %} | ||||
|                 {% endfor %} | ||||
|             </div> | ||||
|             <div class="help-block with-errors"></div> | ||||
|         </div> | ||||
|         <div class="form-group"> | ||||
|             <div class="description input"> | ||||
|             <i class="fa fa-minus-circle left" data-minus="ram" aria-hidden="true"></i> | ||||
|             <input id="ramValue" class="input-price select-number" type="number"  min="2" max="200"  name="ram" data-error="{% trans 'Please enter a value in range 2 - 200.' %}" required> | ||||
|             <span> GB RAM</span> | ||||
|             <i class="fa fa-plus-circle right" data-plus="ram"  aria-hidden="true"></i> | ||||
|                 <i class="fa fa-minus-circle left" data-minus="ram" aria-hidden="true"></i> | ||||
|                 <input id="ramValue" class="input-price select-number" type="number" min="2" max="200" name="ram" | ||||
|                        data-error="{% trans 'Please enter a value in range 2 - 200.' %}" required> | ||||
|                 <span> GB RAM</span> | ||||
|                 <i class="fa fa-plus-circle right" data-plus="ram" aria-hidden="true"></i> | ||||
|             </div> | ||||
|             <div class="help-block with-errors"> | ||||
|                 {% for message in messages %} | ||||
|                     {% if 'memory' in message.tags %} | ||||
|                      <ul class="list-unstyled"><li> | ||||
|                         {{ message|safe }} | ||||
|                     </li></ul> | ||||
|                     {% endif %} | ||||
|                 {% endfor %} | ||||
|             </div> | ||||
|             <div class="help-block with-errors"></div> | ||||
|         </div> | ||||
|         <div class="form-group"> | ||||
|             <div class="description input"> | ||||
|             <i class="fa fa-minus-circle left" data-minus="storage" aria-hidden="true"></i> | ||||
|             <input id="storageValue" class="input-price select-number" type="number"  min="10" max="2000" step="10" name="storage" data-error="{% trans 'Please enter a value in range 10 - 2000.' %}" required> | ||||
|             <span>{% trans "GB Storage (SSD)" %}</span> | ||||
|             <i class="fa fa-plus-circle right" data-plus="storage"  aria-hidden="true"></i> | ||||
|                 <i class="fa fa-minus-circle left" data-minus="storage" aria-hidden="true"></i> | ||||
|                 <input id="storageValue" class="input-price select-number" type="number" min="10" max="2000" step="10" | ||||
|                        name="storage" data-error="{% trans 'Please enter a value in range 10 - 2000.' %}" required> | ||||
|                 <span>{% trans "GB Storage (SSD)" %}</span> | ||||
|                 <i class="fa fa-plus-circle right" data-plus="storage" aria-hidden="true"></i> | ||||
|             </div> | ||||
|             <div class="help-block with-errors"> | ||||
|                 {% for message in messages %} | ||||
|                     {% if 'storage' in message.tags %} | ||||
|                      <ul class="list-unstyled"><li> | ||||
|                         {{ message|safe }} | ||||
|                     </li></ul> | ||||
|                     {% endif %} | ||||
|                 {% endfor %} | ||||
|             </div> | ||||
|             <div class="help-block with-errors"></div> | ||||
|         </div> | ||||
|         <div class="description select-configuration input form-group justify-center"> | ||||
|             <label for="config">OS</label> | ||||
|             <select name="config" id=""> | ||||
|                 {% for template in templates %} | ||||
|                     <option value="{{template.id}}">{{template.name}} </option> | ||||
|                 <option value="{{template.opennebula_vm_template_id}}">{{template.name}}</option> | ||||
|                 {% endfor %} | ||||
|             </select> | ||||
|         </div> | ||||
|  | @ -56,34 +83,41 @@ | |||
|         </div>--> | ||||
|         <div class="form-group"> | ||||
|             <div class="description input justify-center"> | ||||
|             <label for="name" class="control-label">{% trans "Name"%}</label> | ||||
|             <input type="text" name="name" class="form-control" placeholder="{% trans 'Your Name'%}" data-minlength="3" data-error="{% trans 'Please enter your name.' %}" required> | ||||
|                 <label for="name" class="control-label">{% trans "Name"%}</label> | ||||
|                 <input type="text" name="name" class="form-control" placeholder="{% trans 'Your Name'%}" | ||||
|                        data-minlength="3" data-error="{% trans 'Please enter your name.' %}" required> | ||||
|             </div> | ||||
|             <div class="help-block with-errors"> | ||||
|                 {% for message in messages %} | ||||
|                     {% if 'name' in message.tags %} | ||||
|                     <ul class="list-unstyled"><li> | ||||
|                 {% if 'name' in message.tags %} | ||||
|                 <ul class="list-unstyled"> | ||||
|                     <li> | ||||
|                         {{ message|safe }} | ||||
|                     </li></ul> | ||||
|                     {% endif %} | ||||
|                     </li> | ||||
|                 </ul> | ||||
|                 {% endif %} | ||||
|                 {% endfor %} | ||||
|             </div> | ||||
|         </div> | ||||
|         <div class="form-group"> | ||||
|             <div class="description input justify-center"> | ||||
|             <label for="email" class="control-label">{% trans "Email"%}</label> | ||||
|             <input name="email" type="email" pattern="^[^@\s]+@([^@\s]+\.)+[^@\s]+$" class="form-control" placeholder="{% trans 'Your Email' %}" data-error="{% trans 'Please enter a valid email address.' %}" required> | ||||
|                 <label for="email" class="control-label">{% trans "Email"%}</label> | ||||
|                 <input name="email" type="email" pattern="^[^@\s]+@([^@\s]+\.)+[^@\s]+$" class="form-control" | ||||
|                        placeholder="{% trans 'Your Email' %}" | ||||
|                        data-error="{% trans 'Please enter a valid email address.' %}" required> | ||||
|             </div> | ||||
|             <div class="help-block with-errors"> | ||||
|                 {% for message in messages %} | ||||
|                     {% if 'email' in message.tags %} | ||||
|                      <ul class="list-unstyled"><li> | ||||
|                 {% if 'email' in message.tags %} | ||||
|                 <ul class="list-unstyled"> | ||||
|                     <li> | ||||
|                         {{ message|safe }} | ||||
|                     </li></ul> | ||||
|                     {% endif %} | ||||
|                     </li> | ||||
|                 </ul> | ||||
|                 {% endif %} | ||||
|                 {% endfor %} | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <input type="submit" class="btn btn-primary disabled" value="{% trans 'Order Now!' %}"></input> | ||||
|     <input type="submit" class="btn btn-primary disabled" value="{% trans 'Continue' %}"></input> | ||||
| </form> | ||||
|  |  | |||
|  | @ -1,47 +1,48 @@ | |||
| {% load staticfiles i18n%} {% get_current_language as LANGUAGE_CODE %} {% load custom_tags %} | ||||
| <nav class="navbar navbar-default navbar-fixed-top topnav"> | ||||
|   <div class="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> | ||||
|       {% if request.resolver_match.url_name == "index" or request.resolver_match.url_name == "whydatacenterlight" %} | ||||
|         <a href="{% url 'datacenterlight:index' %}" id="logoBlack" class="navbar-brand topnav url" data-url="#home"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a> | ||||
|         <a href="{% url 'datacenterlight:index' %}" id="logoWhite" class="navbar-brand topnav url" data-url="#home"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a> {% else %} | ||||
|         <a href="{% url 'datacenterlight:index' %}" id="logoBlack" class="navbar-brand topnav url"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a> | ||||
|         <a href="{% url 'datacenterlight:index' %}" id="logoWhite" class="navbar-brand topnav url"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a> | ||||
|       {% endif %} | ||||
|     </div> | ||||
|     <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> | ||||
|       <!-- Start Navbar collapse--> | ||||
|       <ul class="nav navbar-nav navbar-right"> | ||||
|             <!-- 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> | ||||
|     {% if request.resolver_match.url_name == "index" or request.resolver_match.url_name == "whydatacenterlight" %} | ||||
|                   <a href="{% url 'datacenterlight:index' %}" id="logoBlack" class="navbar-brand topnav" data-url="#home"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a> | ||||
|                   <a href="{% url 'datacenterlight:index' %}" id="logoWhite" class="navbar-brand topnav" data-url="#home"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a> | ||||
|                 {% else %} | ||||
|                    <a href="{% url 'datacenterlight:index' %}" id="logoBlack" class="navbar-brand topnav"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a> | ||||
|                     <a href="{% url 'datacenterlight:index' %}" id="logoWhite" class="navbar-brand topnav"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a> | ||||
|                 {% endif %} | ||||
| 
 | ||||
|   </div> | ||||
|   <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"><!-- Start Navbar collapse--> | ||||
|     <ul class="nav navbar-nav navbar-right"> | ||||
|         {% if request.resolver_match.url_name == "index" or request.resolver_match.url_name == "whydatacenterlight" %} | ||||
|           <li class="dropdown"> | ||||
|             <a class="dropdown-toggle  visible-mobile" href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Highlights" %}<span class="caret"></span></a> | ||||
|             <a class="dropdown-toggle url disabled visible-desktop" href="{% url 'datacenterlight:index' %}#how" data-url="#how" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Highlights" %}<span class="caret"></span></a> | ||||
|            <li class="dropdown"> | ||||
|                 <a class="dropdown-toggle  visible-mobile" href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Highlights" %}<span class="caret"></span></a> | ||||
|                 <a class="dropdown-toggle url disabled visible-desktop menu-url" data-url="#how" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Highlights" %}<span class="caret"></span></a> | ||||
|             <ul class="dropdown-menu"> | ||||
|               <li><a class="url" href="{% url 'datacenterlight:index' %}#your" data-url="#your">{% trans "Scale out" %}</a></li> | ||||
|               <li><a class="url" href="{% url 'datacenterlight:index' %}#our" data-url="#our">{% trans "Reliable and light" %}</a></li> | ||||
|               <li><a class="url" href="{% url 'datacenterlight:index' %}#price" data-url="#price">{% trans "Order VM" %}</a></li> | ||||
|                 <li><a class="url menu-url" data-url="#your" href="#your">{% trans "Scale out" %}</a></li> | ||||
|                 <li><a class="url menu-url" data-url="#our" href="#our">{% trans "Reliable and light" %}</a></li> | ||||
|                 <li> <a class="url menu-url" data-url="#price" href="#price">{% trans "Order VM" %}</a></li> | ||||
|             </ul> | ||||
|           </li> | ||||
|           <li> | ||||
|             <a class="url" href="{% url 'datacenterlight:index' %}/whydatacenterlight">{% trans "Why Data Center Light?" %}</a> | ||||
|           </li> | ||||
|           <li> | ||||
|             <a class="url" href="{% url 'datacenterlight:index' %}#contact" data-url="#contact">{% trans "Contact" %}</a> | ||||
|           </li> | ||||
|         {% endif %} | ||||
|            </li> | ||||
|             <li> | ||||
|                 <a href="{% url 'datacenterlight:index' %}/whydatacenterlight" >{% trans "Why Data Center Light?" %}</a> | ||||
|             </li> | ||||
|             <li> | ||||
|                 <a class="url" href="{% url 'datacenterlight:index' %}#contact" data-url="#contact"  >{% trans "Contact" %}</a> | ||||
|             </li> | ||||
|             {% endif %} | ||||
| 
 | ||||
|         <li> | ||||
|           {% if LANGUAGE_CODE == 'en-us'%} | ||||
|             <a class="url on-hover-border" href="{% change_lang 'de' %}">Deutsch  <i class="fa fa-globe" aria-hidden="true"></i></a> | ||||
|             <a class="on-hover-border" href="{% change_lang 'de' %}">Deutsch  <i class="fa fa-globe" aria-hidden="true"></i></a> | ||||
|           {% else %} | ||||
|             <a class="url on-hover-border" href="{% change_lang 'en-us' %}">English  <i class="fa fa-globe" aria-hidden="true"></i></a> | ||||
|             <a class="on-hover-border" href="{% change_lang 'en-us' %}">English  <i class="fa fa-globe" aria-hidden="true"></i></a> | ||||
|           {% endif %} | ||||
|         </li> | ||||
|         {% comment %} | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ | |||
| 
 | ||||
|             <div class="row"> | ||||
|                 <div class="col-lg-12"> | ||||
|      | ||||
| 
 | ||||
|                     <div class="intro-message"> | ||||
|                       <h1>Data Center Light</h1> | ||||
|                         <h3>{% trans "Finally, an affordable VM hosting in Switzerland!" %}</h3> | ||||
|  | @ -59,13 +59,13 @@ | |||
|                               <li> | ||||
|                                 <i class="fa-li fa fa-check-square-o fa-lg"></i> | ||||
|                                 <p class="lead">{% trans "Is creative, using a modern and alternative design for a data center in order to make it more sustainable and affordable at the same time." %}</p> | ||||
|                               </li>  | ||||
|                               </li> | ||||
|                               <li> | ||||
|                                 <i class="fa-li fa fa-check-square-o fa-lg"></i> | ||||
|                                 <p class="lead">{% trans "Cuts down the costs for you by using FOSS (Free Open Source Software) exclusively, wherefore we can save money from paying licenses." %}</p> | ||||
|                               </li>  | ||||
|                               </li> | ||||
|                              </ul> | ||||
|                              | ||||
| 
 | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|  | @ -86,7 +86,7 @@ | |||
|                         </div> | ||||
|                         <div class="split-description"> | ||||
|                             <p class="lead">{% trans "We don't use special hardware. We use commodity hardware: we buy computers that you buy. Just many more and put them in a cozy home for computers called data center." %}</p> | ||||
|                              | ||||
| 
 | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|  | @ -112,7 +112,7 @@ | |||
|                         </div> | ||||
|                         <div class="split-description"> | ||||
|                             <p class="lead">{% trans "Our VMs are located in Switzerland, with reliable power supply and fast internet connection. Our VM costs less thanks to our featherlight infrastructure." %}</p> | ||||
|                              | ||||
| 
 | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|  | @ -121,7 +121,7 @@ | |||
|         <!-- /.container --> | ||||
|         <!-- /.option 1 --> | ||||
|     </div> | ||||
|      | ||||
| 
 | ||||
|     <!-- /.content-section-b --> | ||||
|     <div class="content-section-a pricing-section" id="price"> | ||||
| 
 | ||||
|  | @ -154,7 +154,7 @@ | |||
|         <div class="intro-header-2 contact-section" id="contact"> | ||||
|             <div class="container"> | ||||
|                 <div class="row"> | ||||
|                    | ||||
| 
 | ||||
|                     <div class="col-sm-6 col-md-6"> | ||||
|                         <div class="card"> | ||||
|                             <div class="subtitle"> | ||||
|  | @ -166,15 +166,9 @@ | |||
|                                 <p>{% trans "Switzerland " %}</p> | ||||
|                             </div> | ||||
|                             <div class="social"> | ||||
|                                 <a target="_blank" class="" href="https://twitter.com/datacenterlight"> | ||||
|                                      <i class="fa fa-twitter fa-fw"></i> | ||||
|                                 </a> | ||||
|                                 <a  target="_blank"  class=""  href="https://github.com/ungleich"> | ||||
|                                      <i class="fa fa-github fa-fw"></i> | ||||
|                                 </a> | ||||
|                                 <a  target="_blank"  class=""  href="https://www.facebook.com/ungleich.ch/"> | ||||
|                                      <i class="fa fa-facebook fa-fw"></i> | ||||
|                                 </a> | ||||
|                                 <a target="_blank" class="" href="https://twitter.com/datacenterlight"><i class="fa fa-twitter fa-fw"></i></a> | ||||
|                                 <a target="_blank"  class=""  href="https://github.com/ungleich"><i class="fa fa-github fa-fw"></i></a> | ||||
|                                 <a  target="_blank"  class=""  href="https://www.facebook.com/ungleich.ch/"><i class="fa fa-facebook fa-fw"></i></a> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     </div> | ||||
|  | @ -187,7 +181,7 @@ | |||
| 
 | ||||
|             </div> | ||||
|         </div> | ||||
|          | ||||
| 
 | ||||
|     </div> | ||||
|     <!-- /.banner --> | ||||
| {% endblock %} | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| from django.views.generic import FormView, CreateView, TemplateView, DetailView | ||||
| from django.http import HttpResponseRedirect | ||||
| from .forms import BetaAccessForm | ||||
| from .models import BetaAccess, BetaAccessVMType, BetaAccessVM | ||||
| from .models import BetaAccess, BetaAccessVMType, BetaAccessVM, VMTemplate | ||||
| from django.contrib import messages | ||||
| from django.core.urlresolvers import reverse | ||||
| from django.core.mail import EmailMessage | ||||
|  | @ -21,7 +21,7 @@ from datetime import datetime | |||
| from membership.models import CustomUser, StripeCustomer | ||||
| 
 | ||||
| from opennebula_api.models import OpenNebulaManager | ||||
| from opennebula_api.serializers import VirtualMachineTemplateSerializer, VirtualMachineSerializer | ||||
| from opennebula_api.serializers import VirtualMachineTemplateSerializer, VirtualMachineSerializer, VMTemplateSerializer | ||||
| 
 | ||||
| 
 | ||||
| class LandingProgramView(TemplateView): | ||||
|  | @ -194,41 +194,68 @@ class IndexView(CreateView): | |||
|     success_url = "/datacenterlight#requestform" | ||||
|     success_message = "Thank you, we will contact you as soon as possible" | ||||
| 
 | ||||
|     def validate_cores(self, value): | ||||
|         if (value > 48) or (value < 1): | ||||
|             raise ValidationError(_('Not a proper cores number')) | ||||
| 
 | ||||
|     def validate_memory(self, value): | ||||
|         if (value > 200) or (value < 2): | ||||
|             raise ValidationError(_('Not a proper ram number')) | ||||
| 
 | ||||
|     def validate_storage(self, value): | ||||
|         if (value > 2000) or (value < 10): | ||||
|             raise ValidationError(_('Not a proper storage number')) | ||||
| 
 | ||||
|     @cache_control(no_cache=True, must_revalidate=True, no_store=True) | ||||
|     def get(self, request, *args, **kwargs): | ||||
|         for session_var in ['specs', 'user', 'billing_address_data']: | ||||
|             if session_var in request.session: | ||||
|                 del request.session[session_var] | ||||
|         try: | ||||
|             manager = OpenNebulaManager() | ||||
|             templates = manager.get_templates() | ||||
|             context = { | ||||
|                 'templates': VirtualMachineTemplateSerializer(templates, many=True).data | ||||
|             } | ||||
|         except: | ||||
|             messages.error(request, | ||||
|                            'We have a temporary problem to connect to our backend. \ | ||||
|                            Please try again in a few minutes' | ||||
|                            ) | ||||
|             context = { | ||||
|                 'error': 'connection' | ||||
|             } | ||||
| 
 | ||||
|         vm_templates = VMTemplate.objects.all() | ||||
|         context = { | ||||
|             'templates': vm_templates | ||||
|         } | ||||
|         return render(request, self.template_name, context) | ||||
| 
 | ||||
|     def post(self, request): | ||||
|         cores = request.POST.get('cpu') | ||||
|         cores_field = forms.IntegerField(validators=[self.validate_cores]) | ||||
|         memory = request.POST.get('ram') | ||||
|         memory_field = forms.IntegerField(validators=[self.validate_memory]) | ||||
|         storage = request.POST.get('storage') | ||||
|         storage_field = forms.IntegerField(validators=[self.validate_storage]) | ||||
|         price = request.POST.get('total') | ||||
|         template_id = int(request.POST.get('config')) | ||||
|         manager = OpenNebulaManager() | ||||
|         template = manager.get_template(template_id) | ||||
|         template_data = VirtualMachineTemplateSerializer(template).data | ||||
|         template = VMTemplate.objects.filter(opennebula_vm_template_id=template_id).first() | ||||
|         template_data = VMTemplateSerializer(template).data | ||||
| 
 | ||||
|         name = request.POST.get('name') | ||||
|         email = request.POST.get('email') | ||||
|         name_field = forms.CharField() | ||||
|         email_field = forms.EmailField() | ||||
| 
 | ||||
|         try: | ||||
|             cores = cores_field.clean(cores) | ||||
|         except ValidationError as err: | ||||
|             msg = '{} : {}.'.format(cores, str(err)) | ||||
|             messages.add_message(self.request, messages.ERROR, msg, extra_tags='cores') | ||||
|             return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form") | ||||
| 
 | ||||
|         try: | ||||
|             memory = memory_field.clean(memory) | ||||
|         except ValidationError as err: | ||||
|             msg = '{} : {}.'.format(memory, str(err)) | ||||
|             messages.add_message(self.request, messages.ERROR, msg, extra_tags='memory') | ||||
|             return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form") | ||||
| 
 | ||||
|         try: | ||||
|             storage = storage_field.clean(storage) | ||||
|         except ValidationError as err: | ||||
|             msg = '{} : {}.'.format(storage, str(err)) | ||||
|             messages.add_message(self.request, messages.ERROR, msg, extra_tags='storage') | ||||
|             return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form") | ||||
| 
 | ||||
|         try: | ||||
|             name = name_field.clean(name) | ||||
|         except ValidationError as err: | ||||
|  | @ -313,25 +340,6 @@ class WhyDataCenterLightView(IndexView): | |||
|     template_name = "datacenterlight/whydatacenterlight.html" | ||||
|     model = BetaAccess | ||||
| 
 | ||||
|     @cache_control(no_cache=True, must_revalidate=True, no_store=True) | ||||
|     def get(self, request, *args, **kwargs): | ||||
|         try: | ||||
|             manager = OpenNebulaManager() | ||||
|             templates = manager.get_templates() | ||||
|             context = { | ||||
|                 'templates': VirtualMachineTemplateSerializer(templates, many=True).data, | ||||
|             } | ||||
|         except: | ||||
|             messages.error( | ||||
|                 request, | ||||
|                 'We have a temporary problem to connect to our backend. \ | ||||
|                 Please try again in a few minutes' | ||||
|             ) | ||||
|             context = { | ||||
|                 'error': 'connection' | ||||
|                     } | ||||
|         return render(request, self.template_name, context) | ||||
| 
 | ||||
| 
 | ||||
| class PaymentOrderView(FormView): | ||||
|     template_name = 'hosting/payment.html' | ||||
|  | @ -462,9 +470,9 @@ class OrderConfirmationView(DetailView): | |||
|             template_id=vm_template_id, | ||||
|             specs=specs, | ||||
|             vm_name="{email}-{template_name}-{date}".format( | ||||
|                    email=user.get('email'), | ||||
|                    template_name=template.get('name'), | ||||
|                    date=int(datetime.now().strftime("%s"))) | ||||
|                 email=user.get('email'), | ||||
|                 template_name=template.get('name'), | ||||
|                 date=int(datetime.now().strftime("%s"))) | ||||
|         ) | ||||
| 
 | ||||
|         # Create a Hosting Order | ||||
|  |  | |||
|  | @ -39,6 +39,30 @@ h6 { | |||
|     font-size: 14px; | ||||
| } | ||||
| 
 | ||||
| .navbar-transparent { | ||||
|     background: transparent; | ||||
|     border: none; | ||||
|     padding: 20px; | ||||
| } | ||||
| 
 | ||||
| .navbar-transparent .navbar-nav>li>a { | ||||
|     color: #fff; | ||||
|     cursor: pointer; | ||||
|     font-family: 'Lato-Regular', sans-serif; | ||||
| } | ||||
| .navbar-transparent .navbar-nav>li>a:hover { | ||||
|     color: #fff; | ||||
| } | ||||
| .navbar-transparent .navbar-nav>li>a:focus, .navbar-transparent .navbar-nav>li>a:hover { | ||||
|     color: #fff; | ||||
|     background-color: transparent; | ||||
| } | ||||
| 
 | ||||
| .navbar-transparent #logoWhite{ | ||||
|     display: block; | ||||
|     width: 220px; | ||||
| } | ||||
| 
 | ||||
| .lead { | ||||
|     font-size: 18px; | ||||
|     font-weight: 400; | ||||
|  | @ -634,11 +658,11 @@ a.unlink:hover { | |||
|     .card-cvc-element { | ||||
|     padding-left: 10px; | ||||
|     } | ||||
|      | ||||
| 
 | ||||
|     .hide-mobile{ | ||||
|     display:none; | ||||
|     } | ||||
|      | ||||
| 
 | ||||
|     #billing-form .form-control { | ||||
|     box-shadow: none !important; | ||||
|     font-weight: 400; | ||||
|  |  | |||
|  | @ -48,24 +48,26 @@ | |||
| <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="{% if site_url %}{{site_url}}{% else %}{{ request.session.hosting_url}}{% endif %}"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a> | ||||
|             </div> | ||||
|             {% if request.user.is_authenticated %} | ||||
|             <!-- 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"> | ||||
|     {% block navbar %} | ||||
| 
 | ||||
|         <!-- 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="{% if site_url %}{{site_url}}{% else %}{{ request.session.hosting_url}}{% endif %}"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a> | ||||
|                 </div> | ||||
|                 {% if request.user.is_authenticated %} | ||||
|                 <!-- 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="{% url 'hosting:virtual_machines' %}"> | ||||
|                                 <i class="fa fa-server" aria-hidden="true"></i> {% trans "My Virtual Machines"%} | ||||
|  | @ -93,33 +95,14 @@ | |||
|                             <li><a href="{% url 'hosting:logout' %}"><i class="glyphicon glyphicon-lock"></i>{% trans "Logout"%} </a></li> | ||||
|                           </ul> | ||||
|                         </li> | ||||
|                         <!--  | ||||
|                         <li> | ||||
|                             <a href="{{ request.session.hosting_url}}#how">{% trans "How it works"%}</a> | ||||
|                         </li> | ||||
|                         <li> | ||||
|                             <a href="{{ request.session.hosting_url }}#your">{% trans "Your infrastructure"%}</a> | ||||
|                         </li> | ||||
|                        <li> | ||||
|                             <a href="{{ request.session.hosting_url }}#our">{% trans "Our inftrastructure"%}</a> | ||||
|                         </li> | ||||
|                         <li> | ||||
|                             <a href="{{ request.session.hosting_url }}#price">{% trans "Pricing" %}</a> | ||||
|                         </li> | ||||
|                         <li> | ||||
|                             <a href="{{ request.session.hosting_url }}#contact">{% trans "Contact"%}</a> | ||||
|                         </li>   | ||||
|                         <li> | ||||
|                             <a href="{% url 'hosting:login' %}?next={{request.current_path}}">{% trans "Login"%}</a> | ||||
|                         </li>  --> | ||||
|                 </ul> | ||||
|                     </ul> | ||||
|                 </div> | ||||
|                 {% endif %} | ||||
|                 <!-- /.navbar-collapse --> | ||||
|             </div> | ||||
|             {% endif %} | ||||
|             <!-- /.navbar-collapse --> | ||||
|         </div> | ||||
|         <!-- /.container --> | ||||
|     </nav> | ||||
| 
 | ||||
|             <!-- /.container --> | ||||
|         </nav> | ||||
|     {% endblock navbar %} | ||||
| 
 | ||||
| 
 | ||||
|     <div class="content-dashboard"> | ||||
|  |  | |||
							
								
								
									
										11
									
								
								hosting/templates/hosting/includes/_navbar_transparent.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								hosting/templates/hosting/includes/_navbar_transparent.html
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| {% load static i18n %} | ||||
| 
 | ||||
| <nav class="navbar navbar-default  navbar-fixed-top topnav navbar-transparent" role="navigation"> | ||||
|     <div class="container topnav"> | ||||
|         <!-- Brand and toggle get grouped for better mobile display --> | ||||
|         <div class="navbar-header"> | ||||
|             <a id="logoWhite" class="navbar-brand topnav" href="{% if site_url %}{{site_url}}{% else %}{{ request.session.hosting_url}}{% endif %}"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a> | ||||
|         </div> | ||||
|     </div> | ||||
|     <!-- /.container --> | ||||
| </nav> | ||||
|  | @ -1,18 +1,23 @@ | |||
| {% extends "hosting/base_short.html" %} | ||||
| {% load i18n %} | ||||
| {% load staticfiles bootstrap3%} | ||||
| 
 | ||||
| {% block navbar %} | ||||
|     {% include  'hosting/includes/_navbar_transparent.html' %} | ||||
| {% endblock navbar %} | ||||
| 
 | ||||
| {% block content %} | ||||
| 
 | ||||
| <div class="auth-container"> | ||||
|     <div class="auth-bg"></div> | ||||
| 
 | ||||
|         <div class="auth-center"> | ||||
|              | ||||
| 
 | ||||
|             <div class="auth-title"> | ||||
|                 <h2>{% trans "Your VM hosted in Switzerland"%}</h2> | ||||
|             </div> | ||||
|             <div class="auth-content"> | ||||
|                  | ||||
| 
 | ||||
|                 <div class="intro-message auth-box"> | ||||
|                     <h2 class="section-heading">{% trans "Login"%}</h2> | ||||
|                     <form action="{% url 'hosting:login' %}" method="post" class="form" novalidated> | ||||
|  | @ -26,8 +31,8 @@ | |||
|                                 {% trans "Login"%} | ||||
|                             </button> | ||||
|                         {% endbuttons %} | ||||
| 						 | ||||
| 						<input type='hidden' name='next' value='{{request.GET.next}}'/>  | ||||
| 
 | ||||
| 						<input type='hidden' name='next' value='{{request.GET.next}}'/> | ||||
|                     </form> | ||||
|                     <div class="auth-footer"> | ||||
|                         <div class="text"> | ||||
|  |  | |||
|  | @ -2,6 +2,11 @@ | |||
| {% load staticfiles bootstrap3%} | ||||
| {% load i18n %} | ||||
| 
 | ||||
| {% block navbar %} | ||||
|     {% include  'hosting/includes/_navbar_transparent.html' %} | ||||
| {% endblock navbar %} | ||||
| 
 | ||||
| 
 | ||||
| {% block content %} | ||||
| <div class="auth-container"> | ||||
|    <div class="auth-bg"></div> | ||||
|  | @ -10,7 +15,7 @@ | |||
|                 <h2>{% trans "Your VM hosted in Switzerland"%}</h2> | ||||
|             </div> | ||||
|             <div class="auth-content"> | ||||
|                  | ||||
| 
 | ||||
|                 <div class="intro-message auth-box sign-up"> | ||||
|                     <h2  class="section-heading">{% trans "Reset your password"%}</h2> | ||||
|                     <form action="{% url 'hosting:reset_password' %}" method="post" class="form" novalidate> | ||||
|  |  | |||
|  | @ -1,6 +1,10 @@ | |||
| {% extends "hosting/base_short.html" %} | ||||
| {% load staticfiles bootstrap3 i18n %} | ||||
| 
 | ||||
| {% block navbar %} | ||||
|     {% include  'hosting/includes/_navbar_transparent.html' %} | ||||
| {% endblock navbar %} | ||||
| 
 | ||||
| {% block content %} | ||||
| <div class="auth-container auth-signup"> | ||||
|    <div class="auth-bg"></div> | ||||
|  | @ -32,7 +36,7 @@ | |||
|                     </div> | ||||
|                 </div> | ||||
|              </div> | ||||
|              | ||||
| 
 | ||||
|         </div> | ||||
| </div> | ||||
| {% endblock %} | ||||
|  |  | |||
|  | @ -59,7 +59,7 @@ class OpenNebulaManager(): | |||
|                 domain=settings.OPENNEBULA_DOMAIN, | ||||
|                 port=settings.OPENNEBULA_PORT, | ||||
|                 endpoint=settings.OPENNEBULA_ENDPOINT | ||||
|         )) | ||||
|             )) | ||||
| 
 | ||||
|     def _get_opennebula_client(self, username, password): | ||||
|         return oca.Client("{0}:{1}".format( | ||||
|  | @ -71,7 +71,7 @@ class OpenNebulaManager(): | |||
|                 domain=settings.OPENNEBULA_DOMAIN, | ||||
|                 port=settings.OPENNEBULA_PORT, | ||||
|                 endpoint=settings.OPENNEBULA_ENDPOINT | ||||
|         )) | ||||
|             )) | ||||
| 
 | ||||
|     def _get_user(self, user): | ||||
|         """Get the corresponding opennebula user for a CustomUser object | ||||
|  | @ -325,7 +325,7 @@ class OpenNebulaManager(): | |||
|             public_templates = [ | ||||
|                 template | ||||
|                 for template in self._get_template_pool() | ||||
|                 if 'public-' in template.name | ||||
|                 if template.name.startswith('public-') | ||||
|             ] | ||||
|             return public_templates | ||||
|         except ConnectionRefusedError: | ||||
|  | @ -396,7 +396,7 @@ class OpenNebulaManager(): | |||
| 
 | ||||
|     def delete_template(self, template_id): | ||||
|         self.oneadmin_client.call(oca.VmTemplate.METHODS[ | ||||
|                                   'delete'], template_id, False) | ||||
|                                       'delete'], template_id, False) | ||||
| 
 | ||||
|     def change_user_password(self, new_password): | ||||
|         self.oneadmin_client.call( | ||||
|  |  | |||
|  | @ -129,6 +129,12 @@ class VirtualMachineSerializer(serializers.Serializer): | |||
|         return obj.name.strip('public-') | ||||
| 
 | ||||
| 
 | ||||
| class VMTemplateSerializer(serializers.Serializer): | ||||
|     """Serializer to map the VMTemplate instance into JSON format.""" | ||||
|     id = serializers.IntegerField(read_only=True, source='opennebula_vm_template_id') | ||||
|     name = serializers.CharField(read_only=True) | ||||
| 
 | ||||
| 
 | ||||
| def hexstr2int(string): | ||||
|     return int(string.replace(':', ''), 16) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue