From cb6f746f177cb0e2e4cc0d56eed2b86ef743cc2b Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Wed, 7 Dec 2016 21:33:51 +0100 Subject: [PATCH] add host signup --- public/app/host/index.js | 8 +++----- public/app/host/signup.jade | 15 +++++++++++++++ public/app/host/signup.js | 36 ++++++++++++++++++++++++++++++++++++ public/index.html | 1 + 4 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 public/app/host/signup.jade create mode 100644 public/app/host/signup.js diff --git a/public/app/host/index.js b/public/app/host/index.js index c351b71..1b04b41 100644 --- a/public/app/host/index.js +++ b/public/app/host/index.js @@ -20,13 +20,11 @@ angular.module('warehost') } }) .state('app.host.signup', { - url:'/', + url:'/signup', views:{ '@app':{ - templateUrl: 'app/home.html', - controller:function(alert){ - alert.set({}); - } + templateUrl: 'app/host/signup.html', + controller:'SignupHostCtrl' } } }) diff --git a/public/app/host/signup.jade b/public/app/host/signup.jade new file mode 100644 index 0000000..e01854d --- /dev/null +++ b/public/app/host/signup.jade @@ -0,0 +1,15 @@ +.container + h1 Hosting Signup + .panel.panel-info + .panel-heading AGB + .panel-body + .panel-footer(ng-if="!profil.ID && status") + .checkbox + label + input(type="checkbox",ng-model="agb") + | Accept AGB + .btn.btn-default(type="submit",ng-click="signup()",ng-class="{'disabled':!agb}") Submit + .panel-footer(ng-if="!profil.ID && !status") + | You are not allow to signup Hosting + .panel-footer(ng-if="profil.ID") + | You have already signup diff --git a/public/app/host/signup.js b/public/app/host/signup.js new file mode 100644 index 0000000..b3ba982 --- /dev/null +++ b/public/app/host/signup.js @@ -0,0 +1,36 @@ +'use strict'; + +angular.module('warehost') + .controller('SignupHostCtrl',function(session,config,alert,$scope,$http){ + $scope.status = false; + $scope.profil = {}; + $scope.agb = false; + alert.set({}); + function load(){ + $http.get(config.api+'/host/profil').then(function(res){ + $scope.profil = res.data.data; + $http.get(config.api+'/host/signup').then(function(res){ + session.set(res); + alert.set(res); + $scope.status = res.data.data; + },function(res){ + session.set(res); + alert.set(res); + }); + }); + } + $scope.signup = function(){ + if($scope.agb){ + $http.post(config.api+'/host/signup').then(function(res){ + session.set(res); + alert.set(res); + $scope.status = res.data.data; + },function(res){ + session.set(res); + alert.set(res); + }); + } + } + load(); + + }); diff --git a/public/index.html b/public/index.html index bf5986d..623b4a3 100644 --- a/public/index.html +++ b/public/index.html @@ -66,6 +66,7 @@ +