diff --git a/Readme.md b/Readme.md index 058ebbf..5597650 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,8 @@ ngPouch ======= +This is a fork from https://github.com/jrhicks/ngPouch + [PouchDB](http://pouchdb.com/) AngularJS adapter to monitor and manage replication status and 3-way data binding PouchDB supports live ( or "continious") replication where changes are propogated between the two databases as the changes occur. diff --git a/bower.json b/bower.json deleted file mode 100644 index bb9b1fe..0000000 --- a/bower.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "ng-pouch", - "version": "0.0.1", - "authors": [ - "jrhicks " - ], - "description": "Angular service to persist remote connection settings and maintain continuous replication", - "main": "ngPouch.js", - "keywords": [ - "pouchdb", - "angularjs" - ], - "license": "MIT", - "homepage": "https://github.com/jrhicks/ngPouch", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests", - ".idea", - "npm-debug.log" - ], - "dependencies": { - "pouchdb": "~3.0.6", - "ngStorage": "~0.1.8", - "angular-uuid-service": "~0.0.1" - } -} diff --git a/example/app.js b/example/app.js deleted file mode 100644 index 702c1f6..0000000 --- a/example/app.js +++ /dev/null @@ -1,7 +0,0 @@ -var express = require('express') -var app = express() - -app.use(express.static(__dirname + '/www')); -app.use(express.static(__dirname + '/bower_components')); -app.listen(process.env.PORT || 9292); - diff --git a/example/bower.json b/example/bower.json deleted file mode 100644 index 5c81cca..0000000 --- a/example/bower.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "ng-pouch-example", - "version": "0.0.1", - "homepage": "https://github.com/jrhicks/ngPouch", - "authors": [ - "jrhicks@cteh.com " - ], - "description": "Example app for ng-pouch", - "license": "MIT", - "private": true, - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "dependencies": { - "ng-pouch": "*", - "angular": "~1.3.0" - } -} diff --git a/example/config.json b/example/config.json deleted file mode 100644 index 9e26dfe..0000000 --- a/example/config.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/example/package.json b/example/package.json deleted file mode 100644 index 93e4c26..0000000 --- a/example/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "test-ng-pouch", - "version": "0.0.1", - "description": "Basic web app and pouchdb-server to test ng-pouch", - "main": "index.js", - "scripts": { - "app": "./node app.js", - "db": "./node_modules/.bin/pouchdb-server -p 5984 -m" - }, - "author": "Jeffrey Hicks", - "license": "MIT", - "dependencies": { - "express": "^4.10.0", - "pouchdb-server": "^0.5.2" - } -} diff --git a/example/www/app.js b/example/www/app.js deleted file mode 100644 index f7727b6..0000000 --- a/example/www/app.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; -angular.module('app', [ - 'app.todoCtrl', - 'app.pouch_conflict', - 'app.todo' -]) \ No newline at end of file diff --git a/example/www/index.html b/example/www/index.html deleted file mode 100644 index e228aaf..0000000 --- a/example/www/index.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
-

Create Todo

- -
- - -
- -

Edit Todos

- -
    -
  • - - - -
  • -
- -
- -
-

Replicate

-

- {{ng_pouch.status.localChanges}} Local Changes -

- - -
- - {{ng_pouch.statusTitle()}} -
- -
- - {{ng_pouch.statusTitle()}} -
- - -
-

Conflicts

- -
-{{conflicts | json}}
-
- - \ No newline at end of file diff --git a/example/www/pouch_conflict.js b/example/www/pouch_conflict.js deleted file mode 100644 index 752ca8d..0000000 --- a/example/www/pouch_conflict.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -// http://guide.couchdb.org/draft/conflicts.html - -angular.module('app.pouch_conflict', ['ngPouch']) - .service('PouchConflict', function(ngPouch) { - - return { - all: function() { - var x = function(doc) { - if(doc._conflicts) { - emit(doc._id, null); - } - } - return ngPouch.db.query(x, {include_docs: true, conflicts: true}); - - return ngPouch.db.query(x).then( - function(res) { - return ngPouch.db.allDocs({ - conflicts: true, - include_docs : true, - keys: res.rows.map(function(x) {return x.id}) - }); - } - ); - - } - -}}); \ No newline at end of file diff --git a/example/www/todo-ctrl.js b/example/www/todo-ctrl.js deleted file mode 100644 index 43bdd6b..0000000 --- a/example/www/todo-ctrl.js +++ /dev/null @@ -1,61 +0,0 @@ -angular.module('app.todoCtrl', ['ngPouch']) - .controller('TodoController', ['$scope', '$q', 'ngPouch','Todo', 'PouchConflict', - function($scope, $q, ngPouch, Todo, PouchConflict) { - - $scope.form = {}; - $scope.todos = []; - $scope.logged_in = false; - $scope.ng_pouch = ngPouch; - //ngPouch.reset(); - - ngPouch.publish(function() { - var p1 = Todo.all() - .then( function(results) { - $scope.todos = results["rows"]; - }); - - var p2 = PouchConflict.all() - .then ( function(results) { - $scope.conflicts = results; - - }); - return $q.all([p1,p2]); - }); - - $scope.updateTodo = function (todo) { - Todo.update(todo); - }; - - $scope.addTodo = function () { - Todo.add({text:$scope.todoText, done:false}); - $scope.todoText = ''; - }; - - $scope.remaining = function() { - var count = 0; - angular.forEach($scope.todos, function(todo) { - count += todo.doc.done ? 0 : 1; - }); - return count; - }; - - $scope.login = function() { - ngPouch.saveSettings({database:'http://localhost:5984/test20', - stayConnected: true }); - $scope.logged_in = true; - - }; - - $scope.logoff = function() { - ngPouch.logoff(); - $scope.logged_in = false; - }; - - - $scope.archive = function() { - angular.forEach($scope.todos, function(todo) { - Todo.destroy(todo); - }); - }; - - }]); \ No newline at end of file diff --git a/example/www/todo.css b/example/www/todo.css deleted file mode 100644 index 938000c..0000000 --- a/example/www/todo.css +++ /dev/null @@ -1,4 +0,0 @@ -.done-true { - text-decoration: line-through; - color: grey; -} \ No newline at end of file diff --git a/example/www/todo.js b/example/www/todo.js deleted file mode 100644 index a34016b..0000000 --- a/example/www/todo.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -angular.module('app.todo', ['ngPouch','uuid']) - .service('Todo', function(rfc4122, ngPouch, $rootScope) { - - return { - - destroy: function(obj) { - ngPouch.db.remove(obj.doc); - }, - - update: function(obj) { - ngPouch.db.put(obj.doc); - }, - - add: function(obj) { - obj._id = 'todo_'+rfc4122.v4(); - obj.doc_type = 'todo'; - obj.created_at = new Date(); - return ngPouch.db.put(obj); - }, - - all: function() { - var allTodos = function(doc) { - if (doc.doc_type === 'todo') { - emit(doc.created_at, doc._id); - } - } - return ngPouch.db.query(allTodos, {descending: true, include_docs : true}); - } - }; - }); \ No newline at end of file diff --git a/ngPouch.js b/ngPouch.js index e89e320..4e0b2f2 100644 --- a/ngPouch.js +++ b/ngPouch.js @@ -1,3 +1,4 @@ +(function () { //start closure 'use strict'; angular.module('ngPouch', ['angularLocalStorage']) @@ -489,4 +490,6 @@ angular.module('ngPouch', ['angularLocalStorage']) service.init(); return service }); + +})(); //end closure