diff --git a/Gruntfile.js b/Gruntfile.js index ae50c28..82fd306 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -18,7 +18,7 @@ var proxyConfig = { } }; -var LIVERELOAD_PORT = 35729; +var LIVERELOAD_PORT = 35728; var SERVER_PORT = 9000; //var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT}); var mountFolder = function (connect, dir) { @@ -72,7 +72,11 @@ module.exports = function (grunt) { options: { livereload: '<%= connect.options.livereload %>' }, - files: ['<%= yeoman.app %>/{,**/}*.html', '.tmp/styles/{,*/}*.css', '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'], + files: [ + '<%= yeoman.app %>/{,**/}*.html', + '.tmp/styles/{,*/}*.css', + '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' + ], tasks: ['ngtemplates'] } }, diff --git a/app/scripts/app.coffee b/app/scripts/app.coffee index 98086de..6a902b1 100644 --- a/app/scripts/app.coffee +++ b/app/scripts/app.coffee @@ -28,7 +28,7 @@ app = angular.module('angularCmsApp', [ 'mgcrea.ngStrap' #'cms.Templates' ]) - .config ($routeProvider) -> + .config ($routeProvider) -> #Resolve routes routeResolver = # I will cause a 1 second delay @@ -36,7 +36,7 @@ app = angular.module('angularCmsApp', [ delay = $q.defer() $timeout delay.resolve, 1000 delay.promise - + #Router Config $routeProvider .when '/', diff --git a/app/scripts/controllers/pages.coffee b/app/scripts/controllers/pages.coffee index 0695631..7524625 100644 --- a/app/scripts/controllers/pages.coffee +++ b/app/scripts/controllers/pages.coffee @@ -1,9 +1,27 @@ 'use strict' angular.module('angularCmsApp') - .controller 'PagesCtrl', ($scope) -> + .controller 'PagesCtrl', ($scope, DataService) -> $scope.awesomeThings = [ 'HTML5 Boilerplate' 'AngularJS' 'Karma' ] + $scope.page = {} + #Select user + $scope.selectPage = (p) -> + $scope.page = p + + #Get users + $scope.getPages = () -> + DataService.fetch('pages').then((res) -> + $scope.pages = res.data + ) + + #Add user to database + $scope.save = (p) -> + DataService.save('pages', p).then((data) -> + $scope.getPages() + $scope.page = {} + console.log(data) + ) diff --git a/app/scripts/controllers/users.coffee b/app/scripts/controllers/users.coffee index 380f7bb..fe81cbc 100644 --- a/app/scripts/controllers/users.coffee +++ b/app/scripts/controllers/users.coffee @@ -5,28 +5,28 @@ angular.module('angularCmsApp').controller('UsersCtrl', ($scope, DataService) -> 'AngularJS' 'Karma' ] - - $scope.user = + + $scope.user = username: null email: null password: null role: null created: new Date() modified: new Date() - metadata: + metadata: avatar: '' name: null aboue: null - + #Hold the users $scope.users = [] - + #Holds the user groups $scope.groups = ['Admin', 'Member', 'Public'] $scope.getGroups = () -> - DataService.fetch('groups').then((data) -> - $scope.groups = data + DataService.fetch('groups').then((res) -> + $scope.groups = res.data console.log(data) ) @@ -36,8 +36,8 @@ angular.module('angularCmsApp').controller('UsersCtrl', ($scope, DataService) -> #Get users $scope.getUsers = () -> - DataService.fetch('users').then((data) -> - $scope.users = data + DataService.fetch('users').then((res) -> + $scope.users = res.data $scope.getGroups() unless $scope.groups ) @@ -46,7 +46,7 @@ angular.module('angularCmsApp').controller('UsersCtrl', ($scope, DataService) -> ask = confirm "Delete #{user.email}?" if ask - DataService.destroy('users', user).then((data) -> + DataService.destroy('users', user).then((res) -> $scope.users.pop(index) $scope.getUsers() ) @@ -55,9 +55,10 @@ angular.module('angularCmsApp').controller('UsersCtrl', ($scope, DataService) -> $scope.addUser = (user) -> DataService.save('users', user).then((data) -> $scope.getUsers() - #$scope.users.push(user) unless user._id + $scope.users.push(user) unless user._id $scope.user = {} + console.log(data) $('#user-modal').modal('hide') ) - + ) \ No newline at end of file diff --git a/app/styles/main.css b/app/styles/main.css index 50318c5..26c7a87 100755 --- a/app/styles/main.css +++ b/app/styles/main.css @@ -163,7 +163,7 @@ html { } .cms-sidebar.closed .well { - width: 45px; + width: 62px; } diff --git a/app/views/_footer.html b/app/views/_footer.html index e42f934..e7de602 100644 --- a/app/views/_footer.html +++ b/app/views/_footer.html @@ -8,4 +8,9 @@ Version {{App.version}}

- \ No newline at end of file + + +
+ +
{{App.config}}
+
{{App.session}}
diff --git a/app/views/pages.html b/app/views/pages.html index 6e0d103..1101a21 100755 --- a/app/views/pages.html +++ b/app/views/pages.html @@ -1,47 +1,59 @@
-
- -
-
-
- +
+ + +
+
+
+ + + + + + + + - - Permlink: http://jonniespratley.me/?page_id=83 - - -
- h1 - h2 - h3 -
+ + + - - -
-
-
- Publish -
-
-
    +
+ + + + + + + +
#PageBodyStatus
{{page._id}}{{page.title}}{{page.body}}{{page.publish}}{{page.visibility}}
+
+
+
+
+
+ + + Permlink: http://{{App.baseurl}}/?page_id={{page.slug}} + +
+ +
+
+
  • Status: Published
  • Visibility: Public
-
- -
-
-
-
- - + + +
+ + + + diff --git a/app/views/users.html b/app/views/users.html index 3951581..efed6e2 100755 --- a/app/views/users.html +++ b/app/views/users.html @@ -1,9 +1,10 @@

Users -

+ +
@@ -11,37 +12,39 @@

Users
- - - - - - - - + + + + + + + + - - - - - - - + + + + + + - + + +
E-mailUsernameActiveCreatedActions
E-mailActiveCreatedActions
- - {{user.email}} - {{ user.username }} - - {{user.active}} {{user.created | date:'medium'}} +
+ + {{user.email}} + {{ user.username }} + {{group}} + {{user.active}} {{user.created | date:'medium'}}
- -
@@ -63,80 +66,94 @@

- -
- + + +
+ +
+
+ + +
+ + +
+ +
+
+
+ + +
+ +
+
+ + +
+ + +
+
+ -
- -
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
- -
- -
-
-
- -
- -
-
- -
-
- -
-
-
-
- - - - +
+ +
+ +
+ + +
+ +
+
+
+ + +
+ +
+
+ + +
+ +
+ + + + + + + + + + diff --git a/package.json b/package.json index 1de211d..fe2f900 100755 --- a/package.json +++ b/package.json @@ -1,110 +1,110 @@ { - "name": "angular-cms", - "version": "0.0.1", - "description": "This is a lightweight CMS built with Angular.js, Twitter Bootstrap and Node.js.", - "author": "Jonnie Spratley", - "license": "MIT", - "readmeFilename": "README.md", - "homepage": "https://github.com/jonniespratley/angular-cms", - "main": "Gruntfile.js", - "bugs": { - "url": "https://github.com/jonniespratley/angular-cms/issues" - }, - "directories": { - "doc": "docs", - "test": "test" - }, - "repository": { - "type": "git", - "url": "https://github.com/jonniespratley/angular-cms.git" - }, - "keywords": [ - "angular", - "grunt", - "angular-cms", - "yeoman" - ], - "dependencies": { - "body-parser": "^1.9.3", - "body-parser-json": "^1.9.2", - "colors": "~1.0.0", - "easyimage": "~1.0.0", - "emailjs": "~0.3.6", - "express": "~4.0.0", - "http-proxy": "^1.3.0", - "jps-ds": "0.0.1", - "jquery": "~2.1.0", - "jquery-file-upload-middleware": "~0.1.1", - "json-proxy": "^0.3.0", - "logfmt": "~1.2.0", - "markdown": "~0.5.0", - "mongodb": "*", - "mongoose": "*", - "promised-io": "~0.3.4", - "request": "~2.49.0", - "socket.io": "~1.2.1" - }, - "devDependencies": { - "chai": "^1.10.0", - "connect-proxy": "~1.0.2", - "grunt": "~0.4.4", - "grunt-angular-templates": "~0.5.7", - "grunt-autoprefixer": "~2.0.0", - "grunt-bower-install": "~1.6.0", - "grunt-concurrent": "~1.0.0", - "grunt-connect-proxy": "~0.1.10", - "grunt-contrib-clean": "^0.6.0", - "grunt-contrib-coffee": "~0.12.0", - "grunt-contrib-compass": "~1.0.1", - "grunt-contrib-concat": "~0.5.0", - "grunt-contrib-connect": "~0.9.0", - "grunt-contrib-copy": "~0.7.0", - "grunt-contrib-cssmin": "~0.10.0", - "grunt-contrib-htmlmin": "~0.3.0", - "grunt-contrib-jasmine": "~0.8.1", - "grunt-contrib-jshint": "~0.10.0", - "grunt-contrib-less": "~0.12.0", - "grunt-contrib-uglify": "~0.6.0", - "grunt-contrib-watch": "~0.6.0", - "grunt-google-cdn": "^0.4.3", - "grunt-jasmine-node": "~0.2.1", - "grunt-karma": "^0.9.0", - "grunt-karma-coveralls": "^2.5.1", - "grunt-mocha-test": "^0.12.4", - "grunt-newer": "~0.8.0", - "grunt-ngdocs": "~0.2.6", - "grunt-ngmin": "0.0.3", - "grunt-protractor-runner": "~1.1.4", - "grunt-protractor-webdriver": "~0.2.0", - "grunt-rev": "~0.1.0", - "grunt-svgmin": "~0.2.0", - "grunt-usemin": "~2.0.2", - "jasmine-core": "^2.1.2", - "jasmine-node": "~1.14.5", - "jasmine-reporters": "^1.0.1", - "jshint-stylish": "~1.0.0", - "karma": "^0.12.28", - "karma-chrome-launcher": "^0.1.5", - "karma-coverage": "^0.2.6", - "karma-jasmine": "^0.3.1", - "karma-ng-html2js-preprocessor": "~0.1", - "karma-ng-scenario": "~0.1", - "karma-phantomjs-launcher": "~0.1", - "load-grunt-tasks": "~1.0.0", - "mocha": "~2.0.1", - "protractor": "^1.0.0", - "supertest": "^0.15.0", - "time-grunt": "~1.0.0" - }, - "peerDependencies": { - "grunt": "0.4.x", - "karma": "~0.12.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "grunt test", - "start": "node web.js" - } + "name": "angular-cms", + "version": "0.0.1", + "description": "This is a lightweight CMS built with Angular.js, Twitter Bootstrap and Node.js.", + "author": "Jonnie Spratley", + "license": "MIT", + "readmeFilename": "README.md", + "homepage": "https://github.com/jonniespratley/angular-cms", + "main": "Gruntfile.js", + "bugs": { + "url": "https://github.com/jonniespratley/angular-cms/issues" + }, + "directories": { + "doc": "docs", + "test": "test" + }, + "repository": { + "type": "git", + "url": "https://github.com/jonniespratley/angular-cms.git" + }, + "keywords": [ + "angular", + "grunt", + "angular-cms", + "yeoman" + ], + "dependencies": { + "body-parser": "^1.9.3", + "body-parser-json": "^1.9.2", + "colors": "~0.6.2", + "easyimage": "~0.1.6", + "emailjs": "~0.3.6", + "express": "~3.4.6", + "http-proxy": "^1.3.0", + "jps-ds": "0.0.1", + "jquery": "~2.1.0", + "jquery-file-upload-middleware": "~0.1.1", + "jshint-stylish": "~0.1.5", + "json-proxy": "^0.3.0", + "logfmt": "~0.18.1", + "markdown": "~0.5.0", + "mongodb": "*", + "mongoose": "*", + "promised-io": "~0.3.4", + "request": "~2.34.0", + "socket.io": "~0.9.16" + }, + "devDependencies": { + "chai": "^1.10.0", + "connect-proxy": "~1.0.2", + "grunt": "~0.4.4", + "grunt-angular-templates": "~0.5.1", + "grunt-autoprefixer": "~0.4.0", + "grunt-bower-install": "~0.8.0", + "grunt-concurrent": "~0.4.1", + "grunt-connect-proxy": "~0.1.10", + "grunt-contrib-clean": "^0.6.0", + "grunt-contrib-coffee": "~0.7.0", + "grunt-contrib-compass": "~0.6.0", + "grunt-contrib-concat": "~0.3.0", + "grunt-contrib-connect": "~0.5.0", + "grunt-contrib-copy": "~0.4.1", + "grunt-contrib-cssmin": "~0.7.0", + "grunt-contrib-htmlmin": "~0.1.3", + "grunt-contrib-jasmine": "~0.5.2", + "grunt-contrib-jshint": "~0.7.1", + "grunt-contrib-less": "~0.9.0", + "grunt-contrib-uglify": "~0.2.0", + "grunt-contrib-watch": "~0.5.2", + "grunt-google-cdn": "^0.4.3", + "grunt-jasmine-node": "~0.1.0", + "grunt-karma": "^0.9.0", + "grunt-karma-coveralls": "^2.5.1", + "grunt-mocha-test": "^0.12.4", + "grunt-newer": "~0.5.4", + "grunt-ngdocs": "~0.1.7", + "grunt-ngmin": "0.0.3", + "grunt-protractor-runner": "^1.1.0", + "grunt-protractor-webdriver": "^0.1.8", + "grunt-rev": "~0.1.0", + "grunt-svgmin": "~0.2.0", + "grunt-usemin": "~2.0.2", + "jasmine-core": "^2.1.2", + "jasmine-node": "~1.11.0", + "jasmine-reporters": "^1.0.1", + "karma": "^0.12.28", + "karma-chrome-launcher": "^0.1.5", + "karma-coverage": "^0.2.6", + "karma-jasmine": "^0.3.1", + "karma-ng-html2js-preprocessor": "~0.1", + "karma-ng-scenario": "~0.1", + "karma-phantomjs-launcher": "~0.1", + "load-grunt-tasks": "~0.2.0", + "mocha": "^2.0.1", + "protractor": "^1.0.0", + "supertest": "^0.15.0", + "time-grunt": "~0.2.1" + }, + "peerDependencies": { + "grunt": "0.4.x", + "karma": "~0.12.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "grunt test", + "start": "node web.js" + } } diff --git a/protractor.conf.js b/protractor.conf.js index ee43245..a7ecb9c 100644 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -1,5 +1,6 @@ // An example configuration file. exports.config = { + baseUrl: 'http://localhost:9000', // The address of a running selenium server. seleniumAddress: 'http://localhost:4444/wd/hub', diff --git a/test/protractor/App.js b/test/protractor/App.js index baba5b7..70a6b37 100644 --- a/test/protractor/App.js +++ b/test/protractor/App.js @@ -1,11 +1,10 @@ - /* App.coffee This is the protractor spec that will test the different areas of the application. */ -var UsersPage = function() { +var UsersPage = function () { this.newUserBtn = element(by.buttonText('New User')); this.submitBtn = element(by.buttonText('Submit')); @@ -18,11 +17,11 @@ var UsersPage = function() { summary: element(protractor.By.model('user.meta.summary')) }; - this.get = function() { + this.get = function () { browser.get('http://localhost:9000/#/users'); }; - this.setForm = function(email, username, password, name, summary) { + this.setForm = function (email, username, password, name, summary) { this.newUserBtn.click(); browser.sleep(500); this.inputs.username.sendKeys(username); @@ -37,18 +36,18 @@ var UsersPage = function() { }; -describe('Angular-CMS', function() { +describe('Angular-CMS', function () { var usersPage = null; - describe('Users Page:', function() { - beforeEach(function() { + describe('Users Page:', function () { + beforeEach(function () { usersPage = new UsersPage(); usersPage.get(); }); - it('should be able to create a new user', function() { + it('should be able to create a new user', function () { var username = 'protractor' + Date.now(); - usersPage.setForm(username+'@test.com', username, 'test', 'John Doe', 'This is an example user.'); + usersPage.setForm(username + '@test.com', username, 'test', 'John Doe', 'This is an example user.'); }); }); });