15 |
16 |
17 | 15 | 26 | 27 |
├── 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 |
-------------------------------------------------------------------------------- /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 |
15 |
16 |
17 | <%= 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 |