Merge branch 'master' of https://github.com/sagidayan/SE-Hub into UI
This commit is contained in:
commit
69ad2028b8
8 changed files with 189 additions and 78 deletions
|
@ -52,10 +52,6 @@ app.register_blueprint(project_routes)
|
|||
|
||||
auto = Autodoc(app)
|
||||
|
||||
@app.errorhandler(404)
|
||||
def page_not_found(e):
|
||||
return app.send_static_file('views/404/index.html')
|
||||
|
||||
@app.route('/')
|
||||
def wellcomePage():
|
||||
return app.send_static_file('index.html')
|
||||
|
|
|
@ -79,7 +79,6 @@ def create_campus(token):
|
|||
except Exception:
|
||||
return bad_request()
|
||||
|
||||
|
||||
send_create_campus_request(user.email, user.name, campus.title)
|
||||
notify_se_hub_campus_request(campus, campus.title)
|
||||
return ok()
|
||||
|
|
|
@ -25,7 +25,7 @@ from SE_API.Respones_Utils import *
|
|||
user_routes = Blueprint("user_routes", __name__)
|
||||
auto = Autodoc()
|
||||
|
||||
|
||||
@user_routes.route('/api/users/getUserByToken/', defaults={'token': None})
|
||||
@user_routes.route('/api/users/getUserByToken/<string:token>', methods=["GET"])
|
||||
@auto.doc()
|
||||
def getUserByToken(token):
|
||||
|
@ -59,6 +59,9 @@ def getUserByToken(token):
|
|||
<br>
|
||||
403 - No User Found
|
||||
"""
|
||||
if token is None:
|
||||
return no_content("Token Is Empty, No User Found")
|
||||
|
||||
query = User.all()
|
||||
query.filter("seToken =", token)
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
angular.module('SeHub')
|
||||
.controller('mainController', ['$scope', '$rootScope', 'apiService', '$cookies', '$location', function($scope, $rootScope, apiService, $cookies, $location) {
|
||||
.controller('mainController', ['$scope', '$rootScope', 'dataService','apiService', '$cookies', '$cookieStore', '$location', '$window',
|
||||
|
||||
function($scope, $rootScope, dataService, apiService, $cookies, $cookieStore, $location, $window) {
|
||||
|
||||
var token = $cookies['com.sehub.www'];
|
||||
|
||||
|
@ -12,6 +14,7 @@ angular.module('SeHub')
|
|||
}
|
||||
$scope.loadingData = false;
|
||||
$scope.user = data;
|
||||
dataService.initService($scope); //Start Data Sync Service (For User)
|
||||
console.log(data);
|
||||
if ($scope.user.isFirstLogin) {
|
||||
$scope.menuObj = {};
|
||||
|
@ -22,11 +25,13 @@ angular.module('SeHub')
|
|||
$location.path('/home')
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
$scope.menuItems = [{
|
||||
"title": "Home",
|
||||
"icon": "fa fa-home",
|
||||
"title": "Dash Board",
|
||||
"icon": "fa fa-tachometer",
|
||||
"style": "selected",
|
||||
"route": "/home"
|
||||
}, {
|
||||
|
@ -63,6 +68,11 @@ angular.module('SeHub')
|
|||
|
||||
$scope.menuClicked = function(item) {
|
||||
var route = ""
|
||||
if (item.title == "Log Out") {
|
||||
console.info('Logging Out!');
|
||||
$cookieStore.remove('com.sehub.www');
|
||||
$window.location.href = 'http://se-hub.appspot.com'; // Reference to 'welcome' page
|
||||
}
|
||||
for (var i = $scope.menuItems.length - 1; i >= 0; i--) {
|
||||
if ($scope.menuItems[i].title === item.title) {
|
||||
$scope.menuItems[i].style = "selected";
|
||||
|
@ -75,4 +85,5 @@ angular.module('SeHub')
|
|||
}
|
||||
|
||||
|
||||
}]);
|
||||
}
|
||||
]);
|
|
@ -1,5 +1,6 @@
|
|||
angular.module('SeHub')
|
||||
.controller('settingsController', ['$scope', '$rootScope', 'apiService', '$cookies', '$location', function($scope, $rootScope, apiService, $cookies, $location) {
|
||||
.controller('settingsController', ['$scope', '$rootScope', 'dataService','apiService', '$cookies', '$location',
|
||||
function($scope, $rootScope, dataService ,apiService, $cookies, $location) {
|
||||
|
||||
var token = $cookies['com.sehub.www'];
|
||||
|
||||
|
@ -24,7 +25,33 @@ angular.module('SeHub')
|
|||
|
||||
});
|
||||
|
||||
$scope.isEditMode = false;
|
||||
$scope.profileMode = "Edit Profile";
|
||||
$scope.profileModeIcon = "fa fa-pencil";
|
||||
|
||||
$scope.changeProfileMode = function() {
|
||||
$scope.isEditMode = !$scope.isEditMode;
|
||||
if ($scope.isEditMode) {
|
||||
$scope.profileMode = "Save Profile";
|
||||
$scope.profileModeIcon = "fa fa-floppy-o";
|
||||
} else {
|
||||
dataService.userBrodcast($scope.user);
|
||||
$scope.profileMode = "Edit Profile";
|
||||
$scope.profileModeIcon = "fa fa-pencil";
|
||||
}
|
||||
}
|
||||
|
||||
// {
|
||||
// name: ";"
|
||||
// isLecturer: false
|
||||
// email: "sagidayan@gmail.com"
|
||||
// username: "sagidayan"
|
||||
// seToken: "76cd4178-94dd-4cb4-b464-111d2239e567"
|
||||
// isFirstLogin: true
|
||||
// campuses_id_list: [0]
|
||||
// classes_id_list: [0]
|
||||
// avatar_url: "https://avatars.githubusercontent.com/u/2984053?v=3"
|
||||
// }
|
||||
|
||||
|
||||
}]);
|
21
templates/js/services/dataService.js
Normal file
21
templates/js/services/dataService.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
var DEBUG = true;
|
||||
|
||||
angular.module('seHub.services').
|
||||
|
||||
factory('dataService', ['$http', function($http) {
|
||||
var scope = null;
|
||||
|
||||
|
||||
return {
|
||||
initService: function(mainScope) {
|
||||
// this.token = user.seToken;
|
||||
// this.user = user;
|
||||
scope = mainScope;
|
||||
},
|
||||
userBrodcast: function(user) {
|
||||
scope.user = JSON.parse(JSON.stringify(user));
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}]);
|
|
@ -81,6 +81,7 @@
|
|||
|
||||
<!-- Services -->
|
||||
<script src="templates/js/services/apiService.js"></script>
|
||||
<script src="templates/js/services/dataService.js"></script>
|
||||
|
||||
<!-- Controllers -->
|
||||
<script src="templates/js/controllers/mainController.js"></script>
|
||||
|
|
|
@ -5,6 +5,59 @@
|
|||
<md-content layout-padding>
|
||||
<md-card layout-padding>
|
||||
<h1><i class="fa fa-cogs"></i> {{title}}</h1>
|
||||
<div layout="row">
|
||||
<div>
|
||||
<md-card layout-padding>
|
||||
<div id="profile" layout="column">
|
||||
<div class="user-box" layout="row">
|
||||
<div>
|
||||
<img ng-src="{{user.avatar_url}}" alt="" style="width:20%">
|
||||
</div>
|
||||
<div flex="70%">
|
||||
<md-button class="md-raised" ng-click="changeProfileMode()">
|
||||
<i ng-class="profileModeIcon"></i> {{profileMode}}
|
||||
</md-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div layout="column" ng-if="!isEditMode">
|
||||
<div>
|
||||
<h2>{{user.name}}</h2>
|
||||
</div>
|
||||
<div>
|
||||
Email: {{user.email}}
|
||||
</div>
|
||||
<div>
|
||||
I Am a: {{(user.isLecturer) ? "Lecturer" : "Student"}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Starting Edit Mode Div -->
|
||||
<div layout="column" ng-if="isEditMode">
|
||||
<div>
|
||||
<md-input-container>
|
||||
<label>Full Name</label>
|
||||
<input ng-model="user.name">
|
||||
</md-input-container>
|
||||
</div>
|
||||
<div>
|
||||
<md-input-container>
|
||||
<label>Email</label>
|
||||
<input ng-model="user.email">
|
||||
</md-input-container>
|
||||
</div>
|
||||
<div>
|
||||
<md-switch ng-model="user.isLecturer" aria-label="Switch 1">
|
||||
I Am a: {{(user.isLecturer) ? "Lecturer" : "Student"}}
|
||||
</md-switch>
|
||||
</div>
|
||||
</div>
|
||||
</md-card>
|
||||
</div>
|
||||
</div>
|
||||
</md-card>
|
||||
|
||||
|
||||
|
||||
</md-content>
|
||||
</div>
|
Loading…
Reference in a new issue