Merge pull request #100 from sagidayan/UI

Ui
This commit is contained in:
Sagi Dayan 2015-06-29 21:01:51 +03:00
commit 15172f9687
6 changed files with 19 additions and 27 deletions

View file

@ -54,7 +54,7 @@ app.config(['$routeProvider', '$locationProvider',
templateUrl: 'templates/views/newTask.html',
controller: 'newTasksController'
})
.when('/class/:projectId', {
.when('/class/:classId/:className', {
templateUrl: 'templates/views/class.html',
controller: 'classController'
})

View file

@ -2,19 +2,18 @@ angular.module('SeHub')
.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 classId = $routeParams.projectId;
// var projectId = "";
var classId = $routeParams.classId;
$scope.project = {};
$scope.project.courseName = $routeParams.className;
$scope.projectsEmpty = true;
$scope.isCreateProjectClicked = false;
$scope.submitNewCourseClicked = false;
$scope.project = {};
$scope.loadingData = true;
$scope.isInCourse = false;
$scope.project.courseName = classId;
$scope.displayProjects = function()
{
console.log("in displayProjecs!!! ");
apiService.getProjectsByCourse(token, classId).success(function(data) // Get all the campuses
{
$scope.loadingData = false;

View file

@ -15,10 +15,10 @@ angular.module('SeHub')
$scope.campusId;
var campusId = $routeParams.campusId;
$scope.goToClass = function(classId)
$scope.goToClass = function(classId, className)
{
console.log("Done! " + $scope.courses);
$location.path('/class/' + classId.toString()); // Will display all the projects in this course
console.log("Done! " + className);
$location.path('/class/' + classId.toString() + '/' + className); // Will display all the projects in this course
}
$scope.chooseCampusClicked = function()
@ -82,7 +82,8 @@ angular.module('SeHub')
$mdDialog.show($mdDialog.alert().title('Course Created').content('You have created course successfully.')
.ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent())
.then(function() {
$location.path('/newCourse'); // TODO TODO TODO
// $location.path('/newCourse'); // TODO TODO TODO
$location.path('/class/' + data.id + '/' + data.courseName); // Will display all the projects in this course
}); // Pop-up alert
}).error(function(err)
{

View file

@ -25,20 +25,12 @@ angular.module('SeHub')
{
console.log("Error: " + err.message);
});
}
$scope.goToProject = function(projectId)
{
for (var i = 0; i < $scope.myProjects; i++)
{
if($scope.myProjects.id === projectId)
{
console.log("project ID: " + projectId)
$location.path('/project/' + projectId);
}
};
}
var init = function()
{

View file

@ -7,21 +7,21 @@
<div flex = "32" layout = "column" ng-repeat = "course in t" value = "{{course}}" >
<div ng-if = "!scope.coursesEmpty">
<div ng-if="t.length != 1">
<md-button ng-click = "goToClass(course.id)" style="width:100%; height:32%;" layout-padding class = "md-raised" >
<md-card style="width:97%;height:97%">
<md-button ng-click = "goToClass(course.id, course.courseName)" style="width:100%; height:32%;" layout-padding class = "md-raised" >
<div style="width:97%;height:97%">
<md-card-content>
<h2 class="md-title">{{course.courseName}}</h2> <!-- Should Be "course.title" -->
</md-card-content>
</md-card>
</div>
</md-button>
</div>
<div ng-if="t.length == 1">
<md-button ng-click = "goToClass(course.id)" style="width:32%; height:32%;" layout-padding class = "md-raised" >
<md-card style="width:97%;height:97%">
<md-button ng-click = "goToClass(course.id, course.courseName)" style="width:32%; height:32%;" layout-padding class = "md-raised" >
<div style="width:97%;height:97%">
<md-card-content>
<h2 class="md-title">{{course.courseName}}</h2> <!-- Should Be "course.title" -->
</md-card-content>
</md-card>
</div>
</md-button>
</div>
</div>

View file

@ -13,7 +13,7 @@
<div ng-if="t.length != 1">
<md-button ng-click="goToProject(project.id)" style="width:100%; height:32%;" layout-padding class = "md-raised">
<md-card-content>
<h2 class="md-title">{{project.projectName}}</h2>
{{project.projectName}}
<div layout-align="center center" style=" width:70%;">
<canvas layout-padding layout-margin id="project.projectName" class="chart chart-bar" data="project.info.stats.macro.data" labels="project.info.stats.macro.labels"></canvas>
</div>
@ -24,7 +24,7 @@
<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-content>
<h2 class="md-title">{{project.projectName}}</h2>
{{project.projectName}}
<canvas layout-padding layout-margin id="project.projectName" class="chart chart-bar" data="project.info.stats.macro.data"
labels="project.info.stats.macro.labels"></canvas>
</md-card-content>