-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Volunteer registration form with some tests #40
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
503e109
Removed modules which are not necessary for phase 1.
vzickner a7f5bd3
Added basic interface for volunteer registration.
vzickner 5e103d3
Added first tests for user registration.
vzickner cb161fd
Merge branch 'protractor-http-mock' into volunteer-frontend
vzickner 9d11296
Implemented volunteer registration tests and first error handling.
vzickner beb656a
Removed not necessary mock.
vzickner 23b7046
Implemented error field highlighting and added one test.
vzickner e764600
Split controller.js in multiple files.
vzickner 196077b
Changed ability test to using mocks.
vzickner c3084d7
Implemented success page for user registration.
vzickner 99d122c
Implemented success page for user registration.
vzickner 69d28eb
Removed empty controller.
vzickner e5b1be6
Removed /locations mocks.
vzickner 09ca4c1
Improved naming of behaviour tests.
vzickner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[ | ||
{ | ||
"id": 12, | ||
"name": "Ability 1" | ||
}, | ||
{ | ||
"id": 14, | ||
"name": "Ability 2" | ||
} | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
angular.module('Come2HelpController').factory('Abilities', ['$resource', function ($resource) { | ||
return $resource('api/abilities/:id'); | ||
}]); | ||
|
||
angular.module('Come2HelpController').factory('Volunteers', ['$resource', function ($resource) { | ||
return $resource('api/volunteers/:id'); | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
angular.module('Come2HelpController').controller('RegisterController', ['Abilities', 'Volunteers', '$routeParams', '$location', function (Abilities, Volunteers, $routeParams, $location) { | ||
var vm = this; | ||
|
||
vm.errors = null; | ||
|
||
Abilities.query(function (data) { | ||
vm.abilities = data; | ||
}); | ||
|
||
vm.doRegister = function () { | ||
Volunteers.save({ | ||
'givenName': vm.givenName, | ||
'surname': vm.surname, | ||
'address': { | ||
'zipCode': vm.zipCode | ||
}, | ||
'phone': vm.phone, | ||
'adult': vm.adult == true | ||
|
||
}, function() { | ||
vm.errors = null; | ||
|
||
vm.givenName = ''; | ||
vm.surname = ''; | ||
vm.zipCode = ''; | ||
vm.phone = ''; | ||
vm.adult = null; | ||
|
||
$location.path('/register/done'); | ||
}, function (response) { | ||
vm.errors = {}; | ||
|
||
for (var i = 0; i < response.data.clientErrors.length; i++) { | ||
var errorData = response.data.clientErrors[i]; | ||
vm.errors[errorData.path] = true; | ||
} | ||
}); | ||
}; | ||
}]); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<form class="form-horizontal" ng-submit="ctrl.doRegister()"> | ||
|
||
<div ng-show="ctrl.errors" id="error" class="alert alert-danger" role="alert">{{ 'Please correct the highlighted fields.' | translate }}</div> | ||
|
||
<div ng-class="['form-group', {'has-error': ctrl.errors.surname}, {'has-error': ctrl.errors.givenName}]"> | ||
<label for="surname" class="col-sm-2 control-label">{{ 'Name' | translate }}</label> | ||
<div class="col-sm-5"> | ||
<input class="form-control" ng-model="ctrl.givenName" id="givenName" placeholder="{{ 'Givenname' | translate }}" value="" type="text"> | ||
</div> | ||
<div class="col-sm-5"> | ||
<input class="form-control" ng-model="ctrl.surname" name="surname" id="surname" placeholder="{{ 'Surname' | translate }}" value="" type="text"> | ||
</div> | ||
</div> | ||
<div ng-class="['form-group', {'has-error': ctrl.errors.zipCode}]"> | ||
<label for="zipCode" class="col-sm-2 control-label">{{ 'Zip Code' | translate }}</label> | ||
<div class="col-sm-10"> | ||
<input class="form-control" ng-model="ctrl.zipCode" name="city" id="zipCode" placeholder="{{ 'Zip Code' | translate }}" value="" type="text"> | ||
</div> | ||
</div> | ||
<div ng-class="['form-group', {'has-error': ctrl.errors.email}]"> | ||
<label for="email" class="col-sm-2 control-label">{{ 'E-Mail-Address' | translate }}</label> | ||
<div class="col-sm-10"> | ||
<input class="form-control" ng-model="ctrl.email" name="email" id="email" placeholder="{{ 'E-Mail-Address' | translate }}" value="" type="text"> | ||
</div> | ||
</div> | ||
<div ng-class="['form-group', {'has-error': ctrl.errors.phone}]"> | ||
<label for="phone" class="col-sm-2 control-label">{{ 'Phone' | translate }}</label> | ||
<div class="col-sm-10"> | ||
<input class="form-control" ng-model="ctrl.phone" name="phone" id="phone" placeholder="{{ 'Phone' | translate }}" value="" type="text"> | ||
</div> | ||
</div> | ||
<div ng-class="['form-group', {'has-error': ctrl.errors.adult}]"> | ||
<label for="adult" class="col-sm-2 control-label">{{ 'Is Adult' | translate }}</label> | ||
<div class="col-sm-1"> | ||
<input class="form-control" ng-model="ctrl.adult" name="adult" id="adult" value="true" type="checkbox"> | ||
</div> | ||
</div> | ||
<div ng-class="['form-group', {'has-error': ctrl.errors.abilities}]"> | ||
<label for="inputAbilities[]" class="col-sm-2 control-label">{{ 'Abilities' | translate }}</label> | ||
<div class="col-sm-8" ng-repeat="ability in ctrl.abilities"> | ||
<input type="checkbox" name="inputAbilities[]" id="inputAbilities[]" value="{{ability.id}}"> <span>{{ability.name}}</span> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<div class="col-sm-offset-2 col-sm-10"> | ||
<button class="btn btn-primary" type="submit">{{ 'Register' | translate }}</button> | ||
</div> | ||
</div> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class="jumbotron"> | ||
<h1>{{ 'Thank you for register!' | translate }}</h1> | ||
<p>{{ 'We will contact you ...' | translate }}</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = [ | ||
{ | ||
request: { | ||
path: '/abilities', | ||
method: 'GET' | ||
}, | ||
response: { | ||
status: 200, | ||
data: [{ | ||
id: 42, | ||
name: 'Mocked Ability 1' | ||
}, | ||
{ | ||
id: 69, | ||
name: 'Mocked Ability 1' | ||
}] | ||
} | ||
} | ||
]; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn’t call our module “
Controller
”There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should improve the name of this module, but I think is independent of this pull request.