This repository was archived by the owner on Mar 7, 2023. It is now read-only.
forked from angular/angular-seed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to AngularJS 1.0.5, jQuery 1.9, Bootstrap 2.3
- Loading branch information
1 parent
209f4f6
commit 08a57aa
Showing
31 changed files
with
136 additions
and
18,452 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
/*global ProjectCreateCtrl ProjectEditCtrl ProjectListCtrl */ | ||
angular.module('main', ['resProject']). | ||
/*global angular*/ | ||
angular.module('main', ['nav', 'project']). | ||
config(function ($routeProvider) { | ||
'use strict'; | ||
|
||
$routeProvider. | ||
when('/', { templateUrl: 'partials/home.html' }). | ||
when('/about', { templateUrl: 'partials/about.html' }). | ||
when('/contact', { templateUrl: 'partials/contact.html' }). | ||
when('/project', { controller: ProjectListCtrl, templateUrl: 'partials/project/list.html' }). | ||
when('/project/edit/:projectId', { controller: ProjectEditCtrl, templateUrl: 'partials/project/detail.html' }). | ||
when('/project/new', { controller: ProjectCreateCtrl, templateUrl: 'partials/project/detail.html' }). | ||
when('/project', { | ||
controller: 'ProjectListCtrl', | ||
templateUrl: 'partials/project/list.html' | ||
}). | ||
when('/project/edit/:projectId', { | ||
controller: 'ProjectEditCtrl', | ||
templateUrl: 'partials/project/detail.html' | ||
}). | ||
when('/project/new', { | ||
controller: 'ProjectCreateCtrl', | ||
templateUrl: 'partials/project/detail.html' | ||
}). | ||
otherwise({ redirectTo: '/' }); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,25 @@ | ||
function NavCtrl($scope, $location) { | ||
/*global angular*/ | ||
(function () { | ||
'use strict'; | ||
|
||
$scope.isUrl = function (path, className) { | ||
if ($location.path() === path) { | ||
return className; | ||
} | ||
return ""; | ||
}; | ||
angular. | ||
module('nav', []). | ||
controller('NavController', [ | ||
'$scope', '$location', | ||
function ($scope, $location) { | ||
|
||
$scope.hasUrl = function (path, className) { | ||
if ($location.path().search(path) === 0) { | ||
return className; | ||
} | ||
return ""; | ||
}; | ||
} | ||
NavCtrl.$inject = ['$scope', '$location']; | ||
$scope.isUrl = function (path, className) { | ||
if ($location.path() === path) { | ||
return className; | ||
} | ||
return ""; | ||
}; | ||
|
||
$scope.hasUrl = function (path, className) { | ||
if ($location.path().search(path) === 0) { | ||
return className; | ||
} | ||
return ""; | ||
}; | ||
}]); | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
function ProjectCreateCtrl($scope, $location, Project) { | ||
/*global angular*/ | ||
(function () { | ||
'use strict'; | ||
|
||
$scope.save = function () { | ||
Project.save($scope.project, function (project) { | ||
$location.path('/project'); | ||
}); | ||
}; | ||
} | ||
angular.module('project'). | ||
controller('ProjectCreateCtrl', [ | ||
'$scope', '$location', 'Project', | ||
function ($scope, $location, Project) { | ||
$scope.save = function () { | ||
Project.save($scope.project, function (project) { | ||
$location.path('/project'); | ||
}); | ||
}; | ||
}]); | ||
}()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,33 @@ | ||
function ProjectEditCtrl($scope, $location, $routeParams, Project) { | ||
/*global angular*/ | ||
(function () { | ||
'use strict'; | ||
|
||
var self = this; | ||
angular.module('project'). | ||
controller('ProjectEditCtrl', [ | ||
'$scope', '$location', '$routeParams', 'Project', | ||
function ($scope, $location, $routeParams, Project) { | ||
var self = this; | ||
|
||
Project.get({ id: $routeParams.projectId }, function (project) { | ||
self.original = project; | ||
$scope.project = new Project(self.original); | ||
}); | ||
Project.get({ id: $routeParams.projectId }, function (project) { | ||
self.original = project; | ||
$scope.project = new Project(self.original); | ||
}); | ||
|
||
$scope.isClean = function () { | ||
return angular.equals(self.original, $scope.project); | ||
}; | ||
$scope.isClean = function () { | ||
return angular.equals(self.original, $scope.project); | ||
}; | ||
|
||
$scope.destroy = function () { | ||
self.original.destroy(function () { | ||
$location.path('/project'); | ||
}); | ||
}; | ||
$scope.destroy = function () { | ||
self.original.destroy(function () { | ||
$location.path('/project'); | ||
}); | ||
}; | ||
|
||
$scope.save = function () { | ||
$scope.project.update(function () { | ||
$location.path('/project'); | ||
}); | ||
}; | ||
}]); | ||
}()); | ||
|
||
$scope.save = function () { | ||
$scope.project.update(function () { | ||
$location.path('/project'); | ||
}); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
function ProjectListCtrl($scope, Project) { | ||
/*global angular*/ | ||
(function () { | ||
'use strict'; | ||
|
||
$scope.projects = Project.query(); | ||
} | ||
angular.module('project'). | ||
controller('ProjectListCtrl', [ | ||
'$scope', 'Project', | ||
function ($scope, Project) { | ||
$scope.projects = Project.query(); | ||
}]); | ||
}()); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
angular.module('resProject', ['ngResource']). | ||
factory('Project', function ($resource) { | ||
var Project = $resource('api/project/:id', {}); | ||
/*global angular*/ | ||
(function () { | ||
'use strict'; | ||
|
||
Project.prototype.update = function (cb) { | ||
return Project.save({ id: this._id }, | ||
angular.extend({}, this, { _id: undefined }), cb); | ||
}; | ||
angular.module('project', ['ngResource']). | ||
factory('Project', [ | ||
'$resource', | ||
function ($resource) { | ||
var Project = $resource('api/project/:id', {}); | ||
|
||
Project.prototype.destroy = function (cb) { | ||
return Project.remove({ id: this._id }, cb); | ||
}; | ||
Project.prototype.update = function (cb) { | ||
return Project.save({ id: this._id }, | ||
angular.extend({}, this, { _id: undefined }), cb); | ||
}; | ||
|
||
return Project; | ||
}); | ||
Project.prototype.destroy = function (cb) { | ||
return Project.remove({ id: this._id }, cb); | ||
}; | ||
|
||
return Project; | ||
}]); | ||
}()); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.