├── CrudAPI ├── api │ ├── models │ │ ├── .gitkeep │ │ ├── Customer.js │ │ └── User.js │ ├── controllers │ │ ├── .gitkeep │ │ ├── UserController.js │ │ ├── CustomerController.js │ │ └── AuthController.js │ ├── services │ │ ├── .gitkeep │ │ └── CipherService.js │ ├── policies │ │ ├── isAuthenticated.js │ │ └── sessionAuth.js │ ├── responses │ │ ├── unauthorized.js │ │ ├── created.js │ │ ├── ok.js │ │ ├── badRequest.js │ │ ├── forbidden.js │ │ ├── serverError.js │ │ └── notFound.js │ └── blueprints │ │ └── find.js ├── assets │ ├── images │ │ └── .gitkeep │ ├── templates │ │ └── .gitkeep │ ├── favicon.ico │ ├── robots.txt │ └── styles │ │ └── importer.less ├── README.md ├── config │ ├── locales │ │ ├── en.json │ │ ├── de.json │ │ ├── fr.json │ │ ├── es.json │ │ └── _README.md │ ├── bootstrap.js │ ├── env │ │ ├── development.js │ │ └── production.js │ ├── log.js │ ├── models.js │ ├── passport.js │ ├── policies.js │ ├── routes.js │ ├── i18n.js │ ├── csrf.js │ ├── globals.js │ ├── cors.js │ ├── http.js │ ├── session.js │ ├── connections.js │ └── views.js ├── .sailsrc ├── tasks │ ├── register │ │ ├── default.js │ │ ├── syncAssets.js │ │ ├── build.js │ │ ├── compileAssets.js │ │ ├── buildProd.js │ │ ├── linkAssets.js │ │ ├── linkAssetsBuild.js │ │ ├── linkAssetsBuildProd.js │ │ └── prod.js │ ├── config │ │ ├── clean.js │ │ ├── uglify.js │ │ ├── cssmin.js │ │ ├── sync.js │ │ ├── less.js │ │ ├── concat.js │ │ ├── watch.js │ │ ├── coffee.js │ │ ├── copy.js │ │ └── jst.js │ ├── pipeline.js │ └── README.md ├── .editorconfig ├── package.json ├── app.js ├── Gruntfile.js ├── .gitignore └── views │ ├── layout.ejs │ ├── 403.ejs │ └── 404.ejs ├── CrudUI ├── gulp.png ├── src │ ├── server │ │ ├── favicon.ico │ │ ├── utils │ │ │ └── 404.js │ │ ├── routes.js │ │ ├── data.js │ │ └── app.js │ └── client │ │ ├── images │ │ ├── busy.gif │ │ ├── icon.png │ │ ├── gulp-tiny.png │ │ └── AngularJS-small.png │ │ ├── app │ │ ├── widgets │ │ │ ├── widgets.module.js │ │ │ ├── widget-header.html │ │ │ ├── ht-widget-header.directive.js │ │ │ └── ht-img-person.directive.js │ │ ├── blocks │ │ │ ├── logger │ │ │ │ ├── logger.module.js │ │ │ │ └── logger.js │ │ │ ├── exception │ │ │ │ ├── exception.module.js │ │ │ │ ├── exception.js │ │ │ │ ├── exception-handler.provider.js │ │ │ │ └── exception-handler.provider.spec.js │ │ │ └── router │ │ │ │ ├── router.module.js │ │ │ │ └── router-helper.provider.js │ │ ├── layout │ │ │ ├── layout.module.js │ │ │ ├── shell.controller.spec.js │ │ │ ├── sidebar.html │ │ │ ├── shell.html │ │ │ ├── ht-top-nav.directive.js │ │ │ ├── shell.controller.js │ │ │ ├── sidebar.controller.js │ │ │ ├── ht-top-nav.html │ │ │ ├── sidebar.controller.spec.js │ │ │ └── ht-sidebar.directive.js │ │ ├── dashboard │ │ │ ├── dashboard.module.js │ │ │ ├── dashboard.route.js │ │ │ ├── dashboard.route.spec.js │ │ │ ├── dashboard.controller.js │ │ │ ├── dashboard.controller.spec.js │ │ │ └── dashboard.html │ │ ├── customer │ │ │ ├── customer.client.module.js │ │ │ ├── services │ │ │ │ ├── customer.client.service.js │ │ │ │ └── customer.form.client.service.js │ │ │ ├── views │ │ │ │ ├── view.html │ │ │ │ ├── create.html │ │ │ │ ├── edit.html │ │ │ │ └── list.html │ │ │ ├── config │ │ │ │ └── customer.client.routes.js │ │ │ └── controllers │ │ │ │ └── customer.client.controller.js │ │ ├── app.module.js │ │ └── core │ │ │ ├── constants.js │ │ │ ├── core.module.js │ │ │ ├── core.route.js │ │ │ ├── dataservice.js │ │ │ ├── config.js │ │ │ ├── core.route.spec.js │ │ │ ├── 404.html │ │ │ ├── directives │ │ │ └── ng-really-click.directive.js │ │ │ └── services │ │ │ └── table.settings.service.js │ │ ├── test-helpers │ │ ├── bind-polyfill.js │ │ └── mock-data.js │ │ ├── specs.html │ │ └── index.html ├── .bowerrc ├── .editorconfig ├── .gitignore ├── bower.json ├── .jshintrc ├── package.json ├── .jscsrc ├── karma.conf.js ├── README.md └── gulp.config.js ├── CrudQA ├── features │ ├── support │ │ └── cucumber-mink.js │ └── home.feature └── package.json ├── .gitignore └── README_restAPI.txt /CrudAPI/api/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CrudAPI/api/controllers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CrudAPI/api/services/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CrudAPI/assets/images/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CrudAPI/assets/templates/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CrudAPI/README.md: -------------------------------------------------------------------------------- 1 | # CrudAPI 2 | 3 | a [Sails](http://sailsjs.org) application 4 | -------------------------------------------------------------------------------- /CrudUI/gulp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2Cld/CrudUP/master/CrudUI/gulp.png -------------------------------------------------------------------------------- /CrudAPI/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2Cld/CrudUP/master/CrudAPI/assets/favicon.ico -------------------------------------------------------------------------------- /CrudUI/src/server/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2Cld/CrudUP/master/CrudUI/src/server/favicon.ico -------------------------------------------------------------------------------- /CrudAPI/config/locales/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "Welcome": "Welcome", 3 | "A brand new app.": "A brand new app." 4 | } 5 | -------------------------------------------------------------------------------- /CrudAPI/config/locales/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "Welcome": "Willkommen", 3 | "A brand new app.": "Eine neue App." 4 | } 5 | -------------------------------------------------------------------------------- /CrudUI/src/client/images/busy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2Cld/CrudUP/master/CrudUI/src/client/images/busy.gif -------------------------------------------------------------------------------- /CrudUI/src/client/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2Cld/CrudUP/master/CrudUI/src/client/images/icon.png -------------------------------------------------------------------------------- /CrudAPI/.sailsrc: -------------------------------------------------------------------------------- 1 | { 2 | "generators": { 3 | "modules": {} 4 | }, 5 | "hooks":{ 6 | "grunt":false 7 | } 8 | } -------------------------------------------------------------------------------- /CrudUI/src/client/images/gulp-tiny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2Cld/CrudUP/master/CrudUI/src/client/images/gulp-tiny.png -------------------------------------------------------------------------------- /CrudAPI/config/locales/fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "Welcome": "Bienvenue", 3 | "A brand new app.": "Une toute nouvelle application." 4 | } 5 | -------------------------------------------------------------------------------- /CrudUI/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components", 3 | "scripts": { 4 | "postinstall": "gulp wiredep" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /CrudAPI/config/locales/es.json: -------------------------------------------------------------------------------- 1 | { 2 | "Welcome": "Bienvenido", 3 | "A brand new app.": "Una aplicación de la nueva marca." 4 | } 5 | -------------------------------------------------------------------------------- /CrudUI/src/client/images/AngularJS-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2Cld/CrudUP/master/CrudUI/src/client/images/AngularJS-small.png -------------------------------------------------------------------------------- /CrudUI/src/client/app/widgets/widgets.module.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular.module('app.widgets', []); 5 | })(); 6 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/blocks/logger/logger.module.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular.module('blocks.logger', []); 5 | })(); 6 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/layout/layout.module.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular.module('app.layout', ['app.core']); 5 | })(); 6 | -------------------------------------------------------------------------------- /CrudAPI/tasks/register/default.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('default', ['compileAssets', 'linkAssets', 'watch']); 3 | }; 4 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/blocks/exception/exception.module.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular.module('blocks.exception', ['blocks.logger']); 5 | })(); 6 | -------------------------------------------------------------------------------- /CrudAPI/tasks/register/syncAssets.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('syncAssets', [ 3 | 'jst:dev', 4 | 'less:dev', 5 | 'sync:dev', 6 | 'coffee:dev' 7 | ]); 8 | }; 9 | -------------------------------------------------------------------------------- /CrudAPI/tasks/register/build.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('build', [ 3 | 'compileAssets', 4 | 'linkAssetsBuild', 5 | 'clean:build', 6 | 'copy:build' 7 | ]); 8 | }; 9 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/blocks/router/router.module.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular.module('blocks.router', [ 5 | 'ui.router', 6 | 'blocks.logger' 7 | ]); 8 | })(); 9 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/dashboard/dashboard.module.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular.module('app.dashboard', [ 5 | 'app.core', 6 | 'app.widgets' 7 | ]); 8 | })(); 9 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/customer/customer.client.module.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | angular.module('app.customer', []); 5 | angular.module('app').requires.push('app.customer'); 6 | 7 | })(); 8 | -------------------------------------------------------------------------------- /CrudAPI/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /CrudAPI/tasks/register/compileAssets.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('compileAssets', [ 3 | 'clean:dev', 4 | 'jst:dev', 5 | 'less:dev', 6 | 'copy:dev', 7 | 'coffee:dev' 8 | ]); 9 | }; 10 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/app.module.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | angular.module('app', [ 5 | 'app.core', 6 | 'app.widgets', 7 | 'app.dashboard', 8 | 'app.layout' 9 | ]); 10 | 11 | })(); 12 | -------------------------------------------------------------------------------- /CrudAPI/tasks/register/buildProd.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('buildProd', [ 3 | 'compileAssets', 4 | 'concat', 5 | 'uglify', 6 | 'cssmin', 7 | 'linkAssetsBuildProd', 8 | 'clean:build', 9 | 'copy:build' 10 | ]); 11 | }; 12 | -------------------------------------------------------------------------------- /CrudAPI/api/controllers/UserController.js: -------------------------------------------------------------------------------- 1 | /** 2 | * UserController 3 | * 4 | * @description :: Server-side logic for managing Users 5 | * @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers 6 | */ 7 | 8 | module.exports = { 9 | 10 | }; 11 | 12 | -------------------------------------------------------------------------------- /CrudUI/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 4 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /CrudAPI/api/controllers/CustomerController.js: -------------------------------------------------------------------------------- 1 | /** 2 | * CustomerController 3 | * 4 | * @description :: Server-side logic for managing Customers 5 | * @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers 6 | */ 7 | 8 | module.exports = { 9 | 10 | }; 11 | 12 | -------------------------------------------------------------------------------- /CrudAPI/assets/robots.txt: -------------------------------------------------------------------------------- 1 | # The robots.txt file is used to control how search engines index your live URLs. 2 | # See http://www.robotstxt.org/wc/norobots.html for more information. 3 | 4 | 5 | 6 | # To prevent search engines from seeing the site altogether, uncomment the next two lines: 7 | # User-Agent: * 8 | # Disallow: / 9 | -------------------------------------------------------------------------------- /CrudAPI/tasks/register/linkAssets.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('linkAssets', [ 3 | 'sails-linker:devJs', 4 | 'sails-linker:devStyles', 5 | 'sails-linker:devTpl', 6 | 'sails-linker:devJsJade', 7 | 'sails-linker:devStylesJade', 8 | 'sails-linker:devTplJade' 9 | ]); 10 | }; 11 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/core/constants.js: -------------------------------------------------------------------------------- 1 | /* global toastr:false, moment:false */ 2 | (function() { 3 | 'use strict'; 4 | 5 | angular 6 | .module('app.core') 7 | .constant('toastr', toastr) 8 | .constant('moment', moment) 9 | .constant('API_BASE_URL', 'http://localhost:1337'); 10 | })(); 11 | -------------------------------------------------------------------------------- /CrudAPI/tasks/register/linkAssetsBuild.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('linkAssetsBuild', [ 3 | 'sails-linker:devJsRelative', 4 | 'sails-linker:devStylesRelative', 5 | 'sails-linker:devTpl', 6 | 'sails-linker:devJsRelativeJade', 7 | 'sails-linker:devStylesRelativeJade', 8 | 'sails-linker:devTplJade' 9 | ]); 10 | }; 11 | -------------------------------------------------------------------------------- /CrudAPI/tasks/register/linkAssetsBuildProd.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('linkAssetsBuildProd', [ 3 | 'sails-linker:prodJsRelative', 4 | 'sails-linker:prodStylesRelative', 5 | 'sails-linker:devTpl', 6 | 'sails-linker:prodJsRelativeJade', 7 | 'sails-linker:prodStylesRelativeJade', 8 | 'sails-linker:devTplJade' 9 | ]); 10 | }; 11 | -------------------------------------------------------------------------------- /CrudAPI/tasks/register/prod.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('prod', [ 3 | 'compileAssets', 4 | 'concat', 5 | 'uglify', 6 | 'cssmin', 7 | 'sails-linker:prodJs', 8 | 'sails-linker:prodStyles', 9 | 'sails-linker:devTpl', 10 | 'sails-linker:prodJsJade', 11 | 'sails-linker:prodStylesJade', 12 | 'sails-linker:devTplJade' 13 | ]); 14 | }; 15 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/widgets/widget-header.html: -------------------------------------------------------------------------------- 1 |
2 |
{{title}}
3 | ({{subtitle}}) 4 |
5 | {{rightText}} 6 |
7 |
-------------------------------------------------------------------------------- /CrudAPI/api/models/Customer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Customer.js 3 | * 4 | * @description :: TODO: You might write a short summary of how this model works and what it represents here. 5 | * @docs :: http://sailsjs.org/#!documentation/models 6 | */ 7 | 8 | module.exports = { 9 | 10 | attributes: { 11 | name: 'string', 12 | address: 'string', 13 | state: 'string', 14 | country: 'string' 15 | } 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /CrudAPI/api/policies/isAuthenticated.js: -------------------------------------------------------------------------------- 1 | /** 2 | * isAuthenticated 3 | * @description :: Policy to inject user in req via JSON Web Token 4 | */ 5 | var passport = require('passport'); 6 | 7 | module.exports = function (req, res, next) { 8 | passport.authenticate('jwt', function (error, user, info) { 9 | if (error) return res.serverError(error); 10 | if (!user) 11 | return res.unauthorized(null, info && info.code, info && info.message); 12 | req.user = user; 13 | 14 | next(); 15 | })(req, res); 16 | }; -------------------------------------------------------------------------------- /CrudUI/src/client/app/core/core.module.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | angular 5 | .module('app.core', [ 6 | 'ngAnimate', 7 | 'ngSanitize', 8 | 'blocks.exception', 9 | 'blocks.logger', 10 | 'blocks.router', 11 | 'ui.router', 12 | 'ngplus', 13 | 'ngResource', 14 | 'ui.bootstrap', 15 | 'ngTable', 16 | 'formly', 17 | 'formlyBootstrap' 18 | ]); 19 | })(); 20 | -------------------------------------------------------------------------------- /CrudAPI/tasks/config/clean.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Clean files and folders. 3 | * 4 | * --------------------------------------------------------------- 5 | * 6 | * This grunt task is configured to clean out the contents in the .tmp/public of your 7 | * sails project. 8 | * 9 | * For usage docs see: 10 | * https://github.com/gruntjs/grunt-contrib-clean 11 | */ 12 | module.exports = function(grunt) { 13 | 14 | grunt.config.set('clean', { 15 | dev: ['.tmp/public/**'], 16 | build: ['www'] 17 | }); 18 | 19 | grunt.loadNpmTasks('grunt-contrib-clean'); 20 | }; 21 | -------------------------------------------------------------------------------- /CrudAPI/api/responses/unauthorized.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 401 (Unauthorized) Response 3 | * Similar to 403 Forbidden. 4 | * Specifically for authentication failed or not yet provided. 5 | */ 6 | module.exports = function (data, code, message, root) { 7 | var response = _.assign({ 8 | code: code || 'E_UNAUTHORIZED', 9 | message: message || 'Missing or invalid authentication token', 10 | data: data || {} 11 | }, root); 12 | 13 | this.req._sails.log.silly('Sent (401 UNAUTHORIZED)\n', response); 14 | 15 | this.res.status(401); 16 | this.res.jsonx(response); 17 | }; 18 | -------------------------------------------------------------------------------- /CrudAPI/tasks/config/uglify.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Minify files with UglifyJS. 3 | * 4 | * --------------------------------------------------------------- 5 | * 6 | * Minifies client-side javascript `assets`. 7 | * 8 | * For usage docs see: 9 | * https://github.com/gruntjs/grunt-contrib-uglify 10 | * 11 | */ 12 | module.exports = function(grunt) { 13 | 14 | grunt.config.set('uglify', { 15 | dist: { 16 | src: ['.tmp/public/concat/production.js'], 17 | dest: '.tmp/public/min/production.min.js' 18 | } 19 | }); 20 | 21 | grunt.loadNpmTasks('grunt-contrib-uglify'); 22 | }; 23 | -------------------------------------------------------------------------------- /CrudAPI/tasks/config/cssmin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Compress CSS files. 3 | * 4 | * --------------------------------------------------------------- 5 | * 6 | * Minifies css files and places them into .tmp/public/min directory. 7 | * 8 | * For usage docs see: 9 | * https://github.com/gruntjs/grunt-contrib-cssmin 10 | */ 11 | module.exports = function(grunt) { 12 | 13 | grunt.config.set('cssmin', { 14 | dist: { 15 | src: ['.tmp/public/concat/production.css'], 16 | dest: '.tmp/public/min/production.min.css' 17 | } 18 | }); 19 | 20 | grunt.loadNpmTasks('grunt-contrib-cssmin'); 21 | }; 22 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/blocks/exception/exception.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular 5 | .module('blocks.exception') 6 | .factory('exception', exception); 7 | 8 | exception.$inject = ['logger']; 9 | 10 | /* @ngInject */ 11 | function exception(logger) { 12 | var service = { 13 | catcher: catcher 14 | }; 15 | return service; 16 | 17 | function catcher(message) { 18 | return function(reason) { 19 | logger.error(message, reason); 20 | }; 21 | } 22 | } 23 | })(); 24 | -------------------------------------------------------------------------------- /CrudQA/features/support/cucumber-mink.js: -------------------------------------------------------------------------------- 1 | var mink = require('cucumber-mink'); 2 | 3 | // Local Chrome 4 | var parameters = { 5 | driver: { 6 | logLevel: 'silent', 7 | desiredCapabilities: { 8 | browserName: 'chrome' 9 | }, 10 | port: 4444 11 | } 12 | }; 13 | 14 | //NOTE: need to do angular wait 15 | // https://github.com/Adezandee/cucumber-mink/issues/26 16 | // https://github.com/Adezandee/cucumber-mink/pull/29 17 | // https://github.com/Adezandee/cucumber-mink/compare/feature/angularjs-support 18 | // http://cucumber-mink.js.org/steps/#wait 19 | 20 | module.exports = function () { 21 | mink.init(this, parameters); 22 | }; 23 | 24 | -------------------------------------------------------------------------------- /CrudUI/src/server/utils/404.js: -------------------------------------------------------------------------------- 1 | module.exports = function (app) { 2 | var service = { 3 | notFoundMiddleware: notFoundMiddleware, 4 | send404: send404 5 | }; 6 | return service; 7 | 8 | function notFoundMiddleware(req, res, next) { 9 | send404(req, res, 'API endpoint not found'); 10 | } 11 | 12 | function send404(req, res, description) { 13 | var data = { 14 | status: 404, 15 | message: 'Not Found', 16 | description: description, 17 | url: req.url 18 | }; 19 | res.status(404) 20 | .send(data) 21 | .end(); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /CrudQA/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CrudQA", 3 | "version": "0.0.1", 4 | "description": "Protactor CrudUI test", 5 | "main": "none", 6 | "dependencies": { 7 | "chai": "^1.10.0", 8 | "chai-as-promised": "^4.1.1", 9 | "cucumber": "^0.4.4", 10 | "cucumber-mink": "^1.0.2", 11 | "webdriver-manager": "^7.0.1" 12 | }, 13 | "devDependencies": {}, 14 | "scripts": { 15 | "test": "date && cucumber-js --require features/support/cucumber-mink.js && date" 16 | }, 17 | "repository": { 18 | "type": "git", 19 | "url": "" 20 | }, 21 | "keywords": [ 22 | "TES", 23 | "AST" 24 | ], 25 | "author": "ctrees@mailserviceslc.com", 26 | "license": "MIT" 27 | } -------------------------------------------------------------------------------- /CrudAPI/api/responses/created.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 201 (Created) Response 3 | * Successful creation occurred (via either POST or PUT). 4 | * Set the Location header to contain a link 5 | * to the newly-created resource (on POST). 6 | * Response body content may or may not be present. 7 | */ 8 | module.exports = function (data, code, message, root) { 9 | var response = _.assign({ 10 | code: code || 'CREATED', 11 | message: message 12 | || 'The request has resulted in a new resource being created', 13 | data: data || {} 14 | }, root); 15 | 16 | this.req._sails.log.silly('Sent (201 CREATED)\n', response); 17 | 18 | this.res.status(201); 19 | this.res.jsonx(response); 20 | }; 21 | -------------------------------------------------------------------------------- /CrudAPI/config/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Bootstrap 3 | * (sails.config.bootstrap) 4 | * 5 | * An asynchronous bootstrap function that runs before your Sails app gets lifted. 6 | * This gives you an opportunity to set up your data model, run jobs, or perform some special logic. 7 | * 8 | * For more information on bootstrapping your app, check out: 9 | * http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.bootstrap.html 10 | */ 11 | 12 | module.exports.bootstrap = function(cb) { 13 | 14 | // It's very important to trigger this callback method when you are finished 15 | // with the bootstrap! (otherwise your server will never lift, since it's waiting on the bootstrap) 16 | cb(); 17 | }; 18 | -------------------------------------------------------------------------------- /CrudUI/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 27 | node_modules 28 | 29 | bower_components 30 | 31 | build 32 | 33 | .tmp 34 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/core/core.route.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular 5 | .module('app.core') 6 | .run(appRun); 7 | 8 | /* @ngInject */ 9 | function appRun(routerHelper) { 10 | var otherwise = '/404'; 11 | routerHelper.configureStates(getStates(), otherwise); 12 | } 13 | 14 | function getStates() { 15 | return [ 16 | { 17 | state: '404', 18 | config: { 19 | url: '/404', 20 | templateUrl: 'app/core/404.html', 21 | title: '404' 22 | } 23 | } 24 | ]; 25 | } 26 | })(); 27 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/customer/services/customer.client.service.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular 5 | .module('app.customer') 6 | .factory('Customer', Customer); 7 | 8 | Customer.$inject = ['$resource', 'API_BASE_URL']; 9 | /* @ngInject */ 10 | function Customer($resource, API_BASE_URL) { 11 | 12 | var params = { 13 | customerId: '@id' 14 | }; 15 | 16 | var actions = { 17 | update: { 18 | method: 'PUT' 19 | } 20 | }; 21 | 22 | var API_URL = API_BASE_URL + '/customer/:customerId'; 23 | 24 | return $resource(API_URL, params, actions); 25 | 26 | } 27 | 28 | })(); 29 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/layout/shell.controller.spec.js: -------------------------------------------------------------------------------- 1 | /* jshint -W117, -W030 */ 2 | describe('ShellController', function() { 3 | var controller; 4 | 5 | beforeEach(function() { 6 | bard.appModule('app.layout'); 7 | bard.inject('$controller', '$q', '$rootScope', '$timeout', 'dataservice'); 8 | }); 9 | 10 | beforeEach(function () { 11 | controller = $controller('ShellController'); 12 | $rootScope.$apply(); 13 | }); 14 | 15 | bard.verifyNoOutstandingHttpRequests(); 16 | 17 | describe('Shell controller', function() { 18 | it('should be created successfully', function () { 19 | expect(controller).to.be.defined; 20 | }); 21 | 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /CrudAPI/tasks/config/sync.js: -------------------------------------------------------------------------------- 1 | /** 2 | * A grunt task to keep directories in sync. It is very similar to grunt-contrib-copy 3 | * but tries to copy only those files that has actually changed. 4 | * 5 | * --------------------------------------------------------------- 6 | * 7 | * Synchronize files from the `assets` folder to `.tmp/public`, 8 | * smashing anything that's already there. 9 | * 10 | * For usage docs see: 11 | * https://github.com/tomusdrw/grunt-sync 12 | * 13 | */ 14 | module.exports = function(grunt) { 15 | 16 | grunt.config.set('sync', { 17 | dev: { 18 | files: [{ 19 | cwd: './assets', 20 | src: ['**/*.!(coffee)'], 21 | dest: '.tmp/public' 22 | }] 23 | } 24 | }); 25 | 26 | grunt.loadNpmTasks('grunt-sync'); 27 | }; 28 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/layout/sidebar.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 15 | 16 |
17 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/layout/shell.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 |
7 | 8 |
9 | 10 |
14 | 15 | 16 |
{{vm.busyMessage}}
17 |
18 |
19 |
20 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/layout/ht-top-nav.directive.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular 5 | .module('app.layout') 6 | .directive('htTopNav', htTopNav); 7 | 8 | /* @ngInject */ 9 | function htTopNav () { 10 | var directive = { 11 | bindToController: true, 12 | controller: TopNavController, 13 | controllerAs: 'vm', 14 | restrict: 'EA', 15 | scope: { 16 | 'navline': '=' 17 | }, 18 | templateUrl: 'app/layout/ht-top-nav.html' 19 | }; 20 | 21 | /* @ngInject */ 22 | function TopNavController() { 23 | var vm = this; 24 | } 25 | 26 | return directive; 27 | } 28 | })(); 29 | -------------------------------------------------------------------------------- /CrudAPI/tasks/config/less.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Compiles LESS files into CSS. 3 | * 4 | * --------------------------------------------------------------- 5 | * 6 | * Only the `assets/styles/importer.less` is compiled. 7 | * This allows you to control the ordering yourself, i.e. import your 8 | * dependencies, mixins, variables, resets, etc. before other stylesheets) 9 | * 10 | * For usage docs see: 11 | * https://github.com/gruntjs/grunt-contrib-less 12 | */ 13 | module.exports = function(grunt) { 14 | 15 | grunt.config.set('less', { 16 | dev: { 17 | files: [{ 18 | expand: true, 19 | cwd: 'assets/styles/', 20 | src: ['importer.less'], 21 | dest: '.tmp/public/styles/', 22 | ext: '.css' 23 | }] 24 | } 25 | }); 26 | 27 | grunt.loadNpmTasks('grunt-contrib-less'); 28 | }; 29 | -------------------------------------------------------------------------------- /CrudAPI/api/policies/sessionAuth.js: -------------------------------------------------------------------------------- 1 | /** 2 | * sessionAuth 3 | * 4 | * @module :: Policy 5 | * @description :: Simple policy to allow any authenticated user 6 | * Assumes that your login action in one of your controllers sets `req.session.authenticated = true;` 7 | * @docs :: http://sailsjs.org/#!/documentation/concepts/Policies 8 | * 9 | */ 10 | module.exports = function(req, res, next) { 11 | 12 | // User is allowed, proceed to the next policy, 13 | // or if this is the last policy, the controller 14 | if (req.session.authenticated) { 15 | return next(); 16 | } 17 | 18 | // User is not allowed 19 | // (default res.forbidden() behavior can be overridden in `config/403.js`) 20 | return res.forbidden('You are not permitted to perform this action.'); 21 | }; 22 | -------------------------------------------------------------------------------- /CrudUI/src/server/routes.js: -------------------------------------------------------------------------------- 1 | var router = require('express').Router(); 2 | var four0four = require('./utils/404')(); 3 | var data = require('./data'); 4 | 5 | router.get('/people', getPeople); 6 | router.get('/person/:id', getPerson); 7 | router.get('/*', four0four.notFoundMiddleware); 8 | 9 | module.exports = router; 10 | 11 | ////////////// 12 | 13 | function getPeople(req, res, next) { 14 | res.status(200).send(data.people); 15 | } 16 | 17 | function getPerson(req, res, next) { 18 | var id = +req.params.id; 19 | var person = data.people.filter(function(p) { 20 | return p.id === id; 21 | })[0]; 22 | 23 | if (person) { 24 | res.status(200).send(person); 25 | } else { 26 | four0four.send404(req, res, 'person ' + id + ' not found'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CrudAPI/tasks/config/concat.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Concatenate files. 3 | * 4 | * --------------------------------------------------------------- 5 | * 6 | * Concatenates files javascript and css from a defined array. Creates concatenated files in 7 | * .tmp/public/contact directory 8 | * [concat](https://github.com/gruntjs/grunt-contrib-concat) 9 | * 10 | * For usage docs see: 11 | * https://github.com/gruntjs/grunt-contrib-concat 12 | */ 13 | module.exports = function(grunt) { 14 | 15 | grunt.config.set('concat', { 16 | js: { 17 | src: require('../pipeline').jsFilesToInject, 18 | dest: '.tmp/public/concat/production.js' 19 | }, 20 | css: { 21 | src: require('../pipeline').cssFilesToInject, 22 | dest: '.tmp/public/concat/production.css' 23 | } 24 | }); 25 | 26 | grunt.loadNpmTasks('grunt-contrib-concat'); 27 | }; 28 | -------------------------------------------------------------------------------- /CrudUI/src/server/data.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | people: getPeople() 3 | }; 4 | 5 | function getPeople() { 6 | return [ 7 | {id: 1, firstName: 'John', lastName: 'Papa', age: 25, location: 'Florida'}, 8 | {id: 2, firstName: 'Ward', lastName: 'Bell', age: 31, location: 'California'}, 9 | {id: 3, firstName: 'Colleen', lastName: 'Jones', age: 21, location: 'New York'}, 10 | {id: 4, firstName: 'Madelyn', lastName: 'Green', age: 18, location: 'North Dakota'}, 11 | {id: 5, firstName: 'Ella', lastName: 'Jobs', age: 18, location: 'South Dakota'}, 12 | {id: 6, firstName: 'Landon', lastName: 'Gates', age: 11, location: 'South Carolina'}, 13 | {id: 7, firstName: 'Haley', lastName: 'Guthrie', age: 35, location: 'Wyoming'}, 14 | {id: 8, firstName: 'Aaron', lastName: 'Jinglehiemer', age: 22, location: 'Utah'} 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/widgets/ht-widget-header.directive.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular 5 | .module('app.widgets') 6 | .directive('htWidgetHeader', htWidgetHeader); 7 | 8 | /* @ngInject */ 9 | function htWidgetHeader() { 10 | //Usage: 11 | //
12 | // Creates: 13 | //
16 | var directive = { 17 | scope: { 18 | 'title': '@', 19 | 'subtitle': '@', 20 | 'rightText': '@', 21 | 'allowCollapse': '@' 22 | }, 23 | templateUrl: 'app/widgets/widget-header.html', 24 | restrict: 'EA' 25 | }; 26 | return directive; 27 | } 28 | })(); 29 | -------------------------------------------------------------------------------- /CrudAPI/tasks/config/watch.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Run predefined tasks whenever watched file patterns are added, changed or deleted. 3 | * 4 | * --------------------------------------------------------------- 5 | * 6 | * Watch for changes on 7 | * - files in the `assets` folder 8 | * - the `tasks/pipeline.js` file 9 | * and re-run the appropriate tasks. 10 | * 11 | * For usage docs see: 12 | * https://github.com/gruntjs/grunt-contrib-watch 13 | * 14 | */ 15 | module.exports = function(grunt) { 16 | 17 | grunt.config.set('watch', { 18 | api: { 19 | 20 | // API files to watch: 21 | files: ['api/**/*', '!**/node_modules/**'] 22 | }, 23 | assets: { 24 | 25 | // Assets to watch: 26 | files: ['assets/**/*', 'tasks/pipeline.js', '!**/node_modules/**'], 27 | 28 | // When assets are changed: 29 | tasks: ['syncAssets' , 'linkAssets'] 30 | } 31 | }); 32 | 33 | grunt.loadNpmTasks('grunt-contrib-watch'); 34 | }; 35 | -------------------------------------------------------------------------------- /CrudAPI/config/env/development.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Development environment settings 3 | * 4 | * This file can include shared settings for a development team, 5 | * such as API keys or remote database passwords. If you're using 6 | * a version control solution for your Sails app, this file will 7 | * be committed to your repository unless you add it to your .gitignore 8 | * file. If your repository will be publicly viewable, don't add 9 | * any private information to this file! 10 | * 11 | */ 12 | 13 | module.exports = { 14 | 15 | /*************************************************************************** 16 | * Set the default database connection for models in the development * 17 | * environment (see config/connections.js and config/models.js ) * 18 | ***************************************************************************/ 19 | 20 | // models: { 21 | // connection: 'someMongodbServer' 22 | // } 23 | 24 | }; 25 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/widgets/ht-img-person.directive.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | angular 5 | .module('app.widgets') 6 | .directive('htImgPerson', htImgPerson); 7 | 8 | htImgPerson.$inject = ['config']; 9 | /* @ngInject */ 10 | function htImgPerson (config) { 11 | //Usage: 12 | // 13 | var basePath = config.imageBasePath; 14 | var unknownImage = config.unknownPersonImageSource; 15 | var directive = { 16 | link: link, 17 | restrict: 'A' 18 | }; 19 | return directive; 20 | 21 | function link(scope, element, attrs) { 22 | attrs.$observe('htImgPerson', function (value) { 23 | value = basePath + (value || unknownImage); 24 | attrs.$set('src', value); 25 | }); 26 | } 27 | } 28 | })(); 29 | -------------------------------------------------------------------------------- /CrudAPI/tasks/config/coffee.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Compile CoffeeScript files to JavaScript. 3 | * 4 | * --------------------------------------------------------------- 5 | * 6 | * Compiles coffeeScript files from `assest/js` into Javascript and places them into 7 | * `.tmp/public/js` directory. 8 | * 9 | * For usage docs see: 10 | * https://github.com/gruntjs/grunt-contrib-coffee 11 | */ 12 | module.exports = function(grunt) { 13 | 14 | grunt.config.set('coffee', { 15 | dev: { 16 | options: { 17 | bare: true, 18 | sourceMap: true, 19 | sourceRoot: './' 20 | }, 21 | files: [{ 22 | expand: true, 23 | cwd: 'assets/js/', 24 | src: ['**/*.coffee'], 25 | dest: '.tmp/public/js/', 26 | ext: '.js' 27 | }, { 28 | expand: true, 29 | cwd: 'assets/js/', 30 | src: ['**/*.coffee'], 31 | dest: '.tmp/public/js/', 32 | ext: '.js' 33 | }] 34 | } 35 | }); 36 | 37 | grunt.loadNpmTasks('grunt-contrib-coffee'); 38 | }; 39 | -------------------------------------------------------------------------------- /CrudAPI/tasks/config/copy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copy files and folders. 3 | * 4 | * --------------------------------------------------------------- 5 | * 6 | * # dev task config 7 | * Copies all directories and files, exept coffescript and less fiels, from the sails 8 | * assets folder into the .tmp/public directory. 9 | * 10 | * # build task config 11 | * Copies all directories nd files from the .tmp/public directory into a www directory. 12 | * 13 | * For usage docs see: 14 | * https://github.com/gruntjs/grunt-contrib-copy 15 | */ 16 | module.exports = function(grunt) { 17 | 18 | grunt.config.set('copy', { 19 | dev: { 20 | files: [{ 21 | expand: true, 22 | cwd: './assets', 23 | src: ['**/*.!(coffee|less)'], 24 | dest: '.tmp/public' 25 | }] 26 | }, 27 | build: { 28 | files: [{ 29 | expand: true, 30 | cwd: '.tmp/public', 31 | src: ['**/*'], 32 | dest: 'www' 33 | }] 34 | } 35 | }); 36 | 37 | grunt.loadNpmTasks('grunt-contrib-copy'); 38 | }; 39 | -------------------------------------------------------------------------------- /CrudAPI/assets/styles/importer.less: -------------------------------------------------------------------------------- 1 | /** 2 | * importer.less 3 | * 4 | * By default, new Sails projects are configured to compile this file 5 | * from LESS to CSS. Unlike CSS files, LESS files are not compiled and 6 | * included automatically unless they are imported below. 7 | * 8 | * The LESS files imported below are compiled and included in the order 9 | * they are listed. Mixins, variables, etc. should be imported first 10 | * so that they can be accessed by subsequent LESS stylesheets. 11 | * 12 | * (Just like the rest of the asset pipeline bundled in Sails, you can 13 | * always omit, customize, or replace this behavior with SASS, SCSS, 14 | * or any other Grunt tasks you like.) 15 | */ 16 | 17 | 18 | 19 | // For example: 20 | // 21 | // @import 'variables/colors.less'; 22 | // @import 'mixins/foo.less'; 23 | // @import 'mixins/bar.less'; 24 | // @import 'mixins/baz.less'; 25 | // 26 | // @import 'styleguide.less'; 27 | // @import 'pages/login.less'; 28 | // @import 'pages/signup.less'; 29 | // 30 | // etc. 31 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/dashboard/dashboard.route.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular 5 | .module('app.dashboard') 6 | .run(appRun); 7 | 8 | appRun.$inject = ['routerHelper']; 9 | /* @ngInject */ 10 | function appRun(routerHelper) { 11 | routerHelper.configureStates(getStates()); 12 | } 13 | 14 | function getStates() { 15 | return [ 16 | { 17 | state: 'dashboard', 18 | config: { 19 | url: '/', 20 | templateUrl: 'app/dashboard/dashboard.html', 21 | controller: 'DashboardController', 22 | controllerAs: 'vm', 23 | title: 'dashboard', 24 | settings: { 25 | nav: 1, 26 | content: ' Dashboard' 27 | } 28 | } 29 | } 30 | ]; 31 | } 32 | })(); 33 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/customer/views/view.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 | Customer View 6 |
7 |
8 | 9 |
10 | 11 | 12 |
13 | 14 |
15 |
16 | 17 | Edit 18 | 19 | 20 | Delete 21 | 22 | 23 | List Customers 24 | 25 |
26 | 27 |
28 |
29 | 30 |
31 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/core/dataservice.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | angular 5 | .module('app.core') 6 | .factory('dataservice', dataservice); 7 | 8 | dataservice.$inject = ['$http', '$q', 'logger']; 9 | /* @ngInject */ 10 | function dataservice($http, $q, logger) { 11 | var service = { 12 | getPeople: getPeople, 13 | getMessageCount: getMessageCount 14 | }; 15 | 16 | return service; 17 | 18 | function getMessageCount() { return $q.when(72); } 19 | 20 | function getPeople() { 21 | return $http.get('/api/people') 22 | .then(success) 23 | .catch(fail); 24 | 25 | function success(response) { 26 | return response.data; 27 | } 28 | 29 | function fail(error) { 30 | var msg = 'query for people failed. ' + error.data.description; 31 | logger.error(msg); 32 | return $q.reject(msg); 33 | } 34 | } 35 | } 36 | })(); 37 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/customer/views/create.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 | New Customer 6 |
7 |
8 | 9 |
10 | 11 | 12 | 13 | 14 |
15 |
16 | 19 | 20 | Cancel 21 | 22 |
23 | 24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 |
32 | 33 |
34 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/customer/views/edit.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 | Customer Edit 6 |
7 |
8 | 9 |
10 | 11 | 12 | 13 | 14 |
15 |
16 | 19 | 20 | Cancel 21 | 22 |
23 | 24 |
25 | 26 |
27 | 28 |
29 | 30 | 31 |
32 |
33 | 34 |
35 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/core/config.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | var core = angular.module('app.core'); 5 | 6 | core.config(toastrConfig); 7 | 8 | toastrConfig.$inject = ['toastr']; 9 | /* @ngInject */ 10 | function toastrConfig(toastr) { 11 | toastr.options.timeOut = 4000; 12 | toastr.options.positionClass = 'toast-bottom-right'; 13 | } 14 | 15 | var config = { 16 | appErrorPrefix: '[CrudUI Error] ', 17 | appTitle: 'CrudUI' 18 | }; 19 | 20 | core.value('config', config); 21 | 22 | core.config(configure); 23 | 24 | configure.$inject = ['$logProvider', 'routerHelperProvider', 'exceptionHandlerProvider']; 25 | /* @ngInject */ 26 | function configure($logProvider, routerHelperProvider, exceptionHandlerProvider) { 27 | if ($logProvider.debugEnabled) { 28 | $logProvider.debugEnabled(true); 29 | } 30 | exceptionHandlerProvider.configure(config.appErrorPrefix); 31 | routerHelperProvider.configure({docTitle: config.appTitle + ': '}); 32 | } 33 | 34 | })(); 35 | -------------------------------------------------------------------------------- /CrudUI/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CrudUI", 3 | "version": "0.0.1", 4 | "description": "CrudUI", 5 | "authors": [], 6 | "license": "MIT", 7 | "ignore": [ 8 | "**/.*", 9 | "node_modules", 10 | "bower_components", 11 | "test", 12 | "tests" 13 | ], 14 | "devDependencies": { 15 | "angular-mocks": "~1.3.8", 16 | "sinon": "http://sinonjs.org/releases/sinon-1.12.1.js", 17 | "bardjs": "~0.0.3" 18 | }, 19 | "dependencies": { 20 | "jquery": "~2.1.0", 21 | "angular": "~1.3.8", 22 | "angular-sanitize": "~1.3.8", 23 | "angular-resource": "~1.3.8", 24 | "bootstrap": "~3.2.0", 25 | "extras.angular.plus": "~0.9.2", 26 | "font-awesome": "~4.2.0", 27 | "moment": "~2.6.0", 28 | "angular-ui-router": "~0.2.12", 29 | "toastr": "~2.1.0", 30 | "angular-animate": "~1.3.8", 31 | "angular-bootstrap": "~0.11.2", 32 | "ng-table": "~0.3.3", 33 | "api-check": "~6.0.10", 34 | "angular-formly": "~4.0.11", 35 | "angular-formly-templates-bootstrap": "~4.0.3" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/core/core.route.spec.js: -------------------------------------------------------------------------------- 1 | /* jshint -W117, -W030 */ 2 | describe('core', function() { 3 | describe('state', function() { 4 | var controller; 5 | var views = { 6 | four0four: 'app/core/404.html' 7 | }; 8 | 9 | beforeEach(function() { 10 | module('app.core', bard.fakeToastr); 11 | bard.inject('$location', '$rootScope', '$state', '$templateCache'); 12 | $templateCache.put(views.core, ''); 13 | }); 14 | 15 | it('should map /404 route to 404 View template', function() { 16 | expect($state.get('404').templateUrl).to.equal(views.four0four); 17 | }); 18 | 19 | it('of dashboard should work with $state.go', function() { 20 | $state.go('404'); 21 | $rootScope.$apply(); 22 | expect($state.is('404')); 23 | }); 24 | 25 | it('should route /invalid to the otherwise (404) route', function() { 26 | $location.path('/invalid'); 27 | $rootScope.$apply(); 28 | expect($state.current.templateUrl).to.equal(views.four0four); 29 | }); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/layout/shell.controller.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular 5 | .module('app.layout') 6 | .controller('ShellController', ShellController); 7 | 8 | ShellController.$inject = ['$rootScope', '$timeout', 'config', 'logger']; 9 | /* @ngInject */ 10 | function ShellController($rootScope, $timeout, config, logger) { 11 | var vm = this; 12 | vm.busyMessage = 'Please wait ...'; 13 | vm.isBusy = true; 14 | $rootScope.showSplash = true; 15 | vm.navline = { 16 | title: config.appTitle, 17 | text: 'Developed with generator-angular-crud', 18 | link: 'https://github.com/jlmonteagudo/generator-angular-crud' 19 | }; 20 | 21 | activate(); 22 | 23 | function activate() { 24 | logger.success(config.appTitle + ' loaded!', null); 25 | hideSplash(); 26 | } 27 | 28 | function hideSplash() { 29 | //Force a 1 second delay so we can see the splash. 30 | $timeout(function() { 31 | $rootScope.showSplash = false; 32 | }, 1000); 33 | } 34 | } 35 | })(); 36 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/dashboard/dashboard.route.spec.js: -------------------------------------------------------------------------------- 1 | /* jshint -W117, -W030 */ 2 | describe('dashboard routes', function () { 3 | describe('state', function () { 4 | var controller; 5 | var view = 'app/dashboard/dashboard.html'; 6 | 7 | beforeEach(function() { 8 | module('app.dashboard', bard.fakeToastr); 9 | bard.inject('$httpBackend', '$location', '$rootScope', '$state', '$templateCache'); 10 | }); 11 | 12 | beforeEach(function() { 13 | $templateCache.put(view, ''); 14 | }); 15 | 16 | bard.verifyNoOutstandingHttpRequests(); 17 | 18 | it('should map state dashboard to url / ', function() { 19 | expect($state.href('dashboard', {})).to.equal('/'); 20 | }); 21 | 22 | it('should map /dashboard route to dashboard View template', function () { 23 | expect($state.get('dashboard').templateUrl).to.equal(view); 24 | }); 25 | 26 | it('of dashboard should work with $state.go', function () { 27 | $state.go('dashboard'); 28 | $rootScope.$apply(); 29 | expect($state.is('dashboard')); 30 | }); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 27 | node_modules 28 | 29 | # More Stuff from cat history 30 | *.csv 31 | *.dat 32 | *.iml 33 | *.log 34 | *.out 35 | *.pid 36 | *.seed 37 | *.sublime-* 38 | *.swo 39 | *.swp 40 | *.tgz 41 | *.xml 42 | .DS_Store 43 | .idea 44 | .project 45 | .strong-pm 46 | .tmp/ 47 | coverage 48 | node_modules/ 49 | npm-debug.log 50 | #ignore thumbnails created by windows 51 | Thumbs.db 52 | #Ignore files build by Visual Studio 53 | *.user 54 | *.aps 55 | *.pch 56 | *.vspscc 57 | *_i.c 58 | *_p.c 59 | *.ncb 60 | *.suo 61 | *.bak 62 | *.cache 63 | *.ilk 64 | *.log 65 | [Bb]in 66 | [Dd]ebug*/ 67 | *.sbr 68 | obj/ 69 | [Rr]elease*/ 70 | _ReSharper*/ -------------------------------------------------------------------------------- /CrudUI/src/client/app/layout/sidebar.controller.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular 5 | .module('app.layout') 6 | .controller('SidebarController', SidebarController); 7 | 8 | SidebarController.$inject = ['$state', 'routerHelper']; 9 | /* @ngInject */ 10 | function SidebarController($state, routerHelper) { 11 | var vm = this; 12 | var states = routerHelper.getStates(); 13 | vm.isCurrent = isCurrent; 14 | 15 | activate(); 16 | 17 | function activate() { getNavRoutes(); } 18 | 19 | function getNavRoutes() { 20 | vm.navRoutes = states.filter(function(r) { 21 | return r.settings && r.settings.nav; 22 | }).sort(function(r1, r2) { 23 | return r1.settings.nav - r2.settings.nav; 24 | }); 25 | } 26 | 27 | function isCurrent(route) { 28 | if (!route.title || !$state.current || !$state.current.title) { 29 | return ''; 30 | } 31 | var menuName = route.title; 32 | return $state.current.title.substr(0, menuName.length) === menuName ? 'current' : ''; 33 | } 34 | } 35 | })(); 36 | -------------------------------------------------------------------------------- /CrudAPI/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CrudAPI", 3 | "private": true, 4 | "version": "0.0.0", 5 | "description": "a Sails application", 6 | "keywords": [], 7 | "dependencies": { 8 | "ejs": "~0.8.4", 9 | "grunt": "0.4.2", 10 | "grunt-contrib-clean": "~0.5.0", 11 | "grunt-contrib-coffee": "~0.10.1", 12 | "grunt-contrib-concat": "~0.3.0", 13 | "grunt-contrib-copy": "~0.5.0", 14 | "grunt-contrib-cssmin": "~0.9.0", 15 | "grunt-contrib-jst": "~0.6.0", 16 | "grunt-contrib-less": "0.11.1", 17 | "grunt-contrib-uglify": "~0.4.0", 18 | "grunt-contrib-watch": "~0.5.3", 19 | "grunt-sails-linker": "~0.9.5", 20 | "grunt-sync": "~0.0.4", 21 | "include-all": "~0.1.3", 22 | "lodash": "^3.10.1", 23 | "rc": "~0.5.0", 24 | "sails": "~0.11.0", 25 | "sails-disk": "~0.10.0", 26 | "jsonwebtoken": "*", 27 | "bcrypt-nodejs": "*", 28 | "passport": "*", 29 | "passport-jwt": "*", 30 | "passport-local": "*" 31 | }, 32 | "scripts": { 33 | "debug": "node debug app.js", 34 | "start": "node app.js" 35 | }, 36 | "main": "app.js", 37 | "repository": { 38 | "type": "git", 39 | "url": "git://github.com/cat/CrudAPI.git" 40 | }, 41 | "author": "cat", 42 | "license": "" 43 | } 44 | -------------------------------------------------------------------------------- /CrudAPI/api/services/CipherService.js: -------------------------------------------------------------------------------- 1 | var bcrypt = require('bcrypt-nodejs'); 2 | var jwt = require('jsonwebtoken'); 3 | 4 | module.exports = { 5 | secret: sails.config.jwtSettings.secret, 6 | issuer: sails.config.jwtSettings.issuer, 7 | audience: sails.config.jwtSettings.audience, 8 | 9 | /** 10 | * Hash the password field of the passed user. 11 | */ 12 | hashPassword: function (user) { 13 | if (user.password) { 14 | user.password = bcrypt.hashSync(user.password); 15 | } 16 | }, 17 | 18 | /** 19 | * Compare user password hash with unhashed password 20 | * @returns boolean indicating a match 21 | */ 22 | comparePassword: function(password, user){ 23 | return bcrypt.compareSync(password, user.password); 24 | }, 25 | 26 | /** 27 | * Create a token based on the passed user 28 | * @param user 29 | */ 30 | createToken: function(user) 31 | { 32 | return jwt.sign({ 33 | user: user.toJSON() 34 | }, 35 | sails.config.jwtSettings.secret, 36 | { 37 | algorithm: sails.config.jwtSettings.algorithm, 38 | expiresInMinutes: sails.config.jwtSettings.expiresInMinutes, 39 | issuer: sails.config.jwtSettings.issuer, 40 | audience: sails.config.jwtSettings.audience 41 | } 42 | ); 43 | } 44 | }; -------------------------------------------------------------------------------- /CrudAPI/config/locales/_README.md: -------------------------------------------------------------------------------- 1 | # Internationalization / Localization Settings 2 | 3 | > Also see the official docs on internationalization/localization: 4 | > http://links.sailsjs.org/docs/config/locales 5 | 6 | ## Locales 7 | All locale files live under `config/locales`. Here is where you can add translations 8 | as JSON key-value pairs. The name of the file should match the language that you are supporting, which allows for automatic language detection based on request headers. 9 | 10 | Here is an example locale stringfile for the Spanish language (`config/locales/es.json`): 11 | ```json 12 | { 13 | "Hello!": "Hola!", 14 | "Hello %s, how are you today?": "¿Hola %s, como estas?", 15 | } 16 | ``` 17 | ## Usage 18 | Locales can be accessed in controllers/policies through `res.i18n()`, or in views through the `__(key)` or `i18n(key)` functions. 19 | Remember that the keys are case sensitive and require exact key matches, e.g. 20 | 21 | ```ejs 22 |

<%= __('Welcome to PencilPals!') %>

23 |

<%= i18n('Hello %s, how are you today?', 'Pencil Maven') %>

24 |

<%= i18n('That\'s right-- you can use either i18n() or __()') %>

25 | ``` 26 | 27 | ## Configuration 28 | Localization/internationalization config can be found in `config/i18n.js`, from where you can set your supported locales. 29 | -------------------------------------------------------------------------------- /CrudAPI/config/log.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Built-in Log Configuration 3 | * (sails.config.log) 4 | * 5 | * Configure the log level for your app, as well as the transport 6 | * (Underneath the covers, Sails uses Winston for logging, which 7 | * allows for some pretty neat custom transports/adapters for log messages) 8 | * 9 | * For more information on the Sails logger, check out: 10 | * http://sailsjs.org/#!/documentation/concepts/Logging 11 | */ 12 | 13 | module.exports.log = { 14 | 15 | /*************************************************************************** 16 | * * 17 | * Valid `level` configs: i.e. the minimum log level to capture with * 18 | * sails.log.*() * 19 | * * 20 | * The order of precedence for log levels from lowest to highest is: * 21 | * silly, verbose, info, debug, warn, error * 22 | * * 23 | * You may also set the level to "silent" to suppress all logs. * 24 | * * 25 | ***************************************************************************/ 26 | 27 | // level: 'info' 28 | 29 | }; 30 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/layout/ht-top-nav.html: -------------------------------------------------------------------------------- 1 | 32 | -------------------------------------------------------------------------------- /CrudAPI/tasks/config/jst.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Precompiles Underscore templates to a `.jst` file. 3 | * 4 | * --------------------------------------------------------------- 5 | * 6 | * (i.e. basically it takes HTML files and turns them into tiny little 7 | * javascript functions that you pass data to and return HTML. This can 8 | * speed up template rendering on the client, and reduce bandwidth usage.) 9 | * 10 | * For usage docs see: 11 | * https://github.com/gruntjs/grunt-contrib-jst 12 | * 13 | */ 14 | 15 | module.exports = function(grunt) { 16 | 17 | grunt.config.set('jst', { 18 | dev: { 19 | 20 | // To use other sorts of templates, specify a regexp like the example below: 21 | // options: { 22 | // templateSettings: { 23 | // interpolate: /\{\{(.+?)\}\}/g 24 | // } 25 | // }, 26 | 27 | // Note that the interpolate setting above is simply an example of overwriting lodash's 28 | // default interpolation. If you want to parse templates with the default _.template behavior 29 | // (i.e. using
), there's no need to overwrite `templateSettings.interpolate`. 30 | 31 | 32 | files: { 33 | // e.g. 34 | // 'relative/path/from/gruntfile/to/compiled/template/destination' : ['relative/path/to/sourcefiles/**/*.html'] 35 | '.tmp/public/jst.js': require('../pipeline').templateFilesToInject 36 | } 37 | } 38 | }); 39 | 40 | grunt.loadNpmTasks('grunt-contrib-jst'); 41 | }; 42 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/blocks/logger/logger.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular 5 | .module('blocks.logger') 6 | .factory('logger', logger); 7 | 8 | logger.$inject = ['$log', 'toastr']; 9 | 10 | /* @ngInject */ 11 | function logger($log, toastr) { 12 | var service = { 13 | showToasts: true, 14 | 15 | error : error, 16 | info : info, 17 | success : success, 18 | warning : warning, 19 | 20 | // straight to console; bypass toastr 21 | log : $log.log 22 | }; 23 | 24 | return service; 25 | ///////////////////// 26 | 27 | function error(message, data, title) { 28 | toastr.error(message, title); 29 | $log.error('Error: ' + message, data); 30 | } 31 | 32 | function info(message, data, title) { 33 | toastr.info(message, title); 34 | $log.info('Info: ' + message, data); 35 | } 36 | 37 | function success(message, data, title) { 38 | toastr.success(message, title); 39 | $log.info('Success: ' + message, data); 40 | } 41 | 42 | function warning(message, data, title) { 43 | toastr.warning(message, title); 44 | $log.warn('Warning: ' + message, data); 45 | } 46 | } 47 | }()); 48 | -------------------------------------------------------------------------------- /CrudUI/src/client/test-helpers/bind-polyfill.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Phantom.js does not support Function.prototype.bind (at least not before v.2.0 3 | * That's just crazy. Everybody supports bind. 4 | * Read about it here: https://groups.google.com/forum/#!msg/phantomjs/r0hPOmnCUpc/uxusqsl2LNoJ 5 | * This polyfill is copied directly from MDN 6 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Compatibility 7 | */ 8 | if (!Function.prototype.bind) { 9 | /*jshint freeze: false */ 10 | Function.prototype.bind = function (oThis) { 11 | if (typeof this !== 'function') { 12 | // closest thing possible to the ECMAScript 5 13 | // internal IsCallable function 14 | var msg = 'Function.prototype.bind - what is trying to be bound is not callable'; 15 | throw new TypeError(msg); 16 | } 17 | 18 | var aArgs = Array.prototype.slice.call(arguments, 1), 19 | fToBind = this, 20 | FuncNoOp = function () {}, 21 | fBound = function () { 22 | return fToBind.apply(this instanceof FuncNoOp && oThis ? this : oThis, 23 | aArgs.concat(Array.prototype.slice.call(arguments))); 24 | }; 25 | 26 | FuncNoOp.prototype = this.prototype; 27 | fBound.prototype = new FuncNoOp(); 28 | 29 | return fBound; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /CrudUI/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "bitwise": true, 3 | "camelcase": true, 4 | "curly": true, 5 | "eqeqeq": true, 6 | "es3": false, 7 | "forin": true, 8 | "freeze": true, 9 | "immed": true, 10 | "indent": 4, 11 | "latedef": "nofunc", 12 | "newcap": true, 13 | "noarg": true, 14 | "noempty": true, 15 | "nonbsp": true, 16 | "nonew": true, 17 | "plusplus": false, 18 | "quotmark": "single", 19 | "undef": true, 20 | "unused": false, 21 | "strict": false, 22 | "maxparams": 10, 23 | "maxdepth": 5, 24 | "maxstatements": 40, 25 | "maxcomplexity": 8, 26 | "maxlen": 120, 27 | 28 | "asi": false, 29 | "boss": false, 30 | "debug": false, 31 | "eqnull": true, 32 | "esnext": false, 33 | "evil": false, 34 | "expr": false, 35 | "funcscope": false, 36 | "globalstrict": false, 37 | "iterator": false, 38 | "lastsemic": false, 39 | "laxbreak": false, 40 | "laxcomma": false, 41 | "loopfunc": true, 42 | "maxerr": 50, 43 | "moz": false, 44 | "multistr": false, 45 | "notypeof": false, 46 | "proto": false, 47 | "scripturl": false, 48 | "shadow": false, 49 | "sub": true, 50 | "supernew": false, 51 | "validthis": false, 52 | "noyield": false, 53 | 54 | "browser": true, 55 | "node": true, 56 | 57 | "globals": { 58 | "angular": false 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /CrudUI/src/client/test-helpers/mock-data.js: -------------------------------------------------------------------------------- 1 | /* jshint -W079 */ 2 | var mockData = (function() { 3 | return { 4 | getMockPeople: getMockPeople, 5 | getMockStates: getMockStates 6 | }; 7 | 8 | function getMockStates() { 9 | return [ 10 | { 11 | state: 'dashboard', 12 | config: { 13 | url: '/', 14 | templateUrl: 'app/dashboard/dashboard.html', 15 | title: 'dashboard', 16 | settings: { 17 | nav: 1, 18 | content: ' Dashboard' 19 | } 20 | } 21 | } 22 | ]; 23 | } 24 | 25 | function getMockPeople() { 26 | return [ 27 | {firstName: 'John', lastName: 'Papa', age: 25, location: 'Florida'}, 28 | {firstName: 'Ward', lastName: 'Bell', age: 31, location: 'California'}, 29 | {firstName: 'Colleen', lastName: 'Jones', age: 21, location: 'New York'}, 30 | {firstName: 'Madelyn', lastName: 'Green', age: 18, location: 'North Dakota'}, 31 | {firstName: 'Ella', lastName: 'Jobs', age: 18, location: 'South Dakota'}, 32 | {firstName: 'Landon', lastName: 'Gates', age: 11, location: 'South Carolina'}, 33 | {firstName: 'Haley', lastName: 'Guthrie', age: 35, location: 'Wyoming'} 34 | ]; 35 | } 36 | })(); 37 | -------------------------------------------------------------------------------- /CrudAPI/api/responses/ok.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 200 (OK) Response 3 | * 4 | * Usage: 5 | * return res.ok(); 6 | * return res.ok(data); 7 | * return res.ok(data, 'auth/login'); 8 | * 9 | * @param {Object} data 10 | * @param {String|Object} options 11 | * - pass string to render specified view 12 | */ 13 | 14 | module.exports = function sendOK (data, options) { 15 | 16 | // Get access to `req`, `res`, & `sails` 17 | var req = this.req; 18 | var res = this.res; 19 | var sails = req._sails; 20 | 21 | sails.log.silly('res.ok() :: Sending 200 ("OK") response'); 22 | 23 | // Set status code 24 | res.status(200); 25 | 26 | // If appropriate, serve data as JSON(P) 27 | if (req.wantsJSON) { 28 | return res.jsonx(data); 29 | } 30 | 31 | // If second argument is a string, we take that to mean it refers to a view. 32 | // If it was omitted, use an empty object (`{}`) 33 | options = (typeof options === 'string') ? { view: options } : options || {}; 34 | 35 | // If a view was provided in options, serve it. 36 | // Otherwise try to guess an appropriate view, or if that doesn't 37 | // work, just send JSON. 38 | if (options.view) { 39 | return res.view(options.view, { data: data }); 40 | } 41 | 42 | // If no second argument provided, try to serve the implied view, 43 | // but fall back to sending JSON(P) if no view can be inferred. 44 | else return res.guessView({ data: data }, function couldNotGuessView () { 45 | return res.jsonx(data); 46 | }); 47 | 48 | }; 49 | -------------------------------------------------------------------------------- /CrudAPI/config/env/production.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Production environment settings 3 | * 4 | * This file can include shared settings for a production environment, 5 | * such as API keys or remote database passwords. If you're using 6 | * a version control solution for your Sails app, this file will 7 | * be committed to your repository unless you add it to your .gitignore 8 | * file. If your repository will be publicly viewable, don't add 9 | * any private information to this file! 10 | * 11 | */ 12 | 13 | module.exports = { 14 | 15 | /*************************************************************************** 16 | * Set the default database connection for models in the production * 17 | * environment (see config/connections.js and config/models.js ) * 18 | ***************************************************************************/ 19 | 20 | // models: { 21 | // connection: 'someMysqlServer' 22 | // }, 23 | 24 | /*************************************************************************** 25 | * Set the port in the production environment to 80 * 26 | ***************************************************************************/ 27 | 28 | // port: 80, 29 | 30 | /*************************************************************************** 31 | * Set the log level in production environment to "silent" * 32 | ***************************************************************************/ 33 | 34 | // log: { 35 | // level: "silent" 36 | // } 37 | 38 | }; 39 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/core/404.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
    7 |
  • 8 |
    9 |
    10 | 404Page Not Found 11 |
    12 |
    13 |
  • 14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 |
23 | No soup for you! 24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | 34 | 35 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/dashboard/dashboard.controller.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | angular 5 | .module('app.dashboard') 6 | .controller('DashboardController', DashboardController); 7 | 8 | DashboardController.$inject = ['$q', 'dataservice', 'logger']; 9 | /* @ngInject */ 10 | function DashboardController($q, dataservice, logger) { 11 | var vm = this; 12 | vm.news = { 13 | title: 'CrudUI', 14 | description: 'generator-angular-crud allows creating entities ' + 15 | 'and CRUD operations very productively for AngularJS applications' 16 | }; 17 | vm.messageCount = 0; 18 | vm.people = []; 19 | vm.title = 'Dashboard'; 20 | 21 | activate(); 22 | 23 | function activate() { 24 | var promises = [getMessageCount(), getPeople()]; 25 | return $q.all(promises).then(function() { 26 | //logger.info('Activated Dashboard View'); 27 | }); 28 | } 29 | 30 | function getMessageCount() { 31 | return dataservice.getMessageCount().then(function (data) { 32 | vm.messageCount = data; 33 | return vm.messageCount; 34 | }); 35 | } 36 | 37 | function getPeople() { 38 | return dataservice.getPeople().then(function (data) { 39 | vm.people = data; 40 | return vm.people; 41 | }); 42 | } 43 | } 44 | })(); 45 | -------------------------------------------------------------------------------- /CrudAPI/config/models.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Default model configuration 3 | * (sails.config.models) 4 | * 5 | * Unless you override them, the following properties will be included 6 | * in each of your models. 7 | * 8 | * For more info on Sails models, see: 9 | * http://sailsjs.org/#!/documentation/concepts/ORM 10 | */ 11 | 12 | module.exports.models = { 13 | 14 | /*************************************************************************** 15 | * * 16 | * Your app's default connection. i.e. the name of one of your app's * 17 | * connections (see `config/connections.js`) * 18 | * * 19 | ***************************************************************************/ 20 | // connection: 'localDiskDb', 21 | 22 | /*************************************************************************** 23 | * * 24 | * How and whether Sails will attempt to automatically rebuild the * 25 | * tables/collections/etc. in your schema. * 26 | * * 27 | * See http://sailsjs.org/#!/documentation/concepts/ORM/model-settings.html * 28 | * * 29 | ***************************************************************************/ 30 | // migrate: 'alter' 31 | migrate: 'drop' 32 | 33 | }; 34 | -------------------------------------------------------------------------------- /CrudAPI/api/models/User.js: -------------------------------------------------------------------------------- 1 | /** 2 | * User.js 3 | * 4 | * @description :: TODO: You might write a short summary of how this model works and what it represents here. 5 | * @docs :: http://sailsjs.org/#!documentation/models 6 | */ 7 | 8 | module.exports = { 9 | schema: true, 10 | attributes: { 11 | username: { 12 | type: 'string', 13 | required: true, 14 | unique: true, 15 | alphanumericdashed: true 16 | }, 17 | password: { 18 | type: 'string' 19 | }, 20 | email: { 21 | type: 'string', 22 | //email: true, 23 | required: true, 24 | unique: true 25 | }, 26 | firstName: { 27 | type: 'string', 28 | defaultsTo: '' 29 | }, 30 | lastName: { 31 | type: 'string', 32 | defaultsTo: '' 33 | }, 34 | photo: { 35 | type: 'string', 36 | defaultsTo: '', 37 | url: true 38 | }, 39 | socialProfiles: { 40 | type: 'object', 41 | defaultsTo: {} 42 | }, 43 | 44 | toJSON: function () { 45 | var obj = this.toObject(); 46 | delete obj.password; 47 | delete obj.socialProfiles; 48 | return obj; 49 | } 50 | }, 51 | beforeUpdate: function (values, next) { 52 | CipherService.hashPassword(values); 53 | next(); 54 | }, 55 | beforeCreate: function (values, next) { 56 | CipherService.hashPassword(values); 57 | next(); 58 | } 59 | }; 60 | 61 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/layout/sidebar.controller.spec.js: -------------------------------------------------------------------------------- 1 | /* jshint -W117, -W030 */ 2 | describe('layout', function() { 3 | describe('sidebar', function() { 4 | var controller; 5 | var views = { 6 | dashboard: 'app/dashboard/dashboard.html', 7 | customers: 'app/customers/customers.html' 8 | }; 9 | 10 | beforeEach(function() { 11 | module('app.layout', bard.fakeToastr); 12 | bard.inject('$controller', '$httpBackend', '$location', 13 | '$rootScope', '$state', 'routerHelper'); 14 | }); 15 | 16 | beforeEach(function() { 17 | routerHelper.configureStates(mockData.getMockStates(), '/'); 18 | controller = $controller('SidebarController'); 19 | $rootScope.$apply(); 20 | }); 21 | 22 | bard.verifyNoOutstandingHttpRequests(); 23 | 24 | it('should have isCurrent() for / to return `current`', function() { 25 | $location.path('/'); 26 | expect(controller.isCurrent($state.current)).to.equal('current'); 27 | }); 28 | 29 | it('should have isCurrent() for /customers to return `current`', function() { 30 | $location.path('/customers'); 31 | expect(controller.isCurrent($state.current)).to.equal('current'); 32 | }); 33 | 34 | it('should have isCurrent() for non route not return `current`', function() { 35 | $location.path('/invalid'); 36 | expect(controller.isCurrent({title: 'invalid'})).not.to.equal('current'); 37 | }); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /CrudUI/src/client/app/layout/ht-sidebar.directive.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | angular 5 | .module('app.layout') 6 | .directive('htSidebar', htSidebar); 7 | 8 | /* @ngInject */ 9 | function htSidebar () { 10 | // Opens and closes the sidebar menu. 11 | // Usage: 12 | //
13 | //
14 | // Creates: 15 | //