├── api
├── models
│ └── .gitkeep
├── services
│ └── .gitkeep
├── controllers
│ ├── .gitkeep
│ ├── dashboard
│ │ ├── userController.js
│ │ ├── dashboardController.js
│ │ ├── User.ts
│ │ └── Dashboard.ts
│ ├── homeController.js
│ ├── Home.ts
│ └── CoreController.ts
├── policies
│ └── sessionAuth.js
└── responses
│ ├── ok.js
│ ├── badRequest.js
│ ├── forbidden.js
│ ├── serverError.js
│ └── notFound.js
├── assets
├── images
│ └── .gitkeep
├── templates
│ └── .gitkeep
├── favicon.ico
├── robots.txt
├── styles
│ └── importer.less
└── linker
│ └── js
│ └── lib
│ ├── circular-json.min.js
│ └── toasts.js
├── views
├── _layouts
│ ├── _partials
│ │ ├── _jsAfter.ejs
│ │ ├── _dynamicTemplates.ejs
│ │ ├── _dynamicStyles.ejs
│ │ ├── _injectScripts.ejs
│ │ ├── _meta.ejs
│ │ ├── _config.ejs
│ │ ├── _dynamicScriptsHead.ejs
│ │ ├── _ie.ejs
│ │ ├── README.md
│ │ ├── _dynamicScripts.ejs
│ │ ├── _body.ejs
│ │ └── _main.ejs
│ ├── dashboard
│ │ └── _main.ejs
│ ├── default
│ │ └── _main.ejs
│ ├── default.ejs
│ └── dashboard.ejs
├── dashboard
│ ├── user
│ │ └── index.ejs
│ └── dashboard
│ │ └── index.ejs
├── home
│ ├── index.ejs
│ └── help_center.ejs
├── _partials
│ └── _displayFlashMessages.ejs
├── 403.ejs
├── 404.ejs
├── layout.ejs
└── homepage.ejs
├── .sailsrc
├── config
├── locales
│ ├── de.json
│ ├── en.json
│ ├── fr.json
│ ├── es.json
│ └── _README.md
├── bootstrap.js
├── env
│ ├── development.js
│ └── production.js
├── log.js
├── models.js
├── policies.js
├── routes.js
├── i18n.js
├── csrf.js
├── globals.js
├── cors.js
├── http.js
├── session.js
├── connections.js
├── local.js
├── views.js
├── sockets.js
└── blueprints.js
├── typings
├── tsd.d.ts
├── loader.d.ts
├── lodash.string.d.ts
└── underscore.string
│ └── underscore.string.d.ts
├── tasks
├── register
│ ├── syncAssets.js
│ ├── build.js
│ ├── compileAssets.js
│ ├── default.js
│ ├── buildProd.js
│ ├── linkAssets.js
│ ├── linkAssetsBuild.js
│ ├── linkAssetsBuildProd.js
│ └── prod.js
├── config
│ ├── clean.js
│ ├── uglify.js
│ ├── cssmin.js
│ ├── typedoc.js
│ ├── sync.js
│ ├── less.js
│ ├── concat.js
│ ├── newer.js
│ ├── watch.js
│ ├── coffee.js
│ ├── copy.js
│ ├── ts.js
│ ├── jst.js
│ └── sails-linker.js
├── pipeline.js
└── README.md
├── .editorconfig
├── tsd.json
├── package.json
├── app.js
├── .gitignore
├── Gruntfile.js
└── README.md
/api/models/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/api/services/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/assets/images/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/api/controllers/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/assets/templates/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/views/_layouts/_partials/_jsAfter.ejs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/views/dashboard/user/index.ejs:
--------------------------------------------------------------------------------
1 | User index page
2 |
--------------------------------------------------------------------------------
/.sailsrc:
--------------------------------------------------------------------------------
1 | {
2 | "generators": {
3 | "modules": {}
4 | }
5 | }
--------------------------------------------------------------------------------
/views/_layouts/dashboard/_main.ejs:
--------------------------------------------------------------------------------
1 | <%- partial('../_partials/main') %>
--------------------------------------------------------------------------------
/views/_layouts/_partials/_dynamicTemplates.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/assets/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Vadorequest/sails-typescript/HEAD/assets/favicon.ico
--------------------------------------------------------------------------------
/views/home/index.ejs:
--------------------------------------------------------------------------------
1 | Here is the home/index.ejs file!
2 |
3 | Help center
4 |
--------------------------------------------------------------------------------
/config/locales/de.json:
--------------------------------------------------------------------------------
1 | {
2 | "Welcome": "Willkommen",
3 | "A brand new app.": "Eine neue App."
4 | }
5 |
--------------------------------------------------------------------------------
/config/locales/en.json:
--------------------------------------------------------------------------------
1 | {
2 | "Welcome": "Welcome",
3 | "A brand new app.": "A brand new app."
4 | }
5 |
--------------------------------------------------------------------------------
/config/locales/fr.json:
--------------------------------------------------------------------------------
1 | {
2 | "Welcome": "Bienvenue",
3 | "A brand new app.": "Une toute nouvelle application."
4 | }
5 |
--------------------------------------------------------------------------------
/views/_layouts/default/_main.ejs:
--------------------------------------------------------------------------------
1 |
2 | <%- partial('../_partials/main') %>
3 |
--------------------------------------------------------------------------------
/config/locales/es.json:
--------------------------------------------------------------------------------
1 | {
2 | "Welcome": "Bienvenido",
3 | "A brand new app.": "Una aplicación de la nueva marca."
4 | }
5 |
--------------------------------------------------------------------------------
/views/dashboard/dashboard/index.ejs:
--------------------------------------------------------------------------------
1 | Dashboard index page
2 |
3 | Go to user dashboard's page
4 |
--------------------------------------------------------------------------------
/views/home/help_center.ejs:
--------------------------------------------------------------------------------
1 | Here is the home/help_center.ejs file with a custom name that isn't the controller method's name!
2 |
--------------------------------------------------------------------------------
/typings/tsd.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
--------------------------------------------------------------------------------
/views/_layouts/_partials/_dynamicStyles.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/typings/loader.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | declare var CircularJSON: any;
5 |
--------------------------------------------------------------------------------
/typings/lodash.string.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | declare module _ {
4 | interface LoDashStatic {
5 | str: any;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/views/_layouts/_partials/_injectScripts.ejs:
--------------------------------------------------------------------------------
1 | <%/* Scripts that can be passed by the view using the "script" function. See https://github.com/RandomEtc/ejs-locals */%>
2 | <%- scripts%>
--------------------------------------------------------------------------------
/views/_layouts/_partials/_meta.ejs:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/views/_layouts/_partials/_config.ejs:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/views/_layouts/_partials/_dynamicScriptsHead.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 4
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/views/_layouts/_partials/_ie.ejs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tasks/register/default.js:
--------------------------------------------------------------------------------
1 | module.exports = function (grunt) {
2 | grunt.registerTask('default', [
3 | 'compileAssets',
4 | 'linkAssets',
5 | 'ts:server_commonJs',// Compile TS files
6 | 'watch'
7 | ]);
8 | };
9 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/api/controllers/dashboard/userController.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | *
4 | * @module :: Controller
5 | * @description ::
6 | */
7 | var Controller = require('./User').Controllers.User;
8 |
9 | /**
10 | * Bind public controller methods.
11 | */
12 | module.exports = new Controller().exports();
--------------------------------------------------------------------------------
/api/controllers/dashboard/dashboardController.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | *
4 | * @module :: Controller
5 | * @description ::
6 | */
7 | var Controller = require('./Dashboard').Controllers.Dashboard;
8 |
9 | /**
10 | * Bind public controller methods.
11 | */
12 | module.exports = new Controller().exports();
--------------------------------------------------------------------------------
/api/controllers/homeController.js:
--------------------------------------------------------------------------------
1 | /**
2 | * HomeController
3 | *
4 | * @module :: Controller
5 | * @description :: Home page.
6 | */
7 | var Controller = require('./Home').Controllers.Home;
8 |
9 | /**
10 | * Bind public controller methods.
11 | */
12 | module.exports = new Controller().exports();
13 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/tasks/register/linkAssets.js:
--------------------------------------------------------------------------------
1 | module.exports = function (grunt) {
2 | grunt.registerTask('linkAssets', [
3 | 'sails-linker:devJsBefore',
4 | 'sails-linker:devJs',
5 | 'sails-linker:devStyles',
6 | 'sails-linker:devTpl',
7 | 'sails-linker:devJsJade',
8 | 'sails-linker:devStylesJade',
9 | 'sails-linker:devTplJade'
10 | ]);
11 | };
12 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/views/_layouts/_partials/README.md:
--------------------------------------------------------------------------------
1 | # Shared layouts
2 |
3 | **This folder is for all shared partials that will be used only by layouts.**
4 |
5 | ## Dynamic files.
6 | Dynamic files that start by the `dynamic` keyword contain auto generated content, they shouldn't be changed by hand.
7 | The content is reloaded each time the server restart or when a the `Gruntfile.js` is changed.
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/views/_layouts/_partials/_dynamicScripts.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tsd.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "v4",
3 | "repo": "borisyankov/DefinitelyTyped",
4 | "ref": "master",
5 | "path": "typings",
6 | "bundle": "typings/tsd.d.ts",
7 | "installed": {
8 | "lodash/lodash.d.ts": {
9 | "commit": "be03157bace6e6465e63f13073d7b68e8ea1303c"
10 | },
11 | "underscore.string/underscore.string.d.ts": {
12 | "commit": "be03157bace6e6465e63f13073d7b68e8ea1303c"
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/views/_partials/_displayFlashMessages.ejs:
--------------------------------------------------------------------------------
1 | <% /* Display all messages */ %>
2 | <% if(messages){%>
3 |
14 | <% } %>
15 |
--------------------------------------------------------------------------------
/views/_layouts/_partials/_body.ejs:
--------------------------------------------------------------------------------
1 | <% /* Generates body classes depending on the current layout, controller, action, theme and language used. */ %>
2 |
3 |
4 | <%/* Specific stuff by layout. */%>
5 | <% if(layout == 'default'){%>
6 |
7 | <%}else if(layout == 'dashboard'){%>
8 |
9 | <%}%>
10 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/views/_layouts/_partials/_main.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <% /* If user not connected, add "container" class */ %>
5 | <% /* Load the public partial to display a group of messages. */ %>
6 | <%- partial('../../_partials/displayFlashMessages', {messages: flash.messages}) %>
7 |
8 | <% /* Load the view content, depending on the called url. */ %>
9 | <%- body %>
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/tasks/config/typedoc.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Génération de la documentation typescript.
3 | *
4 | * @see http://typedoc.io/guides/installation.html
5 | */
6 | module.exports = function(grunt) {
7 | grunt.config.set('typedoc', {
8 | typedoc: {
9 | options: {
10 | module: 'commonjs',
11 | target: 'es5',
12 | out: 'documentation/Developper Guide',
13 | name: 'Ayolan Translatation'
14 | },
15 | src: [
16 | 'api/**/*.ts',
17 | 'assets/**/*.ts',
18 | 'shared/**/*.ts'
19 | ]
20 | }
21 | });
22 |
23 | grunt.loadNpmTasks('grunt-typedoc');
24 | };
25 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | global.CircularJSON = require('circular-json');
15 |
16 | // It's very important to trigger this callback method when you are finished
17 | // with the bootstrap! (otherwise your server will never lift, since it's waiting on the bootstrap)
18 | cb();
19 | };
20 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/tasks/config/newer.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Allow to filter a set of filepath to only kep those that have been updated since:
3 | * - (default) the last time the "newer" task ran.
4 | * - a specified folder.
5 | *
6 | * @param grunt
7 | * @see https://github.com/tschaub/grunt-newer
8 | */
9 | module.exports = function(grunt) {
10 | grunt.config.set('newer', {
11 | newer: {
12 | options: {
13 | //cache: 'path/to/custom/cache/directory',
14 | //override: function(detail, include) {
15 | // if (detail.task === 'less') {
16 | // checkForModifiedImports(detail.path, detail.time, include);
17 | // } else {
18 | // include(false);
19 | // }
20 | //}
21 | }
22 | }
23 | });
24 |
25 | grunt.loadNpmTasks('grunt-newer');
26 | };
27 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/tasks/config/ts.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Compile TS files to JS.
3 | *
4 | * @see https://github.com/TypeStrong/grunt-ts
5 | */
6 | module.exports = function(grunt) {
7 | grunt.config.set('ts', {
8 | server_commonJs: {
9 | files: [
10 | {
11 | src: [
12 | 'api/**/*.ts'
13 | ],
14 | dest: ''// Will generate at the exact same location as the source.
15 | }
16 | ],
17 |
18 | options: {
19 | module: 'commonjs',
20 | target: 'es5',
21 | fast: 'watch',
22 | comments: true,
23 | sourceMap: false,// Useless on the server side.
24 | declaration: true,// Always useful to have declarations available.
25 | noEmitOnError: false,// Force log errors.
26 | failOnTypeErrors: true,// Force log grunt errors pipeline.
27 | verbose: true
28 | }
29 | }
30 | });
31 |
32 | grunt.loadNpmTasks('grunt-ts');
33 | };
34 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "app",
3 | "private": true,
4 | "version": "0.0.0",
5 | "description": "a Sails application",
6 | "keywords": [],
7 | "dependencies": {
8 | "circular-json": "^0.1.6",
9 | "ejs": "~0.8.4",
10 | "grunt": "0.4.2",
11 | "grunt-contrib-clean": "~0.5.0",
12 | "grunt-contrib-coffee": "~0.10.1",
13 | "grunt-contrib-concat": "~0.3.0",
14 | "grunt-contrib-copy": "~0.5.0",
15 | "grunt-contrib-cssmin": "~0.9.0",
16 | "grunt-contrib-jst": "~0.6.0",
17 | "grunt-contrib-less": "0.11.1",
18 | "grunt-contrib-uglify": "~0.4.0",
19 | "grunt-contrib-watch": "~0.5.3",
20 | "grunt-newer": "^1.1.1",
21 | "grunt-sails-linker": "~0.9.5",
22 | "grunt-sync": "~0.0.4",
23 | "grunt-ts": "^4.2.0-beta.1",
24 | "grunt-typedoc": "^0.2.2",
25 | "include-all": "~0.1.3",
26 | "rc": "~0.5.0",
27 | "sails": "~0.11.1-rc1",
28 | "sails-disk": "~0.10.0"
29 | },
30 | "scripts": {
31 | "debug": "node debug app.js",
32 | "start": "node app.js"
33 | },
34 | "main": "app.js",
35 | "repository": {
36 | "type": "git",
37 | "url": "git://github.com/anonymous node/sails user/app.git"
38 | },
39 | "author": "anonymous node/sails user",
40 | "license": ""
41 | }
42 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/views/_layouts/default.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <%= title %>
5 |
6 | <%/* Additional shared meta. */%>
7 | <%- partial('_partials/meta')%>
8 |
9 | <%/* Inject configuration. */%>
10 | <%- partial('_partials/config')%>
11 |
12 | <%/* Inject dynamic styles. */%>
13 | <%- partial('_partials/dynamicStyles')%>
14 |
15 | <%/* Inject all dynamic scripts that must be required on top level. */%>
16 | <%- partial('_partials/dynamicScriptsHead')%>
17 |
18 | <%/* Specific IE includes. */%>
19 | <%- partial('_partials/ie')%>
20 |
21 | <%/* Specific scripts to include. Managed by ejs-locals */%>
22 | <%- partial('_partials/injectScripts')%>
23 |
24 | <%/* Inject any scripts that would be specific to the view - i.e: script('/js/foo.js') */%>
25 | <%- scripts%>
26 |
27 | <%/* Inject any stylesheets that would be specific to the view - i.e: stylesheet('/css/foo.css') */%>
28 | <%- stylesheets%>
29 |
30 |
31 |
32 | <% /* Inject body tag with specific classes. */ %>
33 | <%- partial('_partials/body')%>
34 |
35 | <%- partial('default/main') %>
36 |
37 | <%/* Inject templates. */%>
38 | <%- partial('_partials/dynamicTemplates')%>
39 |
40 | <%/* Inject all scripts left. */%>
41 | <%- partial('_partials/dynamicScripts')%>
42 |
43 | <%/* Required shared scripts. Loader and requirejs. */%>
44 | <%- partial('_partials/jsAfter')%>
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/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 |
32 | };
33 |
--------------------------------------------------------------------------------
/views/_layouts/dashboard.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <%= title %>
5 |
6 | <%/* Additional shared meta. */%>
7 | <%- partial('_partials/meta')%>
8 |
9 | <%/* Inject configuration. */%>
10 | <%- partial('_partials/config')%>
11 |
12 | <%/* Inject dynamic styles. */%>
13 | <%- partial('_partials/dynamicStyles')%>
14 |
15 | <%/* Inject all dynamic scripts that must be required on top level. */%>
16 | <%- partial('_partials/dynamicScriptsHead')%>
17 |
18 | <%/* Specific IE includes. */%>
19 | <%- partial('_partials/ie')%>
20 |
21 | <%/* Specific scripts to include. Managed by ejs-locals */%>
22 | <%- partial('_partials/injectScripts')%>
23 |
24 | <%/* Inject any scripts that would be specific to the view - i.e: script('/js/foo.js') */%>
25 | <%- scripts%>
26 |
27 | <%/* Inject any stylesheets that would be specific to the view - i.e: stylesheet('/css/foo.css') */%>
28 | <%- stylesheets%>
29 |
30 |
31 |
32 | <% /* Inject body tag with specific classes. */ %>
33 | <%- partial('_partials/body')%>
34 |
35 | <%- partial('dashboard/main') %>
36 |
37 | <%/* Inject templates. */%>
38 | <%- partial('_partials/dynamicTemplates')%>
39 |
40 | <%/* Inject all scripts left. */%>
41 | <%- partial('_partials/dynamicScripts')%>
42 |
43 | <%/* Required shared scripts. Loader and requirejs. */%>
44 | <%- partial('_partials/jsAfter')%>
45 |
46 |
47 |