Skip to content
This repository was archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
Update to AngularJS 1.0.5, jQuery 1.9, Bootstrap 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankDeGroot committed Feb 24, 2013
1 parent 209f4f6 commit 08a57aa
Show file tree
Hide file tree
Showing 31 changed files with 136 additions and 18,452 deletions.
17 changes: 6 additions & 11 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,19 @@
<meta name="description" content="Frank's HTML5 SPA Angular Playground">
<meta name="viewport" content="width=device-width">

<!--<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">-->
<link href="//netdna.bootstrapcdn.com/bootswatch/2.1.1/cosmo/bootstrap.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css" rel="stylesheet">
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-responsive.min.css" rel="stylesheet">

<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
<!--<script src="//angular-ui.github.com/bootstrap/ui-bootstrap-tpls-0.1.0.js"></script>-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<!--<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script>-->
<script src="lib/bootstrap/bootstrap.min.js"></script>
<!--<script src="lib/bootstrap/bootstrap.js"></script>-->
<!--<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>-->
<script src="lib/angular/angular.js"></script>
<!--<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular-resource.min.js"></script>-->
<script src="lib/angular/angular-resource.js"></script>
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/js/bootstrap.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular-resource.min.js"></script>

<!--<script src="js/plugins.js"></script>-->

Expand Down Expand Up @@ -59,7 +54,7 @@
</a>
<a class="brand" href="#">Gaisberg</a>
<div class="nav-collapse collapse">
<ul class="nav" ng-controller="NavCtrl">
<ul class="nav" ng-controller="NavController">
<li ng-class="isUrl('/', 'active')"><a href="#">Home</a></li>
<li ng-class="isUrl('/about', 'active')"><a href="#/about">About</a></li>
<li ng-class="isUrl('/contact', 'active')"><a href="#/contact">Contact</a></li>
Expand Down
19 changes: 14 additions & 5 deletions app/js/app.js
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: '/' });
});
12 changes: 0 additions & 12 deletions app/js/controllers.js

This file was deleted.

37 changes: 22 additions & 15 deletions app/js/ctrl/nav.js
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 "";
};
}]);
}());
21 changes: 14 additions & 7 deletions app/js/ctrl/project/create.js
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');
});
};
}]);
}());

47 changes: 27 additions & 20 deletions app/js/ctrl/project/edit.js
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');
});
};
}
12 changes: 9 additions & 3 deletions app/js/ctrl/project/list.js
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();
}]);
}());
11 changes: 0 additions & 11 deletions app/js/directives.js

This file was deleted.

10 changes: 0 additions & 10 deletions app/js/filters.js

This file was deleted.

31 changes: 19 additions & 12 deletions app/js/res/project.js
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;
}]);
}());
9 changes: 0 additions & 9 deletions app/js/services.js

This file was deleted.

Loading

0 comments on commit 08a57aa

Please sign in to comment.