Changed settings into profile. + in controller
This commit is contained in:
parent
e3fe428900
commit
e135ee020a
5 changed files with 54 additions and 46 deletions
|
@ -38,9 +38,9 @@ app.config(['$routeProvider', '$locationProvider',
|
||||||
templateUrl: 'templates/views/home.html',
|
templateUrl: 'templates/views/home.html',
|
||||||
controller: 'homeController'
|
controller: 'homeController'
|
||||||
})
|
})
|
||||||
.when('/Settings', {
|
.when('/profile/:id', {
|
||||||
templateUrl: 'templates/views/settings.html',
|
templateUrl: 'templates/views/profile.html',
|
||||||
controller: 'settingsController'
|
controller: 'profileController'
|
||||||
})
|
})
|
||||||
.when('/tasks', {
|
.when('/tasks', {
|
||||||
templateUrl: 'templates/views/tasks.html',
|
templateUrl: 'templates/views/tasks.html',
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
angular.module('SeHub')
|
angular.module('SeHub')
|
||||||
.controller('mainController', ['$scope', '$rootScope', 'dataService','apiService', '$cookies', '$cookieStore', '$location', '$window',
|
.controller('mainController',
|
||||||
|
['$scope', '$rootScope', 'dataService', 'apiService', '$cookies',
|
||||||
|
'$cookieStore', '$location', '$window',
|
||||||
|
|
||||||
function($scope, $rootScope, dataService, apiService, $cookies, $cookieStore, $location, $window) {
|
function($scope, $rootScope, dataService, apiService, $cookies, $cookieStore, $location, $window) {
|
||||||
top.setIsEnterd = true;
|
top.setIsEnterd = true;
|
||||||
|
@ -14,20 +16,6 @@ angular.module('SeHub')
|
||||||
}
|
}
|
||||||
$scope.loadingData = false;
|
$scope.loadingData = false;
|
||||||
$scope.user = data;
|
$scope.user = data;
|
||||||
dataService.initService($scope); //Start Data Sync Service (For User)
|
|
||||||
console.log(data);
|
|
||||||
if ($scope.user.isFirstLogin) {
|
|
||||||
$scope.menuObj = {};
|
|
||||||
$scope.isInRegisterMode = true;
|
|
||||||
$scope.loadingData = false;
|
|
||||||
$location.path('/register')
|
|
||||||
} else {
|
|
||||||
$location.path('/home')
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$scope.menuItems = [{
|
$scope.menuItems = [{
|
||||||
"title": "Dash Board",
|
"title": "Dash Board",
|
||||||
|
@ -55,10 +43,10 @@ angular.module('SeHub')
|
||||||
"style": "",
|
"style": "",
|
||||||
"route": "/tasks"
|
"route": "/tasks"
|
||||||
}, {
|
}, {
|
||||||
"title": "Settings",
|
"title": "Profile",
|
||||||
"icon": "fa fa-cogs",
|
"icon": "fa fa-cogs",
|
||||||
"style": "",
|
"style": "",
|
||||||
"route": "/Settings"
|
"route": "/profile/" + $scope.user.id.toString()
|
||||||
}, {
|
}, {
|
||||||
"title": "Log Out",
|
"title": "Log Out",
|
||||||
"icon": "fa fa-power-off",
|
"icon": "fa fa-power-off",
|
||||||
|
@ -66,6 +54,21 @@ angular.module('SeHub')
|
||||||
"route": "/logout"
|
"route": "/logout"
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
dataService.initService($scope); //Start Data Sync Service (For User)
|
||||||
|
console.log(data);
|
||||||
|
if ($scope.user.isFirstLogin) {
|
||||||
|
$scope.menuObj = {};
|
||||||
|
$scope.isInRegisterMode = true;
|
||||||
|
$scope.loadingData = false;
|
||||||
|
$location.path('/register')
|
||||||
|
} else {
|
||||||
|
$location.path('/home')
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$scope.menuClicked = function(item) {
|
$scope.menuClicked = function(item) {
|
||||||
var route = ""
|
var route = ""
|
||||||
if (item.title == "Log Out") {
|
if (item.title == "Log Out") {
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
angular.module('SeHub')
|
angular.module('SeHub')
|
||||||
.controller('profileController', ['$scope', '$rootScope', 'dataService', 'apiService', '$cookies', '$location',
|
.controller('profileController', ['$scope', '$rootScope', 'dataService', 'apiService',
|
||||||
function($scope, $rootScope, dataService, apiService, $cookies, $location) {
|
'$cookies', '$location', '$routeParams',
|
||||||
|
function($scope, $rootScope, dataService, apiService, $cookies, $location, $routeParams) {
|
||||||
|
|
||||||
var token = $cookies['com.sehub.www'];
|
var token = $cookies['com.sehub.www'];
|
||||||
|
|
||||||
$scope.loadingData = true;
|
$scope.loadingData = true;
|
||||||
$scope.isInRegisterMode = false;
|
$scope.isInRegisterMode = false;
|
||||||
|
|
||||||
$scope.title = "Profile"
|
$scope.title = "Profile " + $routeParams.id;
|
||||||
|
|
||||||
apiService.getUserByToken(token).success(function(data) {
|
apiService.getUserByToken(token).success(function(data) {
|
||||||
if (data.message == 'No User Found') {
|
if (data.message == 'No User Found') {
|
||||||
|
@ -15,6 +16,7 @@ angular.module('SeHub')
|
||||||
}
|
}
|
||||||
$scope.loadingData = false;
|
$scope.loadingData = false;
|
||||||
$scope.user = data;
|
$scope.user = data;
|
||||||
|
|
||||||
console.log(data);
|
console.log(data);
|
||||||
if ($scope.user.isFirstLogin) {
|
if ($scope.user.isFirstLogin) {
|
||||||
$scope.menuObj = {};
|
$scope.menuObj = {};
|
||||||
|
@ -87,6 +89,9 @@ angular.module('SeHub')
|
||||||
[28, 48, 40, 3]
|
[28, 48, 40, 3]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$scope.isUser = function(){
|
||||||
|
return $scope.user.id.toString() === $routeParams.id;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
|
@ -109,7 +109,7 @@
|
||||||
<!-- Controllers -->
|
<!-- Controllers -->
|
||||||
<script src="templates/js/controllers/mainController.js"></script>
|
<script src="templates/js/controllers/mainController.js"></script>
|
||||||
<script src="templates/js/controllers/homeController.js"></script>
|
<script src="templates/js/controllers/homeController.js"></script>
|
||||||
<script src="templates/js/controllers/settingsController.js"></script>
|
<script src="templates/js/controllers/profileController.js"></script>
|
||||||
<script src="templates/js/controllers/registerController.js"></script>
|
<script src="templates/js/controllers/registerController.js"></script>
|
||||||
<script src="templates/js/controllers/tasksController.js"></script>
|
<script src="templates/js/controllers/tasksController.js"></script>
|
||||||
<script src="templates/js/controllers/myClassesController.js"></script>
|
<script src="templates/js/controllers/myClassesController.js"></script>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<img ng-src="{{user.avatar_url}}" alt="" style="width:20%">
|
<img ng-src="{{user.avatar_url}}" alt="" style="width:20%">
|
||||||
</div>
|
</div>
|
||||||
<div flex="70%">
|
<div flex="70%">
|
||||||
<md-button class="md-raised" ng-click="changeProfileMode()">
|
<md-button class="md-raised" ng-click="changeProfileMode()" ng-if="isUser()">
|
||||||
<i ng-class="profileModeIcon"></i> {{profileMode}}
|
<i ng-class="profileModeIcon"></i> {{profileMode}}
|
||||||
</md-button>
|
</md-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue