mirror of
https://github.com/sismics/docs.git
synced 2025-12-21 13:41:37 +00:00
#41: Batch to rebuild quota storage + UI: show and edit quota
This commit is contained in:
@@ -16,6 +16,7 @@ angular.module('docs').controller('SettingsUserEdit', function($scope, $dialog,
|
||||
*/
|
||||
if ($scope.isEdit()) {
|
||||
Restangular.one('user', $stateParams.username).get().then(function(data) {
|
||||
data.storage_quota /= 1000000;
|
||||
$scope.user = data;
|
||||
});
|
||||
}
|
||||
@@ -25,15 +26,17 @@ angular.module('docs').controller('SettingsUserEdit', function($scope, $dialog,
|
||||
*/
|
||||
$scope.edit = function() {
|
||||
var promise = null;
|
||||
var user = angular.copy($scope.user);
|
||||
user.storage_quota *= 1000000;
|
||||
|
||||
if ($scope.isEdit()) {
|
||||
promise = Restangular
|
||||
.one('user', $stateParams.username)
|
||||
.post('', $scope.user);
|
||||
.post('', user);
|
||||
} else {
|
||||
promise = Restangular
|
||||
.one('user')
|
||||
.put($scope.user);
|
||||
.put(user);
|
||||
}
|
||||
|
||||
promise.then(function() {
|
||||
|
||||
@@ -110,7 +110,10 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#/settings/account" title="Logged in as {{ userInfo.username }}">{{ userInfo.username }}</a>
|
||||
<a href="#/settings/account" title="Logged in as {{ userInfo.username }}">
|
||||
<span class="glyphicon glyphicon-user"></span>
|
||||
{{ userInfo.username }}
|
||||
</a>
|
||||
</li>
|
||||
<li ng-class="{active: $uiRoute}" ui-route="/settings.*">
|
||||
<a href="#/settings/account">
|
||||
|
||||
@@ -73,6 +73,11 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="pull-left" title="To upgrade your quota, ask your administrator">
|
||||
{{ userInfo.storage_current / 1000000 | number: 0 }}MB ({{ userInfo.storage_current / userInfo.storage_quota * 100 | number: 1 }}%)
|
||||
used on {{ userInfo.storage_quota / 1000000 | number: 0 }}MB
|
||||
</div>
|
||||
|
||||
<div class="text-right">
|
||||
{{ totalDocuments }} document{{ totalDocuments > 1 ? 's' : '' }} found
|
||||
</div>
|
||||
|
||||
@@ -37,6 +37,21 @@
|
||||
<span class="help-block" ng-show="editUserForm.email.$error.maxlength">Too long</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-class="{ 'has-error': !editUserForm.storage_quota.$valid, success: editUserForm.storage_quota.$valid }">
|
||||
<label class="col-sm-2 control-label" for="inputQuota">Storage quota</label>
|
||||
|
||||
<div class="col-sm-7">
|
||||
<div class="input-group">
|
||||
<input name="storage_quota" type="number" id="inputQuota" required class="form-control"
|
||||
ng-pattern="/[0-9]*/" placeholder="Storage quota (in MB)" ng-model="user.storage_quota"/>
|
||||
<div class="input-group-addon">MB</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<span class="help-block" ng-show="editUserForm.storage_quota.$error.pattern">Number required</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-class="{ 'has-error': !editUserForm.password.$valid, success: editUserForm.password.$valid }">
|
||||
<label class="col-sm-2 control-label" for="inputPassword">Password</label>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user