mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-13 08:01:50 +02:00
Updated event form to allow for time input
This commit is contained in:
parent
47b60296eb
commit
6d81b21ed1
32 changed files with 456 additions and 88 deletions
|
@ -3,9 +3,26 @@ angular.module('rallly')
|
|||
|
||||
$scope.title = "Schedule a New Event";
|
||||
$scope.description = "Fill in the form below to create your event and share it with your friends and colleagues.";
|
||||
$scope.event = {};
|
||||
|
||||
var states = [
|
||||
'newevent.general',
|
||||
'newevent.datetime',
|
||||
'newevent.invite'
|
||||
];
|
||||
|
||||
$scope.page = 1;
|
||||
|
||||
var goTo = function(page){
|
||||
$scope.page = page;
|
||||
$state.go(states[page-1]);
|
||||
}
|
||||
|
||||
goTo($scope.page);
|
||||
|
||||
|
||||
$scope.submit = function(){
|
||||
if ($scope.form.$valid){
|
||||
if ($scope.form.$valid && $scope.page == states.length){
|
||||
$http.post('/api/event', $scope.event)
|
||||
.success(function(event, status, headers, config){
|
||||
$scope.event = event;
|
||||
|
@ -14,6 +31,8 @@ angular.module('rallly')
|
|||
}, {
|
||||
absolute : true
|
||||
});
|
||||
$scope.page++;
|
||||
$state.go('newevent.success');
|
||||
})
|
||||
.error(function(){
|
||||
var modal = new ConfirmModal({
|
||||
|
@ -22,6 +41,9 @@ angular.module('rallly')
|
|||
cancelText : 'OK'
|
||||
});
|
||||
});
|
||||
} else if ($scope.form.$valid) {
|
||||
$scope.form.$setPristine();
|
||||
$scope.nextPage();
|
||||
} else {
|
||||
var notification = new Notification({
|
||||
title : 'Not so fast',
|
||||
|
@ -31,5 +53,12 @@ angular.module('rallly')
|
|||
}
|
||||
}
|
||||
|
||||
$scope.clearDates = null
|
||||
$scope.nextPage = function(){
|
||||
goTo($scope.page+1);
|
||||
}
|
||||
|
||||
$scope.prevPage = function(){
|
||||
goTo($scope.page-1);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue