Skip to content

Commit

Permalink
Clean up ngCart vs ngcart consistency
Browse files Browse the repository at this point in the history
Update README.md and package.json
  • Loading branch information
snapjay committed Aug 25, 2014
1 parent 2d20c6d commit 69266c7
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 43 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
logs/*
!.gitkeep
node_modules/
*/node_modules/
bower_components/
*/bower_components/
tmp
.DS_Store
.idea
Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@ You can see all 3 directive active on the page - Add items to the cart and chang

Setup
-----
1. Get the file
* Download and copy the `dist/ngCart.js` file
* git clone https://github.com/snapjay/ngcart.git
* bower install https://github.com/snapjay/ngcart.git
1. Get the package:
* bower install ngcart

2. Include the `dist/ngCart.js` file in your index.html
3. Include add `ngCart.js` as a dependency in you app
3. Include add `ngCart` as a dependency in your app in the angular.module

Something like this:
```
<!doctype html>
<html ng-app="myApp">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<script src="js/angular-ui-router.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script>
var myApp = angular.module('myApp', ['ngCart']);
</script>
Expand Down Expand Up @@ -93,7 +90,7 @@ The version number is determined from the `package.json` file inside the project

Download on Github
------------------
Version 0.0.1: https://github.com/snapjay/ngcart
https://github.com/snapjay/ngCart.git



Expand Down
1 change: 0 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"private": false,
"dependencies": {
"angular": "1.2.x",
"modernizr": ">=2.8.*",
"lodash": ">=2.4.*"
},

Expand Down
2 changes: 1 addition & 1 deletion dist/ngCart.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 25 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "ngCart",
"private": false,
"version": "0.0.1",
"description": "Really simple shopping cart for AngularJS",
"license": "MIT",
"tags":"AngularJS, directive, module, shopping cart, shopping basket",
"repository": {
"type": "git",
"url": "https://github.com/snapjay/ngcart.git"
},
"path": {
"app": "app"
},
"author": {
"name": "Dan Shreim",
"email": "[email protected]",
"url": "http://www.snapjay.com/"
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-watch": "~0.6.1"
}
"name": "ngCart",
"private": false,
"version": "0.0.1-rc.1",
"description": "Really simple shopping cart for AngularJS",
"license": "MIT",
"tags": "AngularJS, directive, module, shopping cart, shopping basket",
"repository": {
"type": "git",
"url": "https://github.com/snapjay/ngcart.git"
},
"path": {
"app": "app"
},
"author": {
"name": "Dan Shreim",
"email": "[email protected]",
"url": "http://www.snapjay.com/"
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-watch": "~0.6.1"
}
}
12 changes: 4 additions & 8 deletions src/ngcart.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
'use strict';

function log(a){
console.log (a);
}

angular.module('ngCart', [])

Expand All @@ -25,7 +22,7 @@ angular.module('ngCart', [])



if (Modernizr.localstorage && angular.isObject(JSON.parse(localStorage.getItem('cart')))) {
if (angular.isObject(JSON.parse(localStorage.getItem('cart')))) {


ngCart.$restoreCart(JSON.parse(localStorage.getItem('cart')));
Expand Down Expand Up @@ -131,7 +128,7 @@ angular.module('ngCart', [])

this.empty = function () {
this.$cart = [];
if (Modernizr.localstorage) localStorage.removeItem('cart');
localStorage.removeItem('cart');
}


Expand All @@ -147,13 +144,13 @@ angular.module('ngCart', [])
}

this.$saveCart = function () {
if (Modernizr.localstorage) localStorage.setItem('cart', JSON.stringify(this.getCart()));
localStorage.setItem('cart', JSON.stringify(this.getCart()));

}

}])

.factory('ngCartItem', ['ngCart', function (ngCart) {
.factory('ngCartItem', [function () {

var item = function (id, name, price, quantity, data) {
this.setId(id);
Expand Down Expand Up @@ -220,7 +217,6 @@ angular.module('ngCart', [])
this._quantity = 1;
console.info('Quantity must be an integer and was defaulted to 1');
}
ngCart.$saveCart();

}

Expand Down

0 comments on commit 69266c7

Please sign in to comment.