Merge pull request #10 from viridianaJazel/issue-5

Add 404
Fixes #5
This commit is contained in:
Arturo Nunez 2017-01-19 15:47:02 -06:00 committed by GitHub
commit 837c8466f9
5 changed files with 75 additions and 13 deletions

View File

@ -32,11 +32,8 @@ module.exports = function(UserStory) {
return item.id == id;
})
if(file.length > 0){
file = file[0];
}else{
file = 'The file with id: '+ id +' does not exist.'
}
file = (file.length > 0)?file[0]:null;
return file;
};
@ -297,7 +294,12 @@ module.exports = function(UserStory) {
UserStory.findById = function(id, params, cb){
var userStory = getFileById(id);
parseUserStory(userStory, cb);
if(userStory){
parseUserStory(userStory, cb);
}else{
cb('File does not exist', null);
}
};//end find by id

View File

@ -2,8 +2,8 @@
(function(){
angular.module('dashboardProjectApp')
.controller('projectDetailController', ['$scope','$state', 'UserStory',
function($scope, $state, UserStory) {
.controller('projectDetailController', ['$scope','$state', 'UserStory', '$location',
function($scope, $state, UserStory, $location) {
$scope.taskId = $state.params.id;
$scope.openTasks = {};
@ -39,6 +39,7 @@
$scope.actualProject = {};
function getFile() {
UserStory.findById({id:$scope.taskId},
function success(userStory) {
$scope.userStory = userStory;
@ -48,6 +49,8 @@
$scope.actualProject[key] = $scope.userStory.tasks_status[key].projects[0]
}
}, function onError(error){
$location.path('/projectDetail/notFound/' + $scope.taskId);
});
};
@ -55,7 +58,6 @@
$scope.actualProject[idTask] = keyProject
}
getFile();
$scope.showMore = function(key){
$scope.showText[key] = true;
@ -69,13 +71,15 @@
window.location.href = "mailto:" + email + "?subject=Mail to " + email;
}
getFile();
}])
.filter('capitalize', function() {
return function(input) {
return (!!input) ? input.charAt(0).toUpperCase() + input.substr(1).toLowerCase() : '';
}
}).filter('removeDashes', function() {
})
.filter('removeDashes', function() {
return function(string) {
if (!angular.isString(string)) {

View File

@ -1,13 +1,25 @@
'use strict';
angular.module('dashboardProjectApp')
.config(function ($stateProvider) {
.config(function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('projectDetail', {
.state('error', {
url: '/projectDetail/notFound/:id',
templateUrl: 'app/projectDetail/views/notFound.html',
controller: function($scope, $state){
$scope.id = $state.params.id;
}
})
.state('projectDetail', {
url: '/projectDetail/:id',
templateUrl: 'app/projectDetail/views/projectDetail.html',
controller: 'projectDetailController'
})
})
});

View File

@ -42,3 +42,29 @@
table tr.separator { height: 30px; }
.big-title{
font-size: 80px;
text-align: center;
padding-top: 40px;
font-weight: bolder;
color: #767676;
}
.big-subtitle{
text-align: center;
font-size: 22px;
font-weight: normal;
color: #767676;
}
.focus-title{
font-weight: bolder;
color: #414141;
}
.middle-subtitle{
text-align: center;
font-size: 16px;
padding-top: 10px;
color: #767676;
}

View File

@ -0,0 +1,18 @@
<div class="views-details">
<div class="big-title">
404
</div>
<div class="big-subtitle">
The Tracker with Id <span class="focus-title">{{id}}</span> does not exist. Are you sure it is spelled correctly?
</div>
<div class="middle-subtitle">
You can try return to the <a href="/projectList">list of trackers</a> and look for it
</div>
</div>