- Campuses -> Courses -> Projects

-* waiting for merge to get API from server
This commit is contained in:
Matan Bar Yosef 2015-06-24 21:35:21 +03:00
parent b19b60b58b
commit 0cce80ed98
10 changed files with 144 additions and 153 deletions

View file

@ -197,6 +197,18 @@ body.noscroll
border-radius: 1px black solid;
}*/
.allCampusesShow
{
overflow:hidden;
background-size: auto;
}
.campusCard
{
/*height:80%;*/
/*width:80%;*/
}
.gray-font
{
color: #7f7f7f;
@ -397,6 +409,11 @@ body.noscroll
border-color: solid red;
}
.cardAllCampuses
{
word-break: break-word;
}
.addMessage
{
font-size: 2em;

View file

@ -61,6 +61,10 @@ app.config(['$routeProvider', '$locationProvider',
.when('/newCourse', {
templateUrl: 'templates/views/newCourse.html',
controller: 'newCourseController'
})
.when('/campuses', {
templateUrl: 'templates/views/campuses.html',
controller: 'campusesController'
});
}
]);

View file

@ -35,13 +35,13 @@ angular.module('SeHub')
console.log("Student Mode!");
}
// apiService.getCourseByCampusName($scope.user.classes_id_list[0]).success(function(data)
// apiService.getCourseByCampusName(token).success(function(data)
// {
// console.log("Campus Name is ON! " + $scope.user.classes_id_list[0])
// console.log("Campus Name is ON! " + token)
// $scope.course = data;
// }).error(function()
// }).error(function(err)
// {
// console.log("Error on ===> getCourseByCampusName")
// console.log("Error ===> " + err + " ===> getCourseByCampusName")
// });

View file

@ -5,7 +5,6 @@ angular.module('SeHub')
$scope.isCourse = false;
$scope.isNewCourse = false;
$scope.newClassName = false;
// $scope.course.courseName = '';
$scope.course = {};
var token = $cookies['com.sehub.www'];
$scope.user.finalDate = '';
@ -24,6 +23,17 @@ angular.module('SeHub')
}
$scope.courses = ['SE', 'PC', 'Math', 'Calculus', 'Ivrit', 'English', 'Drugs'];
// apiService.getClassesByUser(token).success(function(data) // Get all the campuses
// {
// $scope.courses = data;
// }).error(function() {
// // TODO
// });
$scope.chooseCourseClicked = function()
{
$scope.isCourse = true;
@ -32,15 +42,7 @@ angular.module('SeHub')
$scope.createCourseClicked = function()
{
$scope.isNewCourse = true;
$scope.showMyClass = false;
console.log("create course Clicked!!");
}
$scope.showMyCourses = function()
{
$scope.showMyClass = true;
$scope.isNewCourse = false;
$scope.isNewCourse = !$scope.isNewCourse;
}
$scope.submitNewClassClicked = function()
@ -74,8 +76,10 @@ angular.module('SeHub')
console.log(err);
});
$mdDialog.show($mdDialog.alert().title('Course Created').content('You have created course successfully.')
.ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent());
// $window.location.href = 'templates/views/newCourse.html'; // TODO TODO TODO
.ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent())
.then(function() {
$window.location.href = 'templates/views/newCourse.html'; // TODO TODO TODO
}); // Pop-up alert
}
else

View file

@ -10,7 +10,14 @@ angular.module('SeHub')
}
$scope.projects = ['AMI', 'LULU', 'XIN Zhau', 'LUMI lu', 'Shimi', 'Azligi zligi', 'Drugs'];
// apiService.getProjectsByCourse(courseId).success(function(data) // Get all the campuses
// {
// $scope.projects = data;
// }).error(function() {
// // TODO
// });
}]);

View file

@ -14,26 +14,26 @@ angular.module('SeHub')
var token = $rootScope.seToken;
apiService.getUserByToken(token).success(function(data) // Get user token
{
$scope.user = data;
{
$scope.user = data;
if (data.message == 'No User Found')
console.error("No User Found!");
console.log(data);
if (data.message == 'No User Found')
console.error("No User Found!");
console.log(data);
if ($scope.user.name === ";") {
$scope.user.name = "";
$scope.user.name = $scope.user.username;
$scope.userHasNoName = true;
}
if ($scope.user.name === ";") {
$scope.user.name = "";
$scope.user.name = $scope.user.username;
$scope.userHasNoName = true;
}
apiService.getAllCampuses(token).success(function(data) // Get all the campuses
{
$scope.campuses = data;
}).error(function() {
// TODO
});
apiService.getAllCampuses(token).success(function(data) // Get all the campuses
{
$scope.campuses = data;
}).error(function() {
// TODO
});
});
$scope.dropdownClicked = function() {
if ($scope.campus) {

View file

@ -96,6 +96,34 @@ service.factory('apiService', ['$http', function($http) {
url : url,
data: payLoad
};
return $http(req);
},
getCampusesByUser: function(){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCampusesByUser/" + token;
req = {
method : "GET",
url : url
};
return $http(req);
},
},
getClassesByCourse: function(){ // Need to add camusName (ngRoute) ~ sagi //TODO
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/ClassesByCourse/" + token;
req = {
method : "GET",
url : url
};
return $http(req);
},
getProjectsByCourse: function(){ // Need to add courseID (ngRoute) ~ sagi //TODO
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getProjectByCourse/" + token;
req = {
method : "GET",
url : url
};
return $http(req);
}

View file

@ -116,6 +116,7 @@
<script src="templates/js/controllers/newTasksController.js"></script>
<script src="templates/js/controllers/projectsController.js"></script>
<script src="templates/js/controllers/newCourseController.js"></script>
<script src="templates/js/controllers/campusesController.js"></script>
</body>
</html>

View file

@ -2,50 +2,51 @@
<md-content layout-padding layout-margin>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-graduation-cap"></i> My Classes</h1>
</md-content>
<md-card flex = "99" class="cardAllcourses">
<div flex class = "allcoursesShow" ><!-- layout = "column"> -->
<div flex layout = "row" ng-repeat = "course in courses" value = "{{course}}" layout-padding>
<a href="http://localhost:8080/home#/projects" style="color:black; text-decoration:none;">
<md-card layout-padding flex class = "campusCard">
{{course}}
</md-card>
</a>
</div>
</div>
</md-card>
<div ng-if="user.isLecturer"> <!-- Lecturer Mode -->
<div layout="row">
<div layout-margin layout-padding>
<md-button ng-click="createCourseClicked()" ng class="md-raised md-primary">Create Class</md-button>
</div>
<div layout-margin layout-padding>
<md-button ng-click="showMyCourses()" ng class="md-raised md-primary">Show My Classes</md-button>
</div>
</div>
<div ng-if="isNewCourse">
<md-content>
<md-content layout-padding layout="row" layout-sm="column">
<md-input-container>
<label>User Name</label>
<input ng-model="user.name">
</md-input-container>
<md-input-container>
<label>Email</label>
<input ng-model="user.email" type="email">
</md-input-container>
</md-content>
<md-content layout-padding>
<form name="createNewCourseForm">
<div layout layout-sm="column">
<md-input-container style="width:80%">
<label flex = "50">Class Name</label>
<input ng-model="course.courseName" min-length="1" required>
</md-input-container>
<md-input-container flex = "20">
<label>Course Start Date</label>
<input type="date" ng-model="course.startDate" required>
</md-input-container>
<md-input-container flex = "20">
<label>Course Finish Date</label>
<input type="date" ng-model="course.endDate" required>
</md-input-container>
</div>
<div layout layout-sm="column">
<md-input-container flex = "50">
<label>Campus name</label>
<input ng-model="course.campusName">
</md-input-container>
</div>
</form>
<md-card layout-padding>
<form name="createNewCourseForm">
<div layout layout-sm="column">
<md-input-container flex = "50">
<label>Campus name</label>
<input ng-model="course.campusName" required>
</md-input-container>
</div>
<div layout layout-sm="column">
<md-input-container style="width:80%">
<label flex = "50">Class Name</label>
<input ng-model="course.courseName" min-length="1" required>
</md-input-container>
<md-input-container flex = "20">
<label>Course Start Date</label>
<input type="date" ng-model="course.startDate" required>
</md-input-container>
<md-input-container flex = "20">
<label>Course Finish Date</label>
<input type="date" ng-model="course.endDate" required>
</md-input-container>
</div>
</form>
</md-card>
</md-content>
<div layout-padding layout-margin>
<md-button ng-click="submitNewClassClicked()" class="md-raised md-primary">Submit New Class</md-button>
@ -57,91 +58,6 @@
<md-option ng-repeat="c in courses" value="{{c.course}}">{{c.course}}</md-option>
</md-select>
</div>
<!-- <md-content>
<div layout="row">
<div flex="65">
<md-card>
<p class = "messagesFeed">Messages</p>
</md-card>
</div>
<div flex="34">
<md-card>
<p class = "tasksFeed">Tasks</p>
</md-card>
</div>
</div>
<div layout="row">
<div flex="65">
<md-card>
<div class = "messagesContent">
<md-card ng-repeat = "msg in messages">
<div layout="column">
<div layout="row" layout-margin layout-padding>
<div flex="10" class="md-avatar">
<img ng-src="{{user.avatar_url}}" style="width:100%">
</div>
<div flex>
<div layout = "column">
<div>
<b>{{user.name}}</b>
</div>
<div>
class_name
</div>
</div>
</div>
</div>
<div>
<div flex="69" class="msgSent" layout-margin layout-padding>
{{msg.text}}
</div>
</div>
</div>
</md-card>
</div>
</md-card>
</div>
<div flex="34">
<md-card>
<p class = "tasksContent">
For Task 3 Press: <a href="http://localhost:8080/home#/tasks">Task #3</a>
<br></br>
For Task 4 Press: <a href="http://localhost:8080/home#/home">Task #4</a>
<br></br>
For Task 5 Press: <a href="http://localhost:8080/home#/home">Task #5</a>
<br></br>
For Task 6 Press: <a href="http://localhost:8080/home#/home">Task #6</a>
<br></br>
For Task 7 Press: <a href="http://localhost:8080/home#/home">Task #7</a>
<br></br>
For Task 8 Press: <a href="http://localhost:8080/home#/home">Task #8</a>
</p>
</md-card>
</div>
</div>
<div class ="addMessage" layout="row" layout-margin layout padding>
<div>
<md-button ng-click="addMessageClicked()" ng class="md-raised md-primary"><i class="fa fa-comments"></i></md-button>
</div>
<div ng-if="addMsg">
<md-select placeholder="Choose Course" ng-model="course" ng-click="chooseCourseClicked()" class="courseDropDown">
<md-option ng-repeat="c in courses" value="{{c.course}}">{{c.course}}</md-option>
</md-select>
</div>
</div>
<div ng-if="addMsg">
<div layout = "row" layout-margin layout padding layout-align = "left center">
<md-button ng-click="postMessageClicked()" ng class="md-raised md-primary">Post</md-button>
<md-button ng-click="clearAllClicked()" ng class="md-raised md-primary">Clear All</md-button>
</div>
<div class="port_spacer"></div>
<md-input-container>
<label> Write Your Desired Message Here And Press Post</label>
<input type="text" minlength="1" ng-model="msg.msgToAdd" required>
</md-input-container>
</div>
</md-content> -->
</div>
<div ng-if="isStudent"> <!-- Student Mode -->

View file

@ -1,6 +1,20 @@
<div class = "projects">
<h1 style="margin-left:15px"><i class="fa fa-cube"></i> Projects</h1>
<md-card flex = "99" class="cardAllProjects">
<div flex class = "allProjectsShow" layout = "column">
<div flex layout = "row" ng-repeat = "project in projects" value = "{{project}}" layout-padding>
<a href="http://localhost:8080/home#/home" style="color:black; text-decoration:none;">
<md-card layout-padding flex class = "projectCard">
{{project}}
</md-card>
</a>
</div>
</div>
</md-card>
<md-content layout-padding layout-margin>
<h1 style="margin-left:15px"><i class="fa fa-file-cube-o"></i> Projects</h1>
<md-button ng-click="createProjectClicked()" ng class="md-raised md-primary">Create Project</md-button>
</md-content>
</div>