Skip to content

Commit

Permalink
#69 Added avatar size and dimension hints
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jan 2, 2017
1 parent 6e1fed8 commit d73eea5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions ui/app/scripts/controllers/SettingsCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@
$state.go('app.main');
};

$scope.clearAvatar = function(form) {
$scope.basicData.avatar = null;
form.avatar.$setValidity('maxsize', true);
form.avatar.$setPristine(true);
};

$scope.$watch('avatar', function(value) {
if(!value){
return;
Expand Down
12 changes: 9 additions & 3 deletions ui/app/views/partials/personal-settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@ <h4>Update basic information</h4>
maxsize="500"
base-sixty-four-input
do-not-parse-if-oversize>
</div>
<span ng-show="form.file.$error.maxsize">Files must not exceed 500 KB</span>
</div>
<div class="help-block">Images must not exceed 500 KB. Recommended dimension are 100x100px</div>
</div>

<div ng-show="basicData.avatar" style="width: 100px;">
<img alt="User avatar" data-ng-src="{{'data:image/jpeg;base64,' + basicData.avatar}}"/>
<br>
<button class="mt-xxs btn btn-block btn-sm btn-danger" type="button" ng-click="basicData.avatar = null">Clear</button>
<button class="mt-xxs btn btn-block btn-sm btn-danger" type="button" ng-click="clearAvatar(basicForm)">Clear</button>
</div>

<div ng-messages="basicForm.avatar.$error" ng-show="!basicForm.avatar.$pristine && basicForm.avatar.$error">
<div ng-messages-include="settings-error.html"></div>
</div>
</div>
</div>

Expand Down Expand Up @@ -139,6 +142,9 @@ <h4><input type="checkbox" ng-model="passData.changePassword" ng-click="clearPas
<div class="mt-xxs text-danger" ng-message="maxlength">
<span translate="error.form.maxlength"></span>
</div>
<div class="mt-xxs text-danger" ng-message="maxsize">
Files must not exceed 500 KB
</div>
<div class="mt-xxs text-danger" ng-message="compareTo">
Oops, that's not the same password as the first one
</div>
Expand Down

0 comments on commit d73eea5

Please sign in to comment.