forked from Archives/Athou_commafeed
profile page
This commit is contained in:
@@ -261,6 +261,9 @@ module.controller('ToolbarCtrl',
|
||||
$scope.toSettings = function() {
|
||||
$location.path('settings');
|
||||
};
|
||||
$scope.toProfile = function() {
|
||||
$location.path('profile');
|
||||
};
|
||||
});
|
||||
|
||||
module.controller('FeedListCtrl', function($scope, $stateParams, $http, $route,
|
||||
@@ -556,6 +559,27 @@ module.controller('SettingsCtrl', function($scope, $location, SettingsService) {
|
||||
};
|
||||
});
|
||||
|
||||
module.controller('ProfileCtrl', function($scope, $location, SessionService) {
|
||||
$scope.user = SessionService.get();
|
||||
|
||||
$scope.cancel = function() {
|
||||
$location.path('/');
|
||||
};
|
||||
$scope.save = function() {
|
||||
if (!$scope.profileForm.$valid) {
|
||||
return;
|
||||
}
|
||||
var o = {
|
||||
email : $scope.user.email
|
||||
};
|
||||
if ($scope.user.password == $scope.password_c) {
|
||||
o.password = $scope.user.password;
|
||||
}
|
||||
SessionService.save(o);
|
||||
$location.path('/');
|
||||
};
|
||||
});
|
||||
|
||||
module.controller('ManageSettingsCtrl', function($scope, $location, $state,
|
||||
AdminSettingsService) {
|
||||
|
||||
|
||||
@@ -50,6 +50,12 @@ app.config(function($routeProvider, $stateProvider, $urlRouterProvider) {
|
||||
templateUrl : 'templates/settings.html',
|
||||
controller : 'SettingsCtrl'
|
||||
});
|
||||
|
||||
$stateProvider.state('profile', {
|
||||
url : '/profile',
|
||||
templateUrl : 'templates/profile.html',
|
||||
controller : 'ProfileCtrl'
|
||||
});
|
||||
|
||||
$urlRouterProvider.when('/', '/feeds/view/category/all');
|
||||
$urlRouterProvider.when('/admin', '/admin/settings');
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
var module = angular.module('commafeed.services', [ 'ngResource' ]);
|
||||
|
||||
module.factory('SessionService', function($resource) {
|
||||
return $resource('rest/session/get');
|
||||
var actions = {
|
||||
get : {
|
||||
method : 'GET',
|
||||
params : {
|
||||
_method : 'get'
|
||||
}
|
||||
},
|
||||
save : {
|
||||
method : 'POST',
|
||||
params : {
|
||||
_method : 'save'
|
||||
}
|
||||
}
|
||||
};
|
||||
return $resource('rest/session/:_method', {}, actions);
|
||||
});
|
||||
|
||||
module.factory('SubscriptionService', function($resource, $http) {
|
||||
|
||||
Reference in New Issue
Block a user