Merge pull request #1613 from emanuelschuetze/user-profile
User settings profile view
This commit is contained in:
commit
c54b00c5f4
@ -229,12 +229,12 @@ angular.module('OpenSlidesApp.core.site', [
|
||||
// Replaces any folowing points though a -
|
||||
templateUrl = 'static/templates/' + appName.replace(/\./g, '-') + '.html';
|
||||
}
|
||||
config.templateUrl = config.templateUrl || templateUrl;
|
||||
config.templateUrl = state.templateUrl || templateUrl;
|
||||
|
||||
// controller
|
||||
if (patterns.length >= 3) {
|
||||
controller = _.capitalize(patterns[1]) + defaultControllers[_.last(patterns)];
|
||||
config.controller = config.controller || controller;
|
||||
config.controller = state.controller || controller;
|
||||
}
|
||||
result[name] = config;
|
||||
});
|
||||
|
@ -1,8 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<!--[if lt IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
|
||||
<!--[if IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html lang="en" ng-app="myApp" class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
|
||||
<html lang="en" class="no-js"> <!-- TODO: make lang dynamic -->
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<base href="/">
|
||||
@ -34,19 +31,22 @@
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" role="menu">
|
||||
<li><a href="{% url 'user_settings' %}">
|
||||
<i class="fa fa-cog"></i>
|
||||
<translate>Edit profile</translate>
|
||||
</a>
|
||||
<li><a href="{% url 'password_change' %}">
|
||||
<i class="fa fa-key"></i>
|
||||
<translate>Change password</translate>
|
||||
</a>
|
||||
<li>
|
||||
<a ui-sref="users.user.detail.profile({ id: operator.user.id })">
|
||||
<i class="fa fa-cog"></i>
|
||||
<translate>Edit profile</translate>
|
||||
</a>
|
||||
<li>
|
||||
<a href="#TODO">
|
||||
<i class="fa fa-key"></i>
|
||||
<translate>Change password</translate>
|
||||
</a>
|
||||
<li class="divider">
|
||||
<li><a ng-click="logout()" href="">
|
||||
<i class="fa fa-sign-out"></i>
|
||||
<translate>Logout</translate>
|
||||
</a>
|
||||
<li>
|
||||
<a ng-click="logout()" href="">
|
||||
<i class="fa fa-sign-out"></i>
|
||||
<translate>Logout</translate>
|
||||
</a>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -122,6 +122,13 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('users.user.detail.profile', {
|
||||
views: {
|
||||
'@users.user': {},
|
||||
},
|
||||
url: '/profile',
|
||||
controller: 'UserProfileCtrl',
|
||||
})
|
||||
.state('users.user.import', {
|
||||
url: '/import',
|
||||
controller: 'UserImportCtrl',
|
||||
@ -336,6 +343,18 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
||||
};
|
||||
})
|
||||
|
||||
.controller('UserProfileCtrl', function($scope, $state, User, user) {
|
||||
$scope.user = user; // autoupdate is not activated
|
||||
$scope.save = function (user) {
|
||||
User.save(user).then(
|
||||
function(success) {
|
||||
// TODO: show success message
|
||||
console.log("profile saved");
|
||||
}
|
||||
);
|
||||
};
|
||||
})
|
||||
|
||||
.controller('UserImportCtrl', function($scope, $state, User) {
|
||||
// import from textarea
|
||||
$scope.importByLine = function () {
|
||||
|
@ -0,0 +1,41 @@
|
||||
<h1>Edit profil</h1>
|
||||
|
||||
<form name="userForm" >
|
||||
<div class="form-group">
|
||||
<label for="inputUsername" translate>Username</label>
|
||||
<input type="text"
|
||||
ng-model="user.username"
|
||||
class="form-control"
|
||||
name="inputUsername"
|
||||
required>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-xs-2">
|
||||
<label for="inputTitle" translate-comment="academic degree" translate>Title</label>
|
||||
<input type="text" ng-model="user.title" class="form-control" name="inputTitle">
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<label for="inputFirstName" translate>First name</label>
|
||||
<input type="text" ng-model="user.first_name" class="form-control" name="inputFirstName">
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<label for="inputLastName" translate>Last name</label>
|
||||
<input type="text" ng-model="user.last_name" class="form-control" name="inputLastName">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputStructureLevel" translate>Structure level</label>
|
||||
<input type="text" ng-model="user.structure_level" class="form-control" name="inputStructureLevel">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="textAbout" translate>About me</label>
|
||||
<textarea ng-model="user.about_me" class="form-control" name="textAbout" />
|
||||
</div>
|
||||
|
||||
<button type="submit" ng-click="save(user)" class="btn btn-primary" translate>
|
||||
Save
|
||||
</button>
|
||||
<button ui-sref="users.user.list" class="btn btn-default" translate>
|
||||
Cancel
|
||||
</button>
|
||||
</form>
|
Loading…
Reference in New Issue
Block a user