Merge pull request #93 from sagidayan/UI

Ui
This commit is contained in:
Sagi Dayan 2015-06-29 19:23:55 +03:00
commit d0ec66a192
9 changed files with 85 additions and 39 deletions

View file

@ -54,9 +54,9 @@ app.config(['$routeProvider', '$locationProvider',
templateUrl: 'templates/views/newTask.html', templateUrl: 'templates/views/newTask.html',
controller: 'newTasksController' controller: 'newTasksController'
}) })
.when('/projects/:classId', { .when('/class/:projectId', {
templateUrl: 'templates/views/projects.html', templateUrl: 'templates/views/class.html',
controller: 'projectsController' controller: 'classController'
}) })
.when('/newCourse', { .when('/newCourse', {
templateUrl: 'templates/views/newCourse.html', templateUrl: 'templates/views/newCourse.html',
@ -66,6 +66,10 @@ app.config(['$routeProvider', '$locationProvider',
templateUrl: 'templates/views/campuses.html', templateUrl: 'templates/views/campuses.html',
controller: 'campusesController' controller: 'campusesController'
}) })
.when('/project/:projectId', {
templateUrl: 'templates/views/project.html',
controller: 'projectController'
})
.when('/myProjects', { .when('/myProjects', {
templateUrl: 'templates/views/myProjects.html', templateUrl: 'templates/views/myProjects.html',
controller: 'myProjectsController' controller: 'myProjectsController'

View file

@ -1,14 +1,16 @@
angular.module('SeHub') angular.module('SeHub')
.controller('projectsController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) .controller('classController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{ {
var token = $cookies['com.sehub.www']; var token = $cookies['com.sehub.www'];
var classId = $routeParams.classId; var classId = $routeParams.projectId;
// var projectId = "";
$scope.projectsEmpty = true; $scope.projectsEmpty = true;
$scope.isCreateProjectClicked = false; $scope.isCreateProjectClicked = false;
$scope.submitNewCourseClicked = false; $scope.submitNewCourseClicked = false;
$scope.project = {}; $scope.project = {};
$scope.loadingData = true; $scope.loadingData = true;
$scope.isInCourse = false; $scope.isInCourse = false;
$scope.project.courseName = classId;
$scope.displayProjects = function() $scope.displayProjects = function()
{ {
@ -37,7 +39,7 @@ angular.module('SeHub')
$mdDialog.show($mdDialog.alert().title('Joined Course').content('You have successfully joined course.') $mdDialog.show($mdDialog.alert().title('Joined Course').content('You have successfully joined course.')
.ariaLabel('Join course alert dialog').ok('Lets Start!').targetEvent()) .ariaLabel('Join course alert dialog').ok('Lets Start!').targetEvent())
.then(function() { .then(function() {
$location.path('/projects/' + classId); // TODO TODO TODO $location.path('/class/' + classId); // TODO TODO TODO
}); // Pop-up alert }); // Pop-up alert
}).error(function(err) }).error(function(err)
{ {
@ -57,6 +59,7 @@ angular.module('SeHub')
$scope.submitNewProject = function() $scope.submitNewProject = function()
{ {
loadingData = true;
// debugger; // debugger;
var intClassId = parseInt(classId); var intClassId = parseInt(classId);
// console.log($scope); // console.log($scope);
@ -74,11 +77,13 @@ angular.module('SeHub')
apiService.create(token, jsonNewProj).success(function(data) apiService.create(token, jsonNewProj).success(function(data)
{ {
loadingData = false;
projectId = data.id;
$mdDialog.show($mdDialog.alert().title('Project Created').content('You have successfully created project.') $mdDialog.show($mdDialog.alert().title('Project Created').content('You have successfully created project.')
.ariaLabel('Project created alert dialog').ok('Great!').targetEvent()); .ariaLabel('Project created alert dialog').ok('Great!').targetEvent())
// .then(function() { .then(function() {
// $location.path('/projects/' + classId); // TODO TODO TODO $location.path('/project/' + projectId); // TODO TODO TODO
// }); // Pop-up alert }); // Pop-up alert
}).error(function(err) }).error(function(err)
{ {
@ -89,10 +94,10 @@ angular.module('SeHub')
} }
$scope.goToProject = function() $scope.goToProject = function(projectId)
{ {
console.log("projects only from classID: " + classId) console.log("projects only from classID: " + projectId)
$location.path('/thisProject' + classId); $location.path('/project/' + projectId);
} }
var init = function() var init = function()

View file

@ -18,7 +18,7 @@ angular.module('SeHub')
$scope.goToClass = function(classId) $scope.goToClass = function(classId)
{ {
console.log("Done! " + $scope.courses); console.log("Done! " + $scope.courses);
$location.path('/projects/' + classId.toString()); // Will display all the projects in this course $location.path('/class/' + classId.toString()); // Will display all the projects in this course
} }
$scope.chooseCampusClicked = function() $scope.chooseCampusClicked = function()

View file

@ -2,31 +2,39 @@ angular.module('SeHub')
.controller('myProjectsController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) .controller('myProjectsController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{ {
$scope.isEditPressed = false; $scope.isEditPressed = false;
$scope.myProjectsEmpty = false; $scope.loadingDate = true;
var token = $cookies['com.sehub.www']; $scope.myProjectsEmpty = true;
$scope.user = $scope.$parent.user; $scope.user = $scope.$parent.user;
var token = $cookies['com.sehub.www'];
console.log(token);
$scope.displayMyProjects = function() $scope.displayMyProjects = function()
{ {
apiService.getProjectsByUser(token).success(function(data) apiService.getProjectsByUser(token).success(function(data)
{ {
console.log("Success " + data); $scope.loadingDate = false;
$scope.myProjects = data; $scope.myProjects = data;
if($scope.myProjects != null && $scope.myProjects.length > 0)
{
$scope.myProjectsEmpty = false;
}
}).error(function(err) }).error(function(err)
{ {
console.log("Error: " + err); console.log("Error: " + err.message);
}); });
if($scope.myProjects === null)
{
$scope.myProjectsEmpty = true;
}
} }
$scope.goToMyProject = function() $scope.goToProject = function(projectId)
{ {
console.log("projects only from classID: " + classId) for (var i = 0; i < $scope.myProjects; i++)
$location.path('/thisProject' + classId); {
if($scope.myProjects.id === projectId)
{
console.log("project ID: " + projectId)
$location.path('/project/' + projectId);
}
};
} }
var init = function() var init = function()

View file

@ -0,0 +1,7 @@
angular.module('SeHub')
.controller('projectController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope',
function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{
}]);

View file

@ -1,5 +1,5 @@
<div class = "projects"> <div class = "class">
<h1 style="margin-left:15px"><i class="fa fa-graduation-cap"></i> Class {{project.title}}</h1> <h1 style="margin-left:15px"><i class="fa fa-graduation-cap"></i> Class {{project.courseName}}</h1>
<div layout-paddig layout-margin class="loader" ng-if="loadingData"> <div layout-paddig layout-margin class="loader" ng-if="loadingData">
<md-progress-circular md-mode="indeterminate"></md-progress-circular> <md-progress-circular md-mode="indeterminate"></md-progress-circular>
</div> </div>
@ -21,7 +21,7 @@
</div> </div>
</div> </div>
<div ng-if="!isInCourse" layout-padding layout-margin> <div ng-if="!isInCourse" layout-padding layout-margin>
<md-button ng-click = "joinCourse()" ng class = "md-raised md-primary"> Join Course</md-button> <md-button ng-click = "joinCourse()" ng class = "md-raised md-primary"> Join Class</md-button>
</div> </div>
<md-content layout-padding layout-margin> <md-content layout-padding layout-margin>
<md-button ng-click="createProjectClicked()" ng class="md-raised md-primary">Create Project</md-button> <md-button ng-click="createProjectClicked()" ng class="md-raised md-primary">Create Project</md-button>
@ -67,6 +67,9 @@
</div> </div>
<div layout-padding layout-margin> <div layout-padding layout-margin>
<md-button ng-click="submitNewProject()" ng class="md-raised md-primary">Submit Project</md-button> <md-button ng-click="submitNewProject()" ng class="md-raised md-primary">Submit Project</md-button>
<div layout-paddig layout-margin class="loader" ng-if="loadingData">
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
</div>
</div> </div>
</div> </div>
</md-card> </md-card>

View file

@ -114,10 +114,11 @@
<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>
<script src="templates/js/controllers/newTasksController.js"></script> <script src="templates/js/controllers/newTasksController.js"></script>
<script src="templates/js/controllers/projectsController.js"></script> <script src="templates/js/controllers/classController.js"></script>
<script src="templates/js/controllers/newCourseController.js"></script> <script src="templates/js/controllers/newCourseController.js"></script>
<script src="templates/js/controllers/campusesController.js"></script> <script src="templates/js/controllers/campusesController.js"></script>
<script src="templates/js/controllers/myProjectsController.js"></script> <script src="templates/js/controllers/myProjectsController.js"></script>
<script src="templates/js/controllers/projectController.js"></script>
</body> </body>
</html> </html>

View file

@ -1,12 +1,18 @@
<div class = "myProjects"> <div class = "myProjects">
<md-content layout-padding layout-margin> <h1 layout-margin style="margin-left:15px"><i class="fa fa-cube"></i> {{user.name}}'s projects</h1>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-cube"></i> {{user.name}}'s projects</h1> <div ng-if="loadingData" layout-paddig layout-margin class="loader">
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
</div>
<div ng-if = "myProjectsEmpty && !loadingData" layout-padding layout-margin>
You Are Not Related To Any Project.
</div>
<div ng-if="!myProjects">
<md-card class="cardAllProjects"> <md-card class="cardAllProjects">
<div flex = "99" layout = "row" ng-repeat = "t in holdArrays" value = "{{t}}" layout-padding> <div flex = "99" layout = "row" ng-repeat = "t in holdArrays" value = "{{t}}" layout-padding>
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" > <div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" >
<div ng-if = "!scope.myProjectsEmpty"> <div ng-if = "!scope.myProjectsEmpty">
<div ng-if="t.length != 1"> <div ng-if="t.length != 1">
<md-button ng-click = "goToMyProjects(project.id)" style="width:100%; height:32%;" layout-padding class = "md-raised" > <md-button ng-click="goToProject(project.id)" style="width:100%; height:32%;" layout-padding class = "md-raised">
<md-card style="width:97%;height:97%"> <md-card style="width:97%;height:97%">
<md-card-content> <md-card-content>
<h2 class="md-title">{{project.id}}</h2> <h2 class="md-title">{{project.id}}</h2>
@ -15,7 +21,7 @@
</md-button> </md-button>
</div> </div>
<div ng-if="t.length == 1"> <div ng-if="t.length == 1">
<md-button ng-click = "goToMyProjects(project.id)" style="width:32%; height:32%;" layout-padding class = "md-raised" > <md-button ng-click = "goToProject(project.id)" style="width:32%; height:32%;" layout-padding class = "md-raised">
<md-card style="width:97%;height:97%"> <md-card style="width:97%;height:97%">
<md-card-content> <md-card-content>
<h2 class="md-title">{{project.id}}</h2> <h2 class="md-title">{{project.id}}</h2>
@ -30,7 +36,8 @@
</div> </div>
</div> </div>
</div> </div>
</md-card>
</div>
<!-- <div flex ="99" class = "allProjectsShow" layout = "row" ng-repeat = "t in arrayHolder" value = "{{t}}"> <!-- <div flex ="99" class = "allProjectsShow" layout = "row" ng-repeat = "t in arrayHolder" value = "{{t}}">
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" layout-padding> <div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" layout-padding>
@ -44,10 +51,6 @@
You Do Not Have Any Project, You May Create One. You Do Not Have Any Project, You May Create One.
</div> </div>
</div> --> </div> -->
</md-card>
</md-content>
</div> </div>

View file

@ -0,0 +1,15 @@
<div class = "myClasses">
<md-content layout-padding layout-margin>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-cube"></i> Project</h1>
Yipi Kayea Mother Fraker
<div>
</div>
</md-content>
</div>