-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: - create user page - unused params in function signatures shouldnt trip the linter - see "A note about function arguments" at https://jslinterrors.com/unused-a Test Plan: ... Reviewers: seth, shadowhand Reviewed By: shadowhand Subscribers: rjmackay Maniphest Tasks: T1250 Differential Revision: https://phabricator.ushahidi.com/D592
- Loading branch information
Showing
10 changed files
with
124 additions
and
10 deletions.
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
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,55 @@ | ||
module.exports = [ | ||
'$scope', | ||
'$translate', | ||
'$location', | ||
'UserEndpoint', | ||
'Notify', | ||
'_', | ||
function( | ||
$scope, | ||
$translate, | ||
$location, | ||
UserEndpoint, | ||
Notify, | ||
_ | ||
) { | ||
$translate('user_create.title').then(function(title) { | ||
$scope.title = title; | ||
}); | ||
|
||
$scope.user = {}; | ||
$scope.saving_user = false; | ||
|
||
$scope.goBack = function() { | ||
$location.path('/users/'); | ||
}; | ||
|
||
$scope.saveUser = function(user) { | ||
$scope.saving_user = true; | ||
var response = UserEndpoint.save(user, function() { | ||
if (response.id) { | ||
$location.path('/users/' + response.id + '/profile'); | ||
} | ||
}, function(errorResponse) { // error | ||
var errors = _.pluck(errorResponse.data && errorResponse.data.errors, 'message'); | ||
errors && Notify.showAlerts(errors); | ||
$scope.saving_user = false; | ||
}); | ||
}; | ||
|
||
$scope.roles = [ | ||
// TODO: make this an endpoint | ||
{ | ||
name: 'guest', | ||
display_name: 'Guest', | ||
}, | ||
{ | ||
name: 'user', | ||
display_name: 'Member', | ||
}, | ||
{ | ||
name: 'admin', | ||
display_name: 'Admin', | ||
} | ||
]; | ||
}]; |
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,13 @@ | ||
.create-user-header { | ||
@include header($blueGray); | ||
padding: 20px; | ||
|
||
@include media($small) { | ||
padding: 30px; | ||
} | ||
|
||
.title { | ||
color: $white; | ||
// margin-bottom: 30px; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -62,7 +62,7 @@ | |
margin-bottom: 0; | ||
} | ||
|
||
&.add-user { | ||
& a { | ||
@include button($black); | ||
color: $white; | ||
} | ||
|
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,30 @@ | ||
<div class="container"> | ||
|
||
<div class="create-user-header"> | ||
<h4 class="title"><a ng-href="/users" title="Go Back" class="back-button">«</a> {{title}}</h4> | ||
</div> <!-- end .manage-users-header --> | ||
|
||
<div class="wrapper form-wrapper"> | ||
<form id="user_create" class="container"> | ||
<label translate>user.full_name</label> | ||
<input id="full_name" type="text" placeholder="{{ 'user_create.full_name'|translate }}" required ng-minlength="3" ng-maxlength="150" ng-model="user.realname"> | ||
|
||
<label translate>user.username</label> | ||
<input id="username" type="text" placeholder="{{ 'user_create.username'|translate }}" required ng-minlength="3" ng-maxlength="150" ng-model="user.username"> | ||
|
||
<label translate>user.email</label> | ||
<input id="email" type="email" placeholder="{{ 'user_create.email'|translate }}" required ng-minlength="5" ng-maxlength="150" ng-model="user.email"> | ||
|
||
<label translate>user.password</label> | ||
<input id="password" type="password" required ng-minlength="5" ng-maxlength="150" ng-model="user.password"> | ||
|
||
<label translate>user.role</label> | ||
<select id="role" ng-model="user.role" ng-options="role.name as role.display_name for role in roles"></select> | ||
|
||
<p class="submit-button"> | ||
<button ng-click="saveUser(user)" ng-disabled="form.$invalid || saving_user"><i class="fa fa-cog fa-spin ng-hide" ng-show="saving_user"></i> <span class="ng-scope" translate>user.create_user</span></button> | ||
</p> | ||
</form> | ||
</div> <!-- end .wrapper --> | ||
|
||
</div> <!-- end .container --> |
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