This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support multiple e-mails client-side validation update signup form start or emails list. need to implement add and edit modal, and ability to switch primary. showErrors enhancements. formatting.
- Loading branch information
1 parent
d0613ce
commit b676d4e
Showing
20 changed files
with
397 additions
and
173 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
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
84 changes: 84 additions & 0 deletions
84
modules/core/client/directives/show-errors.client.directives.js
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,84 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Edits by Ryan Hutchison | ||
* Credit: https://github.com/paulyoder/angular-bootstrap-show-errors */ | ||
|
||
angular.module('core') | ||
.directive('showErrors', ['$timeout', '$interpolate', function ($timeout, $interpolate) { | ||
var linkFn = function (scope, el, attrs, formCtrl) { | ||
var inputEl, inputName, inputNgEl, options, showSuccess, toggleClasses, | ||
initCheck = false, | ||
showValidationMessages = false, | ||
blurred = false; | ||
|
||
options = scope.$eval(attrs.showErrors) || {}; | ||
showSuccess = options.showSuccess || false; | ||
inputEl = el[0].querySelector('.form-control[name]') || el[0].querySelector('[name]'); | ||
inputNgEl = angular.element(inputEl); | ||
inputName = $interpolate(inputNgEl.attr('name') || '')(scope); | ||
|
||
if (!inputName) { | ||
throw 'show-errors element has no child input elements with a \'name\' attribute class'; | ||
} | ||
|
||
inputNgEl.bind('blur', function () { | ||
blurred = true; | ||
|
||
return toggleClasses(formCtrl[inputName].$invalid); | ||
}); | ||
|
||
var reset = function () { | ||
return $timeout(function () { | ||
el.removeClass('has-error'); | ||
el.removeClass('has-success'); | ||
showValidationMessages = false; | ||
blurred = false; | ||
}, 0, false); | ||
}; | ||
|
||
scope.$watch(function () { | ||
return formCtrl[inputName] && formCtrl[inputName].$invalid; | ||
}, function (invalid) { | ||
if (!blurred) { | ||
return; | ||
} | ||
return toggleClasses(invalid); | ||
}); | ||
|
||
scope.$on('show-errors-check-validity', function (event, name) { | ||
if (angular.isUndefined(name) || formCtrl['$name'] === name) { | ||
initCheck = true; | ||
showValidationMessages = true; | ||
|
||
return toggleClasses(formCtrl[inputName].$invalid); | ||
} | ||
}); | ||
|
||
scope.$on('show-errors-reset', function (event, name) { | ||
if (angular.isUndefined(name) || formCtrl['$name'] === name) { | ||
return reset(); | ||
} | ||
}); | ||
|
||
toggleClasses = function (invalid) { | ||
el.toggleClass('has-error', showValidationMessages && invalid); | ||
if (showSuccess) { | ||
return el.toggleClass('has-success', showValidationMessages && !invalid); | ||
} | ||
}; | ||
}; | ||
|
||
return { | ||
restrict: 'A', | ||
require: '^form', | ||
compile: function (elem, attrs) { | ||
if (attrs.showErrors.indexOf('skipFormGroupCheck') === -1) { | ||
if (!(elem.hasClass('form-group') || elem.hasClass('input-group'))) { | ||
throw 'show-errors element does not have the \'form-group\' or \'input-group\' class'; | ||
} | ||
} | ||
return linkFn; | ||
} | ||
}; | ||
}]); |
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
20 changes: 12 additions & 8 deletions
20
modules/users/client/views/authentication/signin.client.view.html
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
45 changes: 28 additions & 17 deletions
45
modules/users/client/views/authentication/signup.client.view.html
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
59 changes: 36 additions & 23 deletions
59
modules/users/client/views/settings/edit-profile.client.view.html
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 |
---|---|---|
@@ -1,33 +1,46 @@ | ||
<section class="row" data-ng-controller="EditProfileController"> | ||
<div class="col-xs-offset-1 col-xs-10 col-md-offset-4 col-md-4"> | ||
<form name="userForm" data-ng-submit="updateUserProfile(userForm.$valid)" class="signin form-horizontal" autocomplete="off"> | ||
<fieldset> | ||
<div class="form-group"> | ||
<label for="firstName">First Name</label> | ||
<input type="text" id="firstName" name="firstName" class="form-control" data-ng-model="user.firstName" placeholder="First Name"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="lastName">Last Name</label> | ||
<input type="text" id="lastName" name="lastName" class="form-control" data-ng-model="user.lastName" placeholder="Last Name"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="email">Email</label> | ||
<input type="email" id="email" name="email" class="form-control" data-ng-model="user.email" placeholder="Email"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="username">Username</label> | ||
<input type="text" id="username" name="username" class="form-control" data-ng-model="user.username" placeholder="Username"> | ||
</div> | ||
<div class="text-center form-group"> | ||
<button type="submit" class="btn btn-lg btn-primary">Save Profile</button> | ||
<div class="col-xs-10 col-md-8"> | ||
<section> | ||
<h4>Account</h4> | ||
<form name="userForm" data-ng-submit="updateUserProfile(userForm.$valid)" class="signin" autocomplete="off"> | ||
<fieldset> | ||
<div class="form-group"> | ||
<label for="firstName">First Name</label> | ||
<input type="text" id="firstName" name="firstName" class="form-control" data-ng-model="user.firstName" placeholder="First Name"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="lastName">Last Name</label> | ||
<input type="text" id="lastName" name="lastName" class="form-control" data-ng-model="user.lastName" placeholder="Last Name"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="username">Username</label> | ||
<input type="text" id="username" name="username" class="form-control" data-ng-model="user.username" placeholder="Username"> | ||
</div> | ||
</fieldset> | ||
<div class="text-right form-group"> | ||
<button type="submit" class="btn btn-primary">Save Profile</button> | ||
</div> | ||
<div data-ng-show="success" class="text-center text-success"> | ||
<strong>Profile Saved Successfully</strong> | ||
</div> | ||
<div data-ng-show="error" class="text-center text-danger"> | ||
<strong data-ng-bind="error"></strong> | ||
</div> | ||
</fieldset> | ||
</form> | ||
</form> | ||
</section> | ||
<section> | ||
<h4>Emails</h4> | ||
<ul class="list-unstyled"> | ||
<li ng-repeat="email in user.emails" class="row"> | ||
<div class="col-md-8"> | ||
<div>{{email.address}}</div> | ||
<span class="label label-primary" ng-if="email.isPrimary">Primary</span> | ||
</div> | ||
<div class="col-md-4"> | ||
<a class="btn btn-link">Edit</a> | ||
</div> | ||
</li> | ||
</ul> | ||
</section> | ||
</div> | ||
</section> |
6 changes: 3 additions & 3 deletions
6
modules/users/client/views/settings/manage-social-accounts.client.view.html
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
Oops, something went wrong.