garbage commit
This commit is contained in:
parent
7bb9bb9bfb
commit
3f272dc304
16 changed files with 712 additions and 184 deletions
|
@ -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()
|
||||
|
@ -87,7 +86,6 @@ def create_campus(token):
|
|||
|
||||
|
||||
|
||||
|
||||
@campus_routes.route('/api/campuses/getAll/<string:token>', methods=['GET'])
|
||||
@auto.doc()
|
||||
def get_campuses(token):
|
||||
|
@ -125,7 +123,11 @@ def get_campuses(token):
|
|||
query = Campus.all()
|
||||
for c in query.run():
|
||||
arr.append(dict(json.loads(c.to_JSON())))
|
||||
print "ARR:"
|
||||
print arr
|
||||
for c in arr:
|
||||
print"c:"
|
||||
print c
|
||||
if len(arr) != 0:
|
||||
return Response(response=json.dumps(arr),
|
||||
status=200,
|
||||
|
@ -138,6 +140,63 @@ def get_campuses(token):
|
|||
return forbidden("Invalid Token")
|
||||
|
||||
|
||||
@campus_routes.route('/api/campuses/deleteCampus/<string:token>/<string:campusName>', methods=['DELETE'])
|
||||
@auto.doc()
|
||||
def deleteCampus(token,campusName):
|
||||
"""
|
||||
<span class="card-title">This Call will delete a specific campus</span>
|
||||
<br>
|
||||
<b>Route Parameters</b><br>
|
||||
- seToken: 'seToken'
|
||||
- title: 'campusName'
|
||||
<br>
|
||||
<br>
|
||||
<b>Payload</b><br>
|
||||
- NONE <br>
|
||||
<br>
|
||||
<br>
|
||||
<b>Response</b>
|
||||
<br>
|
||||
202 - Deleted campus
|
||||
<br>
|
||||
204 - No Matching Campus Found
|
||||
<br>
|
||||
....<br>
|
||||
{<br>
|
||||
...<br>
|
||||
}req<br>
|
||||
|
||||
]<br>
|
||||
400 - Bad Request
|
||||
<br>
|
||||
403 - Invalid token or not a lecturer!<br>
|
||||
"""
|
||||
|
||||
if not is_lecturer(token): #todo: change to lecturer id
|
||||
return forbidden("Invalid token or not a lecturer!")
|
||||
|
||||
|
||||
user = get_user_by_token(token)
|
||||
query = Campus.all()
|
||||
query.filter('master_user_id =',user.key().id())
|
||||
|
||||
try:
|
||||
query.filter('title =', campusName)
|
||||
except Exception as e:
|
||||
print e
|
||||
return bad_request("invalid campus title attribute")
|
||||
|
||||
|
||||
for c in query.run():
|
||||
db.delete(c)
|
||||
db.save
|
||||
return accepted("campus deleted")
|
||||
|
||||
|
||||
return bad_request("no such campus found")
|
||||
|
||||
|
||||
|
||||
|
||||
@campus_routes.route('/api/campuses/help')
|
||||
def documentation():
|
||||
|
|
|
@ -41,7 +41,7 @@ def create_project(token):
|
|||
{<br>
|
||||
'projectName': 'Advance Math',<br>
|
||||
'courseName': 'JCE',<br>
|
||||
'logo_url': 'http://location.domain.com/image.jpg'<br>
|
||||
'logo_url': 'http://location.domain.com/image.jpg',<br>
|
||||
'gitRepository': 'http://location.git.com/somthing'<br>
|
||||
}<br>
|
||||
<br>
|
||||
|
@ -57,10 +57,12 @@ def create_project(token):
|
|||
if not request.data:
|
||||
return bad_request()
|
||||
payload = json.loads(request.data)
|
||||
if not is_lecturer(token): #todo: change to lecturer id
|
||||
return forbidden("Invalid token or not a lecturer!")
|
||||
#if not is_lecturer(token): #todo: change to lecturer id
|
||||
# return forbidden("Invalid token or not a lecturer!")
|
||||
|
||||
user = get_user_by_token(token)
|
||||
if user is None:
|
||||
return bad_request("Wrong user Token")
|
||||
|
||||
#todo: check legality
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class User(db.Model):
|
|||
seToken = db.StringProperty(required=True)
|
||||
avatar_url = db.StringProperty(required=True)
|
||||
isFirstLogin = db.BooleanProperty(default=True)
|
||||
campusName = db.StringProperty(default="")
|
||||
campusName = db.StringProperty(required=True, default=" ")
|
||||
campuses_id_list = db.StringListProperty(default=[])
|
||||
classes_id_list = db.StringListProperty(default=[])
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
body{
|
||||
font-family: "Alef Hebrew",
|
||||
“Helvetica Neue”,
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif;
|
||||
“Helvetica Neue”,
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif;
|
||||
}
|
||||
|
||||
.menuBtn {
|
||||
|
@ -114,34 +114,36 @@ body.noscroll
|
|||
.campusAvatar img
|
||||
{
|
||||
/*
|
||||
margin-top: 1em;
|
||||
margin-right: 1em;
|
||||
position: center;
|
||||
*/
|
||||
margin-top: 1em;
|
||||
margin-right: 1em;
|
||||
position: center;
|
||||
*/
|
||||
|
||||
border-radius: 40px;
|
||||
position:center;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
margin: 6px;
|
||||
-webkit-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75);
|
||||
-moz-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75);
|
||||
box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75);
|
||||
}
|
||||
border-radius: 40px;
|
||||
position:center;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
margin: 6px;
|
||||
-webkit-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75);
|
||||
-moz-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75);
|
||||
box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75);
|
||||
}
|
||||
|
||||
.spacer{
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
}
|
||||
.spacer{
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.port_spacer{
|
||||
margin-top: auto;
|
||||
margin-bottom: auto;
|
||||
}
|
||||
.port_spacer
|
||||
{
|
||||
margin-top: auto;
|
||||
margin-bottom: auto;
|
||||
}
|
||||
|
||||
.mail_suffix{
|
||||
margin-top: auto;
|
||||
}
|
||||
.mail_suffix
|
||||
{
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
|
||||
.createCampus
|
||||
|
@ -149,13 +151,41 @@ body.noscroll
|
|||
position:relative;
|
||||
}
|
||||
|
||||
|
||||
/*div.img campusAvatar
|
||||
.listdemoBasicUsage md-divider
|
||||
{
|
||||
border: 1px solid #0000ff;
|
||||
padding-right: 10px;
|
||||
float:right;
|
||||
}*/
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.md-avatar img
|
||||
{
|
||||
/*TODO*/
|
||||
}
|
||||
|
||||
.feedContent
|
||||
{
|
||||
padding-left: 6%;
|
||||
font-size: 15px;
|
||||
display:table;
|
||||
}
|
||||
|
||||
.md-no-sticky
|
||||
{
|
||||
background-color: blue;
|
||||
}
|
||||
|
||||
.roundUserAvatar
|
||||
{
|
||||
width: 6%;
|
||||
height: auto;
|
||||
border-radius: 150px;
|
||||
-webkit-border-radius: 150px;
|
||||
-moz-border-radius: 150px;
|
||||
/*background: url(http://i61.tinypic.com/v86f7.png) no-repeat;*/
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, .8);
|
||||
-webkit-box-shadow: 0 0 8px rgba(0, 0, 0, .8);
|
||||
-moz-box-shadow: 0 0 8px rgba(0, 0, 0, .8);
|
||||
}
|
||||
|
||||
/*.dropDown /* TODO *
|
||||
{
|
||||
|
@ -166,10 +196,47 @@ body.noscroll
|
|||
border-radius: 1px black solid;
|
||||
}*/
|
||||
|
||||
.gray-font{
|
||||
.gray-font
|
||||
{
|
||||
color: #7f7f7f;
|
||||
font-size: 300%;
|
||||
text-shadow:#e0e0e0 1px 1px 0;
|
||||
opacity: 0;
|
||||
-webkit-animation-duration: 8s;
|
||||
animation-duration: 8s;
|
||||
-webkit-animation-fill-mode: both;
|
||||
animation-fill-mode: both;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeOutUp {
|
||||
0% {
|
||||
opacity: 1;
|
||||
-webkit-transform: translateY(0);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translateY(-200px);
|
||||
/*-webkit-transform: scale(0,0); */
|
||||
height: 0px;
|
||||
}
|
||||
}
|
||||
@keyframes fadeOutUp {
|
||||
0% {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: translateY(-200px);
|
||||
/*transform: scale(0,0); */
|
||||
height: 0px;
|
||||
}
|
||||
}
|
||||
.fadeOutUp {
|
||||
-webkit-animation-name: fadeOutUp;
|
||||
animation-name: fadeOutUp;
|
||||
}
|
||||
|
||||
.user-pane-menu{
|
||||
|
@ -213,6 +280,7 @@ body.noscroll
|
|||
.se-menu li:hover{
|
||||
background-color: #E2E2E2;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
.se-menu li .selected{
|
||||
background-color: #E2E2E2;
|
||||
|
@ -237,4 +305,63 @@ body.noscroll
|
|||
.se-menu ul a{
|
||||
text-decoration: none !important;
|
||||
color: #7f7f7f;
|
||||
}
|
||||
}
|
||||
|
||||
/*Settings Style*/
|
||||
|
||||
.settingList .settingListItem:hover{
|
||||
background-color: #E2E2E2;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.settingList .settingListItemRoot{
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.settingList .settingListItem{
|
||||
width: 100%;
|
||||
padding: 15px 0px auto 15px;
|
||||
}
|
||||
|
||||
|
||||
/*End Settings*/
|
||||
|
||||
|
||||
/*md Effects*/
|
||||
|
||||
.md-avatar{
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 8px;
|
||||
margin-right: 16px;
|
||||
border-radius: 50%;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
|
||||
/* md-list-item .md-no-style.md-button, md-list-item.md-no-proxy.md-button {
|
||||
font-size: inherit;
|
||||
height: inherit;
|
||||
text-align: left;
|
||||
text-transform: none;
|
||||
width: 100%;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
md-list-item, md-list-item .md-list-item-inner {
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-justify-content: flex-start;
|
||||
-ms-flex-pack: start;
|
||||
justify-content: flex-start;
|
||||
-webkit-align-items: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
min-height: 48px;
|
||||
}*/
|
||||
|
||||
/*End Effects for MD*/
|
||||
|
|
|
@ -37,6 +37,10 @@ app.config(['$routeProvider', '$locationProvider',
|
|||
.when('/home', {
|
||||
templateUrl: 'templates/views/home.html',
|
||||
controller: 'homeController'
|
||||
})
|
||||
.when('/Settings', {
|
||||
templateUrl: 'templates/views/settings.html',
|
||||
controller: 'settingsController'
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,71 @@
|
|||
/**
|
||||
* Created by sagi on 6/16/15.
|
||||
*/
|
||||
angular.module('SeHub')
|
||||
.controller('homeController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
|
||||
{
|
||||
var imagePath = $scope.user.avatar_url;
|
||||
$scope.phones = [
|
||||
{ type: 'Home', number: '(972) 865-82861' },
|
||||
{ type: 'Cell', number: '(972) 5251-32309' },
|
||||
];
|
||||
|
||||
$scope.messages = [
|
||||
{
|
||||
face : imagePath,
|
||||
what: 'I need to go to luna-park',
|
||||
who: 'Matan Bar Yosef',
|
||||
when: '3:08PM',
|
||||
notes: " Lets do something"
|
||||
},
|
||||
{
|
||||
face : imagePath,
|
||||
what: 'Lets Lets Lets',
|
||||
who: 'Matan Bar Yosef',
|
||||
when: '4:33PM',
|
||||
notes: " Lets go drink something"
|
||||
},
|
||||
{
|
||||
face : imagePath,
|
||||
what: 'Let me tell you a secret',
|
||||
who: 'Sagi Dayan',
|
||||
when: '4:15PM',
|
||||
notes: " I am S'ein"
|
||||
},
|
||||
{
|
||||
face : imagePath,
|
||||
what: 'Listen to this!',
|
||||
who: 'Aran Zaiger',
|
||||
when: '6:15PM',
|
||||
notes: " I am gaylord ultima!!"
|
||||
},
|
||||
{
|
||||
face : imagePath,
|
||||
what: 'Hi?',
|
||||
who: 'Etye Meyer',
|
||||
when: '7:45AM',
|
||||
notes: " I am mega gaylord ultima"
|
||||
}
|
||||
];
|
||||
|
||||
$scope.tasks = [
|
||||
{
|
||||
ExNum: '1',
|
||||
dueDate: '23/06/15',
|
||||
notes: " Build A Game: Scrabble"
|
||||
},
|
||||
{
|
||||
ExNum: '3',
|
||||
dueDate: '30/06/15',
|
||||
notes: " Static Array"
|
||||
},
|
||||
{
|
||||
ExNum: '4',
|
||||
dueDate: '07/07/15',
|
||||
notes: " Dynamic Array"
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
// animation
|
||||
$scope.isEnterd = top.setIsEnterd;
|
||||
}]);
|
|
@ -1,76 +1,90 @@
|
|||
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',
|
||||
|
||||
var token = $cookies['com.sehub.www'];
|
||||
function($scope, $rootScope, dataService, apiService, $cookies, $cookieStore, $location, $window) {
|
||||
top.setIsEnterd = true;
|
||||
var token = $cookies['com.sehub.www'];
|
||||
|
||||
$scope.loadingData = true;
|
||||
$scope.isInRegisterMode = false;
|
||||
$scope.loadingData = true;
|
||||
$scope.isInRegisterMode = false;
|
||||
|
||||
apiService.getUserByToken(token).success(function(data) {
|
||||
if (data.message == 'No User Found') {
|
||||
console.error("No User Found!");
|
||||
}
|
||||
|
||||
$scope.user = data;
|
||||
if ($scope.user.isFirstLogin) {
|
||||
$scope.menuObj = {};
|
||||
$scope.isInRegisterMode = true;
|
||||
apiService.getUserByToken(token).success(function(data) {
|
||||
if (data.message == 'No User Found') {
|
||||
console.error("No User Found!");
|
||||
}
|
||||
$scope.loadingData = false;
|
||||
$location.path('/register')
|
||||
} else {
|
||||
$location.path('/home')
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
apiService.getUserByToken(token).success(function(data) // Get user token
|
||||
{
|
||||
$scope.user = data;
|
||||
$scope.loadingData = false;
|
||||
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')
|
||||
}
|
||||
|
||||
apiService.getAllCampuses($scope.user.seToken).success(function(data) // Get all the campuses
|
||||
{
|
||||
$scope.campuses = data;
|
||||
}).error(function() {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$scope.menuItems = [{
|
||||
"title": "Home",
|
||||
"icon": "fa fa-home",
|
||||
"style": "selected",
|
||||
"route": "/home"
|
||||
}, {
|
||||
"title": "My Campuses",
|
||||
"icon": "fa fa-university",
|
||||
"style": "selected",
|
||||
"route": "/campuses"
|
||||
}, {
|
||||
"title": "My Classes",
|
||||
"icon": "fa fa-graduation-cap",
|
||||
"style": "selected",
|
||||
"route": "/campuses"
|
||||
}, {
|
||||
"title": "My Projects",
|
||||
"icon": "fa fa-cube",
|
||||
"style": "selected",
|
||||
"route": "/campuses"
|
||||
}, {
|
||||
"title": "Tasks",
|
||||
"icon": "fa fa-clipboard",
|
||||
"style": "selected",
|
||||
"route": "/campuses"
|
||||
}, {
|
||||
"title": "Settings",
|
||||
"icon": "fa fa-cogs",
|
||||
"style": "selected",
|
||||
"route": "/campuses"
|
||||
}, {
|
||||
"title": "Log Out",
|
||||
"icon": "fa fa-power-off",
|
||||
"style": "selected",
|
||||
"route": "/campuses"
|
||||
}];
|
||||
|
||||
|
||||
}]);
|
||||
$scope.menuItems = [{
|
||||
"title": "Dash Board",
|
||||
"icon": "fa fa-tachometer",
|
||||
"style": "selected",
|
||||
"route": "/home"
|
||||
}, {
|
||||
"title": "My Campuses",
|
||||
"icon": "fa fa-university",
|
||||
"style": "",
|
||||
"route": "/campuses"
|
||||
}, {
|
||||
"title": "My Classes",
|
||||
"icon": "fa fa-graduation-cap",
|
||||
"style": "",
|
||||
"route": "/campuses"
|
||||
}, {
|
||||
"title": "My Projects",
|
||||
"icon": "fa fa-cube",
|
||||
"style": "",
|
||||
"route": "/campuses"
|
||||
}, {
|
||||
"title": "Tasks",
|
||||
"icon": "fa fa-clipboard",
|
||||
"style": "",
|
||||
"route": "/campuses"
|
||||
}, {
|
||||
"title": "Settings",
|
||||
"icon": "fa fa-cogs",
|
||||
"style": "",
|
||||
"route": "/Settings"
|
||||
}, {
|
||||
"title": "Log Out",
|
||||
"icon": "fa fa-power-off",
|
||||
"style": "",
|
||||
"route": "/logout"
|
||||
}];
|
||||
|
||||
$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";
|
||||
route = $scope.menuItems[i].route;
|
||||
} else {
|
||||
$scope.menuItems[i].style = "";
|
||||
}
|
||||
};
|
||||
top.setIsEnterd = false;
|
||||
$location.path(route);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
]);
|
|
@ -6,11 +6,11 @@ angular.module('SeHub')
|
|||
$scope.createCampusClicked = false;
|
||||
$scope.isEmpty = true; // if the academic email line is empty
|
||||
$scope.jsonCreateCampus =
|
||||
{
|
||||
"title": "Create Campus",
|
||||
"email": "email_ending",
|
||||
"avatar": "self.avatar.url"
|
||||
}
|
||||
{
|
||||
"title": "Create Campus",
|
||||
"email": "email_ending",
|
||||
"avatar": "self.avatar.url"
|
||||
}
|
||||
|
||||
$rootScope.seToken = $cookies['com.sehub.www'];
|
||||
var token = $rootScope.seToken;
|
||||
|
@ -56,9 +56,28 @@ angular.module('SeHub')
|
|||
|
||||
$scope.submitClicked = function(ev)
|
||||
{
|
||||
var emailValid = false;
|
||||
var jsonUpdateUser =
|
||||
{
|
||||
"lecturerStat": "$scope.user.isLecturer",
|
||||
"campName": "$scope.campusName"
|
||||
}
|
||||
|
||||
if($scope.user.AcMail != null)
|
||||
{
|
||||
var fullMail = $scope.user.AcMail + $scope.campusObj.email_ending; // Holds the full academic email of the user
|
||||
|
||||
apiService.updateUser($scope.user.seToken, jsonUpdateUser).success(function(data)
|
||||
{
|
||||
|
||||
}).error(function()
|
||||
{
|
||||
// TODO Error
|
||||
console.log("Error occured on updateUser");
|
||||
});
|
||||
|
||||
console.log("Mail: " + fullMail);
|
||||
|
||||
apiService.sendValidationMail($scope.user.seToken, fullMail).success(function(data)
|
||||
{
|
||||
console.log("DONE - 200");
|
||||
|
@ -72,36 +91,38 @@ angular.module('SeHub')
|
|||
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
|
||||
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(ev));
|
||||
});
|
||||
}
|
||||
else // TODO Fix when success to show mdDialog until 'Got it' clicked
|
||||
{
|
||||
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
|
||||
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(ev));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
$scope.createCampus = function(ev)
|
||||
{
|
||||
$scope.createCampusClicked = true;
|
||||
|
||||
if(!$scope.isLecturer) // "!isLecturer" Means => I Am Lecturer; if i am a lecturer (when pressing -> getting last data value before pressing)
|
||||
{
|
||||
if($scope.user.campusSuffixMail != null)
|
||||
if($scope.user.campusMail != null)
|
||||
{
|
||||
validateEmail($scope.user.campusSuffixMail);
|
||||
validateEmail($scope.user.campusMail); // Verify the email according to "xxx@name.suffix"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
validateEmail = function(email) // TODO ADD IT
|
||||
validateEmail = function(email)
|
||||
{
|
||||
var result = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
|
||||
|
||||
console.log("Email: " + email);
|
||||
|
||||
if (!result.test(email))
|
||||
if (!result.test(email)) // TODO Fix when success to show mdDialog until 'Got it' clicked
|
||||
{
|
||||
console.log(email + ", Error in email, should alert");
|
||||
alert('Please provide a valid e-mail address');
|
||||
// alert('Please provide a valid e-mail address');
|
||||
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
|
||||
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(email));
|
||||
}
|
||||
|
||||
if(result.test(email))
|
||||
if(result.test(email)) // TODO Fix when success to show mdDialog until 'Got it' clicked
|
||||
{
|
||||
console.log("Im good");
|
||||
apiService.sendValidationMail($scope.user.seToken, email).success(function(data)
|
||||
|
@ -119,26 +140,4 @@ angular.module('SeHub')
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
// TODO FOR LATER - toast
|
||||
// TODO FOR LATER
|
||||
|
||||
// $scope.getPopWindowPosition = function()
|
||||
// {
|
||||
// return Object.keys($scope.toastPosition).filter(function(pos)
|
||||
// {
|
||||
// return $scope.toastPosition[pos];
|
||||
// }).join(' ');
|
||||
// };
|
||||
|
||||
// $scope.toastPosition =
|
||||
// {
|
||||
// bottom: false,
|
||||
// top: true,
|
||||
// left: false,
|
||||
// right: true
|
||||
// };
|
||||
|
||||
// TODO FOR LATER
|
||||
// TODO FOR LATER
|
||||
}]);
|
||||
|
|
78
templates/js/controllers/settingsController.js
Normal file
78
templates/js/controllers/settingsController.js
Normal file
|
@ -0,0 +1,78 @@
|
|||
angular.module('SeHub')
|
||||
.controller('settingsController', ['$scope', '$rootScope', 'dataService', 'apiService', '$cookies', '$location',
|
||||
function($scope, $rootScope, dataService, apiService, $cookies, $location) {
|
||||
|
||||
var token = $cookies['com.sehub.www'];
|
||||
|
||||
$scope.loadingData = true;
|
||||
$scope.isInRegisterMode = false;
|
||||
|
||||
$scope.title = "Settings"
|
||||
|
||||
apiService.getUserByToken(token).success(function(data) {
|
||||
if (data.message == 'No User Found') {
|
||||
console.error("No User Found!");
|
||||
}
|
||||
$scope.loadingData = false;
|
||||
$scope.user = data;
|
||||
console.log(data);
|
||||
if ($scope.user.isFirstLogin) {
|
||||
$scope.menuObj = {};
|
||||
$scope.isInRegisterMode = true;
|
||||
$scope.loadingData = false;
|
||||
$location.path('/register')
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$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";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DEBUG DATA
|
||||
*/
|
||||
$scope.courses = [{
|
||||
"courseName": "Advance Math",
|
||||
"campusName": "JCE",
|
||||
"startDate": {
|
||||
"year": 2015,
|
||||
"month": 4,
|
||||
"day": 3
|
||||
},
|
||||
"endDate": {
|
||||
"year": 2016,
|
||||
"month": 5,
|
||||
"day": 14
|
||||
},
|
||||
"taskFlag": false,
|
||||
"campus_avatar": "https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg"
|
||||
}];
|
||||
|
||||
$scope.campuses = [{
|
||||
'title': 'JCE',
|
||||
'email_ending': '@post.jce.ac.il',
|
||||
'master_user_id': 123453433341,
|
||||
'avatar_url': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg'
|
||||
}, {
|
||||
'title': 'Stanford',
|
||||
'email_ending': '@post.jce.ac.il',
|
||||
'master_user_id': 123453433341,
|
||||
'avatar_url': 'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcR9M4uQgaJP1zyiCGw-dK31hU8buWqeuOi9vTXBd4Y8hQcFTZqA'
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
]);
|
|
@ -3,15 +3,12 @@ var DEBUG = true;
|
|||
var service = angular.module('seHub.services', []);
|
||||
|
||||
service.factory('apiService', ['$http', function($http) {
|
||||
|
||||
|
||||
return {
|
||||
getUserByToken: function(token){
|
||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserByToken/" + token;
|
||||
req = {
|
||||
method : "GET",
|
||||
url : url
|
||||
|
||||
};
|
||||
return $http(req);
|
||||
},
|
||||
|
@ -36,9 +33,17 @@ service.factory('apiService', ['$http', function($http) {
|
|||
data: payload
|
||||
};
|
||||
|
||||
return $http(req);
|
||||
},
|
||||
updateUser: function(token, payLoad){
|
||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/updateUser/" + token;
|
||||
|
||||
req = {
|
||||
method: "POST",
|
||||
url: url,
|
||||
data: payLoad
|
||||
};
|
||||
return $http(req);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}]);
|
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));
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}]);
|
|
@ -3,7 +3,7 @@
|
|||
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
|
||||
</div>
|
||||
<md-content layout-padding>
|
||||
<md-card class="gray-font">
|
||||
<md-card class="gray-font fadeOutUp" ng-if="isEnterd">
|
||||
<div layout="row">
|
||||
<div class="spacer"></div>
|
||||
<div>
|
||||
|
@ -15,12 +15,54 @@
|
|||
<div class="spacer"></div>
|
||||
<div>
|
||||
<h1>Welcome To SE-Hub</h1>
|
||||
<p>
|
||||
This Is your Home Page
|
||||
</p>
|
||||
<P>Software Engineering Course Made Easy</P>
|
||||
v1.0
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
</div>
|
||||
</md-card>
|
||||
</md-content>
|
||||
<md-content layout-padding>
|
||||
<md-card>
|
||||
<div class = "feed" ><!-- layout-align="center center"> -->
|
||||
<div>
|
||||
<md-subheader class="md-no-sticky" style = "background-color:aliceblue; margin-right:0;">Messages</md-subheader>
|
||||
<md-list-item class="md-3-line" ng-repeat="item in messages">
|
||||
<div class="md-list-item-text" style="border: 1px solid black;">
|
||||
<img ng-src="{{user.avatar_url}}" class="roundUserAvatar" alt="{{item.who}}" style="margin:8px"/>
|
||||
<!-- Instead of "user.avatar.url" suppose to be "postedUserAvatarUrl" -->
|
||||
|
||||
<div class="spacer"></div>
|
||||
<br></br>
|
||||
<md-divider class = "feedContent">
|
||||
<h4>{{ item.who }}</h4>
|
||||
<h5>{{ item.what }}</h5>
|
||||
<h5><b>{{ item.notes }}</b></h5>
|
||||
<h6>{{ item.when }}</h6>
|
||||
</md-divider>
|
||||
</div>
|
||||
</md-list-item>
|
||||
</div>
|
||||
</md-card>
|
||||
</md-content>
|
||||
<div class="port_spacer"></div>
|
||||
<div>
|
||||
<md-content>
|
||||
<md-card style="margin:0">
|
||||
<!-- <md-list> -->
|
||||
<md-subheader class="md-no-sticky" style = "background-color:aliceblue; margin-right:0;">Tasks</md-subheader>
|
||||
<md-list-item class="md-3-line" ng-repeat="item in tasks">
|
||||
<!-- <img ng-src="{{item.face}}?{{$index}}" class="md-avatar" alt="{{item.who}}" /> -->
|
||||
<div class="md-list-item-text" style="border: 1px solid black;">
|
||||
<md-divider class = "feedContent">
|
||||
<h6><u><em>Ex: {{ item.ExNum }}</em></u></h6>
|
||||
<h5>Task Title: {{ item.notes }}</h5>
|
||||
<h6>Due Date: {{ item.dueDate }}</h6>
|
||||
</md-divider>
|
||||
</div>
|
||||
</md-list-item>
|
||||
</md-card>
|
||||
</md-content>
|
||||
</div>
|
||||
<!-- </md-card> -->
|
||||
</div>
|
|
@ -21,32 +21,28 @@
|
|||
</md-toolbar>
|
||||
<div layout="row" flex>
|
||||
<md-sidenav layout="column" class="md-sidenav-left md-whiteframe-z2" md-component-id="left" md-is-locked-open="$mdMedia('gt-sm')">
|
||||
<!-- <div class="user-pane-menu">
|
||||
<img ng-src="{{user.avatar_url}}" alt="">
|
||||
</div> -->
|
||||
<md-content class="se-menu">
|
||||
<div class="user-box" layout="row" layout-padding>
|
||||
<div flex="30"> <!-- Avatar -->
|
||||
<img ng-src="{{user.avatar_url}}" alt="">
|
||||
</div>
|
||||
<div class="user-data" layout="column" flex>
|
||||
<div>
|
||||
{{user.name}}
|
||||
<div ng-if="!isInRegisterMode">
|
||||
<div class="user-box" layout="row" layout-padding>
|
||||
<div flex="30"> <!-- Avatar -->
|
||||
<img ng-src="{{user.avatar_url}}" alt="">
|
||||
</div>
|
||||
<div>
|
||||
{{user.email}}
|
||||
<div class="user-data" layout="column" flex>
|
||||
<div>
|
||||
{{user.name}}
|
||||
</div>
|
||||
<div>
|
||||
{{user.email}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<a ng-repeat="item in menuItems" href="#">
|
||||
<li><i ng-class="item.icon"></i> {{item.title}}</li>
|
||||
<md-divider ng-if="!$last"></md-divider>
|
||||
</a>
|
||||
</ul>
|
||||
<div ng-if="loadingData">
|
||||
<md-progress-circular></md-progress-circular>
|
||||
|
||||
<ul>
|
||||
<a ng-repeat="item in menuItems" ng-click="menuClicked(item)">
|
||||
<li ng-class="[item.style]"><i ng-class="item.icon"></i> {{item.title}}</li>
|
||||
<md-divider ng-if="!$last"></md-divider>
|
||||
</a>
|
||||
</ul>
|
||||
</div>
|
||||
<div ng-if="isInRegisterMode"> <!-- User Needs To Register -->
|
||||
<md-card layout-padding>
|
||||
|
@ -85,10 +81,12 @@
|
|||
|
||||
<!-- 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>
|
||||
<script src="templates/js/controllers/homeController.js"></script>
|
||||
<script src="templates/js/controllers/settingsController.js"></script>
|
||||
<script src="templates/js/controllers/registerController.js"></script>
|
||||
|
||||
</body>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<div>
|
||||
<md-input-container ng-if="userHasNoName">
|
||||
<label>Full Name: </label>
|
||||
<input ng-model="user.name" required>
|
||||
<input ng-model="user.name" ng-minlength="1" required>
|
||||
</md-input-container>
|
||||
</div>
|
||||
<br></br>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<div class = "createCampus" ng-if="createCampusClicked">
|
||||
<md-input-container>
|
||||
<label>Academic Suffix Email</label>
|
||||
<input type="text" ng-model="user.campusSuffixMail" ng-minlength="1" required/>
|
||||
<input type="text" ng-model="user.campusMail" ng-minlength="1" required/>
|
||||
</md-input-container>
|
||||
<md-input-container>
|
||||
<label>Campus Name</label>
|
||||
|
@ -65,7 +65,7 @@
|
|||
<div>
|
||||
<md-input-container>
|
||||
<label>Academic Email</label>
|
||||
<input type="text" ng-model="user.AcMail" required/>
|
||||
<input type="text" ng-model="user.AcMail" ng-length="1" required/>
|
||||
</md-input-container>
|
||||
</div>
|
||||
</div>
|
||||
|
|
114
templates/views/settings.html
Normal file
114
templates/views/settings.html
Normal file
|
@ -0,0 +1,114 @@
|
|||
<div>
|
||||
<div class="loader" ng-if="loadingData">
|
||||
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
|
||||
</div>
|
||||
<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">
|
||||
<!-- User Profile Box -->
|
||||
<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>
|
||||
<!-- Start View Profile -->
|
||||
<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>
|
||||
<!-- End View Profile -->
|
||||
<!-- 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>
|
||||
<!-- End Edit Div -->
|
||||
</md-card>
|
||||
</div>
|
||||
<!-- Campuses & Classes Div -->
|
||||
<div flex>
|
||||
<md-card layout-padding>
|
||||
<h3><i class="fa fa-graduation-cap"></i> My Classes</h3>
|
||||
<div class="settingList">
|
||||
<div class="settingListRoot">
|
||||
<div ng-repeat="course in courses" class="settingListItem" layout="row">
|
||||
<div>
|
||||
<img alt="{{ person.name }}" ng-src="{{ course.campus_avatar }}" class="md-avatar" />
|
||||
</div>
|
||||
<div class="port_spacer">
|
||||
{{ course.courseName }} - <strong>IN</strong> {{course.campusName}}
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
<div>
|
||||
<md-button class="">
|
||||
X
|
||||
</md-button>
|
||||
</div>
|
||||
<md-divider ng-if="!$last"></md-divider>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3><i class="fa fa-university"></i> My Campuses</h3>
|
||||
|
||||
<div class="settingList">
|
||||
<div class="settingListRoot">
|
||||
<div ng-repeat="campus in campuses" class="settingListItem" layout="row">
|
||||
<div>
|
||||
<img alt="{{ person.name }}" ng-src="{{ campus.avatar_url }}" class="md-avatar" />
|
||||
</div>
|
||||
<div class="port_spacer">
|
||||
{{ campus.title }} -
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
<div>
|
||||
<md-button class="">
|
||||
X
|
||||
</md-button>
|
||||
</div>
|
||||
<md-divider ng-if="!$last"></md-divider>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</md-card>
|
||||
</div>
|
||||
<!-- End Campuses & Classes Div -->
|
||||
</div>
|
||||
</md-card>
|
||||
|
||||
|
||||
|
||||
</md-content>
|
||||
</div>
|
Loading…
Reference in a new issue