
├── .gitignore
├── README.md
├── hot-towel-done
├── .bowerrc
├── .editorconfig
├── .gitignore
├── .jscsrc
├── .jshintrc
├── README.md
├── bower.json
├── gulp.config.js
├── gulp.png
├── gulpfile.js
├── karma.conf.js
├── package.json
└── src
│ ├── client
│ ├── app
│ │ ├── admin
│ │ │ ├── admin.controller.js
│ │ │ ├── admin.controller.spec.js
│ │ │ ├── admin.html
│ │ │ ├── admin.module.js
│ │ │ ├── admin.route.js
│ │ │ ├── admin.route.spec.js
│ │ │ └── i18n
│ │ │ │ ├── en.json
│ │ │ │ └── es.json
│ │ ├── app.module.js
│ │ ├── blocks
│ │ │ ├── exception
│ │ │ │ ├── exception-handler.provider.js
│ │ │ │ ├── exception-handler.provider.spec.js
│ │ │ │ ├── exception.js
│ │ │ │ └── exception.module.js
│ │ │ ├── logger
│ │ │ │ ├── logger.js
│ │ │ │ └── logger.module.js
│ │ │ └── router
│ │ │ │ ├── router-helper.provider.js
│ │ │ │ └── router.module.js
│ │ ├── core
│ │ │ ├── 404.html
│ │ │ ├── config.js
│ │ │ ├── constants.js
│ │ │ ├── core.module.js
│ │ │ ├── core.route.js
│ │ │ ├── core.route.spec.js
│ │ │ ├── dataservice.js
│ │ │ └── i18n
│ │ │ │ ├── en.json
│ │ │ │ └── es.json
│ │ ├── dashboard
│ │ │ ├── dashboard.controller.js
│ │ │ ├── dashboard.controller.spec.js
│ │ │ ├── dashboard.html
│ │ │ ├── dashboard.module.js
│ │ │ ├── dashboard.route.js
│ │ │ ├── dashboard.route.spec.js
│ │ │ └── i18n
│ │ │ │ ├── en.json
│ │ │ │ └── es.json
│ │ ├── i18n
│ │ │ ├── en.json
│ │ │ └── es.json
│ │ ├── layout
│ │ │ ├── ht-sidebar.directive.js
│ │ │ ├── ht-sidebar.directive.spec.js
│ │ │ ├── ht-top-nav.directive.js
│ │ │ ├── ht-top-nav.html
│ │ │ ├── layout.module.js
│ │ │ ├── shell.controller.js
│ │ │ ├── shell.controller.spec.js
│ │ │ ├── shell.html
│ │ │ ├── sidebar.controller.js
│ │ │ ├── sidebar.controller.spec.js
│ │ │ └── sidebar.html
│ │ └── widgets
│ │ │ ├── ht-img-person.directive.js
│ │ │ ├── ht-widget-header.directive.js
│ │ │ ├── ht-widget-towel.directive.js
│ │ │ ├── widget-header.html
│ │ │ ├── widget-ht-towel.html
│ │ │ └── widgets.module.js
│ ├── images
│ │ ├── AngularJS-small.png
│ │ ├── busy.gif
│ │ ├── gulp-tiny.png
│ │ └── icon.png
│ ├── index.html
│ ├── specs.html
│ ├── styles
│ │ └── styles.less
│ └── test-helpers
│ │ ├── bind-polyfill.js
│ │ └── mock-data.js
│ └── server
│ ├── app.js
│ ├── data.js
│ ├── favicon.ico
│ ├── routes.js
│ └── utils
│ └── 404.js
└── hot-towel
├── .bowerrc
├── .gitignore
├── .jscsrc
├── .jshintrc
├── README.md
├── bower.json
├── gulp.config.js
├── gulp.png
├── gulpfile.js
├── karma.conf.js
├── package.json
└── src
├── client
├── app
│ ├── admin
│ │ ├── admin.controller.js
│ │ ├── admin.controller.spec.js
│ │ ├── admin.html
│ │ ├── admin.module.js
│ │ ├── admin.route.js
│ │ └── admin.route.spec.js
│ ├── app.module.js
│ ├── blocks
│ │ ├── exception
│ │ │ ├── exception-handler.provider.js
│ │ │ ├── exception-handler.provider.spec.js
│ │ │ ├── exception.js
│ │ │ └── exception.module.js
│ │ ├── logger
│ │ │ ├── logger.js
│ │ │ └── logger.module.js
│ │ └── router
│ │ │ ├── router-helper.provider.js
│ │ │ └── router.module.js
│ ├── core
│ │ ├── 404.html
│ │ ├── config.js
│ │ ├── constants.js
│ │ ├── core.module.js
│ │ ├── core.route.js
│ │ ├── core.route.spec.js
│ │ └── dataservice.js
│ ├── dashboard
│ │ ├── dashboard.controller.js
│ │ ├── dashboard.controller.spec.js
│ │ ├── dashboard.html
│ │ ├── dashboard.module.js
│ │ ├── dashboard.route.js
│ │ └── dashboard.route.spec.js
│ ├── layout
│ │ ├── ht-sidebar.directive.js
│ │ ├── ht-sidebar.directive.spec.js
│ │ ├── ht-top-nav.directive.js
│ │ ├── ht-top-nav.html
│ │ ├── layout.module.js
│ │ ├── shell.controller.js
│ │ ├── shell.controller.spec.js
│ │ ├── shell.html
│ │ ├── sidebar.controller.js
│ │ ├── sidebar.controller.spec.js
│ │ └── sidebar.html
│ └── widgets
│ │ ├── ht-img-person.directive.js
│ │ ├── ht-widget-header.directive.js
│ │ ├── ht-widget-towel.directive.js
│ │ ├── widget-header.html
│ │ ├── widget-ht-towel.html
│ │ └── widgets.module.js
├── images
│ ├── AngularJS-small.png
│ ├── busy.gif
│ ├── gulp-tiny.png
│ └── icon.png
├── index.html
├── specs.html
├── styles
│ └── styles.less
└── test-helpers
│ ├── bind-polyfill.js
│ └── mock-data.js
└── server
├── app.js
├── data.js
├── favicon.ico
├── routes.js
└── utils
└── 404.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Dependency directory
2 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
3 | node_modules/
4 | bower_components/
5 |
6 | # other
7 | .tmp
8 | /hot-towel/report/
9 | /hot-towel-done/report/
10 | hot-towel/report/
11 | hot-towel-done/report/
12 | /hot-towel/.editorconfig
13 | /hot-towel-done/.editorconfig
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # angular-i18n
2 | Internationalization in Angular
3 |
4 | - `/hot-towel/` is a clean slate, generated hot-towel Angular SPA that can be used to follow along with my course: [Play by Play: Angular Internationalization with John Papa and Brian Clark](http://jpapa.me/pbpi18nclark)
5 | - `/hot-towel-done/` is the completed hot-towel Angular SPA that resulted from the Play by Play course.
6 |
7 | > Instructions to run each project are in their corresponding README.md file.
8 |
--------------------------------------------------------------------------------
/hot-towel-done/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "bower_components",
3 | "scripts": {
4 | "postinstall": "gulp wiredep"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/hot-towel-done/.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 |
--------------------------------------------------------------------------------
/hot-towel-done/.gitignore:
--------------------------------------------------------------------------------
1 | # Dependency directory
2 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
3 | node_modules/
4 | bower_components/
5 |
6 | # other
7 | .tmp
8 | /hot-towel-done/report/
9 | /build/
--------------------------------------------------------------------------------
/hot-towel-done/.jscsrc:
--------------------------------------------------------------------------------
1 | {
2 | "excludeFiles": ["node_modules/**", "bower_components/**"],
3 |
4 | "requireCurlyBraces": [
5 | "if",
6 | "else",
7 | "for",
8 | "while",
9 | "do",
10 | "try",
11 | "catch"
12 | ],
13 | "requireOperatorBeforeLineBreak": true,
14 | "requireCamelCaseOrUpperCaseIdentifiers": true,
15 | "maximumLineLength": {
16 | "value": 200,
17 | "allowComments": true,
18 | "allowRegex": true
19 | },
20 | "validateIndentation": 4,
21 | "validateQuoteMarks": "'",
22 |
23 | "disallowMultipleLineStrings": true,
24 | "disallowMixedSpacesAndTabs": true,
25 | "disallowTrailingWhitespace": false,
26 | "disallowSpaceAfterPrefixUnaryOperators": true,
27 | "disallowMultipleVarDecl": null,
28 |
29 | "requireSpaceAfterKeywords": [
30 | "if",
31 | "else",
32 | "for",
33 | "while",
34 | "do",
35 | "switch",
36 | "return",
37 | "try",
38 | "catch"
39 | ],
40 | "requireSpaceBeforeBinaryOperators": [
41 | "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
42 | "&=", "|=", "^=", "+=",
43 |
44 | "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
45 | "|", "^", "&&", "||", "===", "==", ">=",
46 | "<=", "<", ">", "!=", "!=="
47 | ],
48 | "requireSpaceAfterBinaryOperators": true,
49 | "requireSpacesInConditionalExpression": true,
50 | "requireSpaceBeforeBlockStatements": true,
51 | "requireLineFeedAtFileEnd": true,
52 | "disallowSpacesInsideObjectBrackets": "all",
53 | "disallowSpacesInsideArrayBrackets": "all",
54 | "disallowSpacesInsideParentheses": true,
55 |
56 | "jsDoc": {
57 | "checkAnnotations": true,
58 | "checkParamNames": true,
59 | "requireParamTypes": true,
60 | "checkReturnTypes": true,
61 | "checkTypes": true
62 | },
63 |
64 | "disallowMultipleLineBreaks": true,
65 |
66 | "disallowCommaBeforeLineBreak": null,
67 | "disallowDanglingUnderscores": null,
68 | "disallowEmptyBlocks": null,
69 | "disallowTrailingComma": null,
70 | "requireCommaBeforeLineBreak": null,
71 | "requireDotNotation": null,
72 | "requireMultipleVarDecl": null,
73 | "requireParenthesesAroundIIFE": true
74 | }
75 |
--------------------------------------------------------------------------------
/hot-towel-done/.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 |
--------------------------------------------------------------------------------
/hot-towel-done/README.md:
--------------------------------------------------------------------------------
1 | # hot-towel
2 |
3 | **Generated from HotTowel Angular**
4 |
5 | >*Opinionated Angular style guide for teams by [@john_papa](//twitter.com/john_papa)*
6 |
7 | >More details about the styles and patterns used in this app can be found in my [Angular Style Guide](https://github.com/johnpapa/angularjs-styleguide) and my [Angular Patterns: Clean Code](http://jpapa.me/ngclean) course at [Pluralsight](http://pluralsight.com/training/Authors/Details/john-papa) and working in teams.
8 |
9 | ## Prerequisites
10 |
11 | 1. Install [Node.js](http://nodejs.org)
12 | - on OSX use [homebrew](http://brew.sh) `brew install node`
13 | - on Windows use [chocolatey](https://chocolatey.org/) `choco install nodejs`
14 |
15 | 2. Install Yeoman `npm install -g yo`
16 |
17 | 3. Install these NPM packages globally
18 |
19 | ```bash
20 | npm install -g bower gulp nodemon
21 | ```
22 |
23 | >Refer to these [instructions on how to not require sudo](https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md)
24 |
25 | ## Running HotTowel
26 |
27 | ### Linting
28 | - Run code analysis using `gulp vet`. This runs jshint, jscs, and plato.
29 |
30 | ### Tests
31 | - Run the unit tests using `gulp test` (via karma, mocha, sinon).
32 |
33 | ### Running in dev mode
34 | - Run the project with `gulp serve-dev`
35 |
36 | - opens it in a browser and updates the browser with any files changes.
37 |
38 | ### Building the project
39 | - Build the optimized project using `gulp build`
40 | - This create the optimized code for the project and puts it in the build folder
41 |
42 | ### Running the optimized code
43 | - Run the optimize project from the build folder with `gulp serve-build`
44 |
45 | ## Exploring HotTowel
46 | HotTowel Angular starter project
47 |
48 | ### Structure
49 | The structure also contains a gulpfile.js and a server folder. The server is there just so we can serve the app using node. Feel free to use any server you wish.
50 |
51 | /src
52 | /client
53 | /app
54 | /content
55 |
56 | ### Installing Packages
57 | When you generate the project it should run these commands, but if you notice missing packages, run these again:
58 |
59 | - `npm install`
60 | - `bower install`
61 |
62 | ### The Modules
63 | The app has 4 feature modules and depends on a series of external modules and custom but cross-app modules
64 |
65 | ```
66 | app --> [
67 | app.admin --> [
68 | app.core,
69 | app.widgets
70 | ],
71 | app.dashboard --> [
72 | app.core,
73 | app.widgets
74 | ],
75 | app.layout --> [
76 | app.core
77 | ],
78 | app.widgets,
79 | app.core --> [
80 | ngAnimate,
81 | ngSanitize,
82 | ui.router,
83 | blocks.exception,
84 | blocks.logger,
85 | blocks.router
86 | ]
87 | ]
88 | ```
89 |
90 | #### core Module
91 | Core modules are ones that are shared throughout the entire application and may be customized for the specific application. Example might be common data services.
92 |
93 | This is an aggregator of modules that the application will need. The `core` module takes the blocks, common, and Angular sub-modules as dependencies.
94 |
95 | #### blocks Modules
96 | Block modules are reusable blocks of code that can be used across projects simply by including them as dependencies.
97 |
98 | ##### blocks.logger Module
99 | The `blocks.logger` module handles logging across the Angular app.
100 |
101 | ##### blocks.exception Module
102 | The `blocks.exception` module handles exceptions across the Angular app.
103 |
104 | It depends on the `blocks.logger` module, because the implementation logs the exceptions.
105 |
106 | ##### blocks.router Module
107 | The `blocks.router` module contains a routing helper module that assists in adding routes to the $routeProvider.
108 |
109 | ## Gulp Tasks
110 |
111 | ### Task Listing
112 |
113 | - `gulp help`
114 |
115 | Displays all of the available gulp tasks.
116 |
117 | ### Code Analysis
118 |
119 | - `gulp vet`
120 |
121 | Performs static code analysis on all javascript files. Runs jshint and jscs.
122 |
123 | - `gulp vet --verbose`
124 |
125 | Displays all files affected and extended information about the code analysis.
126 |
127 | - `gulp plato`
128 |
129 | Performs code analysis using plato on all javascript files. Plato generates a report in the reports folder.
130 |
131 | ### Testing
132 |
133 | - `gulp serve-specs`
134 |
135 | Serves and browses to the spec runner html page and runs the unit tests in it. Injects any changes on the fly and re runs the tests. Quick and easy view of tests as an alternative to terminal via `gulp test`.
136 |
137 | - `gulp test`
138 |
139 | Runs all unit tests using karma runner, mocha, chai and sinon with phantomjs. Depends on vet task, for code analysis.
140 |
141 | - `gulp test --startServers`
142 |
143 | Runs all unit tests and midway tests. Cranks up a second node process to run a server for the midway tests to hit a web api.
144 |
145 | - `gulp autotest`
146 |
147 | Runs a watch to run all unit tests.
148 |
149 | - `gulp autotest --startServers`
150 |
151 | Runs a watch to run all unit tests and midway tests. Cranks up a second node process to run a server for the midway tests to hit a web api.
152 |
153 | ### Cleaning Up
154 |
155 | - `gulp clean`
156 |
157 | Remove all files from the build and temp folders
158 |
159 | - `gulp clean-images`
160 |
161 | Remove all images from the build folder
162 |
163 | - `gulp clean-code`
164 |
165 | Remove all javascript and html from the build folder
166 |
167 | - `gulp clean-fonts`
168 |
169 | Remove all fonts from the build folder
170 |
171 | - `gulp clean-styles`
172 |
173 | Remove all styles from the build folder
174 |
175 | ### Fonts and Images
176 |
177 | - `gulp fonts`
178 |
179 | Copy all fonts from source to the build folder
180 |
181 | - `gulp images`
182 |
183 | Copy all images from source to the build folder
184 |
185 | ### Styles
186 |
187 | - `gulp styles`
188 |
189 | Compile less files to CSS, add vendor prefixes, and copy to the build folder
190 |
191 | ### Bower Files
192 |
193 | - `gulp wiredep`
194 |
195 | Looks up all bower components' main files and JavaScript source code, then adds them to the `index.html`.
196 |
197 | The `.bowerrc` file also runs this as a postinstall task whenever `bower install` is run.
198 |
199 | ### Angular HTML Templates
200 |
201 | - `gulp templatecache`
202 |
203 | Create an Angular module that adds all HTML templates to Angular's $templateCache. This pre-fetches all HTML templates saving XHR calls for the HTML.
204 |
205 | - `gulp templatecache --verbose`
206 |
207 | Displays all files affected by the task.
208 |
209 | ### Serving Development Code
210 |
211 | - `gulp serve-dev`
212 |
213 | Serves the development code and launches it in a browser. The goal of building for development is to do it as fast as possible, to keep development moving efficiently. This task serves all code from the source folders and compiles less to css in a temp folder.
214 |
215 | - `gulp serve-dev --nosync`
216 |
217 | Serves the development code without launching the browser.
218 |
219 | - `gulp serve-dev --debug`
220 |
221 | Launch debugger with node-inspector.
222 |
223 | - `gulp serve-dev --debug-brk`
224 |
225 | Launch debugger and break on 1st line with node-inspector.
226 |
227 | ### Building Production Code
228 |
229 | - `gulp optimize`
230 |
231 | Optimize all javascript and styles, move to a build folder, and inject them into the new index.html
232 |
233 | - `gulp build`
234 |
235 | Copies all fonts, copies images and runs `gulp optimize` to build the production code to the build folder.
236 |
237 | ### Serving Production Code
238 |
239 | - `gulp serve-build`
240 |
241 | Serve the optimized code from the build folder and launch it in a browser.
242 |
243 | - `gulp serve-build --nosync`
244 |
245 | Serve the optimized code from the build folder and manually launch the browser.
246 |
247 | - `gulp serve-build --debug`
248 |
249 | Launch debugger with node-inspector.
250 |
251 | - `gulp serve-build --debug-brk`
252 |
253 | Launch debugger and break on 1st line with node-inspector.
254 |
255 | ### Bumping Versions
256 |
257 | - `gulp bump`
258 |
259 | Bump the minor version using semver.
260 | --type=patch // default
261 | --type=minor
262 | --type=major
263 | --type=pre
264 | --ver=1.2.3 // specific version
265 |
266 | ## License
267 |
268 | MIT
269 |
--------------------------------------------------------------------------------
/hot-towel-done/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hot-towel",
3 | "version": "0.0.1",
4 | "description": "hot-towel",
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.4.5",
16 | "sinon": "http://sinonjs.org/releases/sinon-1.12.1.js",
17 | "bardjs": "^0.1.4"
18 | },
19 | "dependencies": {
20 | "jquery": "^2.1.4",
21 | "angular": "^1.4.5",
22 | "angular-sanitize": "^1.4.5",
23 | "bootstrap": "~3.2.0",
24 | "extras.angular.plus": "^0.9.2",
25 | "font-awesome": "^4.3.0",
26 | "moment": "^2.10.3",
27 | "angular-ui-router": "^0.2.15",
28 | "toastr": "^2.1.1",
29 | "angular-animate": "^1.4.5",
30 | "angular-translate": "~2.8.1",
31 | "angular-translate-handler-log": "~2.8.1",
32 | "angular-translate-interpolation-messageformat": "~2.8.1",
33 | "angular-translate-loader-partial": "~2.8.1",
34 | "angular-translate-loader-static-files": "~2.8.1"
35 | },
36 | "resolutions": {
37 | "angular": "1.3.17"
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/hot-towel-done/gulp.config.js:
--------------------------------------------------------------------------------
1 | module.exports = function() {
2 | var client = './src/client/';
3 | var server = './src/server/';
4 | var clientApp = client + 'app/';
5 | var report = './report/';
6 | var root = './';
7 | var specRunnerFile = 'specs.html';
8 | var temp = './.tmp/';
9 | var wiredep = require('wiredep');
10 | var bowerFiles = wiredep({devDependencies: true})['js'];
11 | var bower = {
12 | json: require('./bower.json'),
13 | directory: './bower_components/',
14 | ignorePath: '../..'
15 | };
16 | var nodeModules = 'node_modules';
17 |
18 | var config = {
19 | /**
20 | * File paths
21 | */
22 | // all javascript that we want to vet
23 | alljs: [
24 | './src/**/*.js',
25 | './*.js'
26 | ],
27 | build: './build/',
28 | client: client,
29 | css: temp + 'styles.css',
30 | fonts: bower.directory + 'font-awesome/fonts/**/*.*',
31 | html: client + '**/*.html',
32 | htmltemplates: clientApp + '**/*.html',
33 | images: client + 'images/**/*.*',
34 | index: client + 'index.html',
35 | // app js, with no specs
36 | js: [
37 | clientApp + '**/*.module.js',
38 | clientApp + '**/*.js',
39 | '!' + clientApp + '**/*.spec.js'
40 | ],
41 | jsOrder: [
42 | '**/app.module.js',
43 | '**/*.module.js',
44 | '**/*.js'
45 | ],
46 | less: client + 'styles/styles.less',
47 | report: report,
48 | root: root,
49 | server: server,
50 | source: 'src/',
51 | stubsjs: [
52 | bower.directory + 'angular-mocks/angular-mocks.js',
53 | client + 'stubs/**/*.js'
54 | ],
55 | temp: temp,
56 |
57 | /**
58 | * optimized files
59 | */
60 | optimized: {
61 | app: 'app.js',
62 | lib: 'lib.js'
63 | },
64 |
65 | /**
66 | * plato
67 | */
68 | plato: {js: clientApp + '**/*.js'},
69 |
70 | /**
71 | * browser sync
72 | */
73 | browserReloadDelay: 1000,
74 |
75 | /**
76 | * template cache
77 | */
78 | templateCache: {
79 | file: 'templates.js',
80 | options: {
81 | module: 'app.core',
82 | root: 'app/',
83 | standalone: false
84 | }
85 | },
86 |
87 | /**
88 | * Bower and NPM files
89 | */
90 | bower: bower,
91 | packages: [
92 | './package.json',
93 | './bower.json'
94 | ],
95 |
96 | /**
97 | * specs.html, our HTML spec runner
98 | */
99 | specRunner: client + specRunnerFile,
100 | specRunnerFile: specRunnerFile,
101 |
102 | /**
103 | * The sequence of the injections into specs.html:
104 | * 1 testlibraries
105 | * mocha setup
106 | * 2 bower
107 | * 3 js
108 | * 4 spechelpers
109 | * 5 specs
110 | * 6 templates
111 | */
112 | testlibraries: [
113 | nodeModules + '/mocha/mocha.js',
114 | nodeModules + '/chai/chai.js',
115 | nodeModules + '/sinon-chai/lib/sinon-chai.js'
116 | ],
117 | specHelpers: [client + 'test-helpers/*.js'],
118 | specs: [clientApp + '**/*.spec.js'],
119 | serverIntegrationSpecs: [client + '/tests/server-integration/**/*.spec.js'],
120 |
121 | /**
122 | * Node settings
123 | */
124 | nodeServer: server + 'app.js',
125 | defaultPort: '8001'
126 | };
127 |
128 | /**
129 | * wiredep and bower settings
130 | */
131 | config.getWiredepDefaultOptions = function() {
132 | var options = {
133 | bowerJson: config.bower.json,
134 | directory: config.bower.directory,
135 | ignorePath: config.bower.ignorePath
136 | };
137 | return options;
138 | };
139 |
140 | /**
141 | * karma settings
142 | */
143 | config.karma = getKarmaOptions();
144 |
145 | return config;
146 |
147 | ////////////////
148 |
149 | function getKarmaOptions() {
150 | var options = {
151 | files: [].concat(
152 | bowerFiles,
153 | config.specHelpers,
154 | clientApp + '**/*.module.js',
155 | clientApp + '**/*.js',
156 | temp + config.templateCache.file,
157 | config.serverIntegrationSpecs
158 | ),
159 | exclude: [],
160 | coverage: {
161 | dir: report + 'coverage',
162 | reporters: [
163 | // reporters not supporting the `file` property
164 | {type: 'html', subdir: 'report-html'},
165 | {type: 'lcov', subdir: 'report-lcov'},
166 | {type: 'text-summary'} //, subdir: '.', file: 'text-summary.txt'}
167 | ]
168 | },
169 | preprocessors: {}
170 | };
171 | options.preprocessors[clientApp + '**/!(*.spec)+(.js)'] = ['coverage'];
172 | return options;
173 | }
174 | };
175 |
--------------------------------------------------------------------------------
/hot-towel-done/gulp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clarkio/angular-i18n/6ddf392c770ed885d6147faab9bd6a60c4e25437/hot-towel-done/gulp.png
--------------------------------------------------------------------------------
/hot-towel-done/karma.conf.js:
--------------------------------------------------------------------------------
1 | module.exports = function(config) {
2 | var gulpConfig = require('./gulp.config')();
3 |
4 | config.set({
5 | // base path that will be used to resolve all patterns (eg. files, exclude)
6 | basePath: './',
7 |
8 | // frameworks to use
9 | // some available frameworks: https://npmjs.org/browse/keyword/karma-adapter
10 | frameworks: ['mocha', 'chai', 'sinon', 'chai-sinon'],
11 |
12 | // list of files / patterns to load in the browser
13 | files: gulpConfig.karma.files,
14 |
15 | // list of files to exclude
16 | exclude: gulpConfig.karma.exclude,
17 |
18 | proxies: {
19 | '/': 'http://localhost:8888/'
20 | },
21 |
22 | // preprocess matching files before serving them to the browser
23 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
24 | preprocessors: gulpConfig.karma.preprocessors,
25 |
26 | // test results reporter to use
27 | // possible values: 'dots', 'progress', 'coverage'
28 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter
29 | reporters: ['progress', 'coverage'],
30 |
31 | coverageReporter: {
32 | dir: gulpConfig.karma.coverage.dir,
33 | reporters: gulpConfig.karma.coverage.reporters
34 | },
35 |
36 | // web server port
37 | port: 9876,
38 |
39 | // enable / disable colors in the output (reporters and logs)
40 | colors: true,
41 |
42 | // level of logging
43 | // possible values: config.LOG_DISABLE || config.LOG_ERROR ||
44 | // config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
45 | logLevel: config.LOG_INFO,
46 |
47 | // enable / disable watching file and executing tests whenever any file changes
48 | autoWatch: true,
49 |
50 | // start these browsers
51 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
52 | // browsers: ['Chrome', 'ChromeCanary', 'FirefoxAurora', 'Safari', 'PhantomJS'],
53 | browsers: ['PhantomJS'],
54 |
55 | // Continuous Integration mode
56 | // if true, Karma captures browsers, runs the tests and exits
57 | singleRun: false
58 | });
59 | };
60 |
--------------------------------------------------------------------------------
/hot-towel-done/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hot-towel",
3 | "description": "hot-towel Project Generated from HotTowel Angular",
4 | "version": "0.0.0",
5 | "scripts": {
6 | "init": "npm install",
7 | "install": "bower install",
8 | "start": "node src/server/app.js",
9 | "test": "gulp test"
10 | },
11 | "dependencies": {
12 | "body-parser": "^1.8.2",
13 | "express": "^4.9.3",
14 | "morgan": "^1.1.1",
15 | "serve-favicon": "^2.0.1"
16 | },
17 | "devDependencies": {
18 | "browser-sync": "^2.7.13",
19 | "chai": "^3.1.0",
20 | "chai-as-promised": "^5.1.0",
21 | "chalk": "^1.1.0",
22 | "dateformat": "^1.0.8-1.2.3",
23 | "debug": "^2.0.0",
24 | "del": "^1.2.0",
25 | "glob": "^4.5.3",
26 | "gulp": "^3.8.10",
27 | "gulp-angular-templatecache": "^1.4.2",
28 | "gulp-autoprefixer": "^2.3.1",
29 | "gulp-bump": "^0.3.1",
30 | "gulp-bytediff": "^0.2.0",
31 | "gulp-concat": "^2.3.3",
32 | "gulp-filter": "^2.0.2",
33 | "gulp-header": "^1.2.2",
34 | "gulp-if": "^1.2.5",
35 | "gulp-imagemin": "^2.3.0",
36 | "gulp-inject": "^1.0.1",
37 | "gulp-jscs": "^2.0.0",
38 | "gulp-jshint": "^1.7.1",
39 | "gulp-less": "^3.0.1",
40 | "gulp-load-plugins": "^1.0.0-rc.1",
41 | "gulp-minify-css": "^1.1.1",
42 | "gulp-minify-html": "^1.0.4",
43 | "gulp-ng-annotate": "^1.0.0",
44 | "gulp-nodemon": "^2.0.3",
45 | "gulp-order": "^1.1.1",
46 | "gulp-plumber": "^1.0.1",
47 | "gulp-print": "^1.1.0",
48 | "gulp-rev": "^5.1.0",
49 | "gulp-rev-replace": "^0.4.2",
50 | "gulp-sourcemaps": "^1.1.5",
51 | "gulp-task-listing": "^1.0.0",
52 | "gulp-uglify": "^1.0.1",
53 | "gulp-useref": "^1.0.2",
54 | "gulp-util": "^3.0.1",
55 | "jshint-stylish": "^2.0.1",
56 | "karma": "^0.13.2",
57 | "karma-chai": "^0.1.0",
58 | "karma-chai-sinon": "^0.1.3",
59 | "karma-chrome-launcher": "^0.2.0",
60 | "karma-coverage": "^0.4.2",
61 | "karma-firefox-launcher": "^0.1.3",
62 | "karma-growl-reporter": "^0.1.1",
63 | "karma-mocha": "^0.2.0",
64 | "karma-phantomjs-launcher": "^0.2.0",
65 | "karma-safari-launcher": "^0.1.1",
66 | "karma-sinon": "^1.0.3",
67 | "lodash": "^3.10.0",
68 | "method-override": "^2.3.4",
69 | "minimist": "^1.1.0",
70 | "mocha": "^2.2.5",
71 | "node-notifier": "^4.0.3",
72 | "phantomjs": "^1.9.17",
73 | "plato": "^1.2.0",
74 | "q": "^1.0.1",
75 | "sinon": "^1.12.2",
76 | "sinon-chai": "^2.6.0",
77 | "wiredep": "^2.2.2",
78 | "yargs": "^3.15.0"
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/hot-towel-done/src/client/app/admin/admin.controller.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | 'use strict';
3 |
4 | angular
5 | .module('app.admin')
6 | .controller('AdminController', AdminController);
7 |
8 | AdminController.$inject = ['logger', '$translate'];
9 | /* @ngInject */
10 | function AdminController(logger, $translate) {
11 | var vm = this;
12 | vm.title = 'Admin';
13 |
14 | activate();
15 |
16 | function activate() {
17 | $translate('Activation_Admin').then(function (translation) {
18 | logger.info(translation);
19 | });
20 | }
21 | }
22 | })();
23 |
--------------------------------------------------------------------------------
/hot-towel-done/src/client/app/admin/admin.controller.spec.js:
--------------------------------------------------------------------------------
1 | /* jshint -W117, -W030 */
2 | describe('AdminController', function() {
3 | var controller;
4 |
5 | beforeEach(function() {
6 | bard.appModule('app.admin');
7 | bard.inject('$controller', '$log', '$rootScope');
8 | });
9 |
10 | beforeEach(function () {
11 | controller = $controller('AdminController');
12 | $rootScope.$apply();
13 | });
14 |
15 | bard.verifyNoOutstandingHttpRequests();
16 |
17 | describe('Admin controller', function() {
18 | it('should be created successfully', function () {
19 | expect(controller).to.be.defined;
20 | });
21 |
22 | describe('after activate', function() {
23 | it('should have title of Admin', function() {
24 | expect(controller.title).to.equal('Admin');
25 | });
26 |
27 | it('should have logged "Activated"', function() {
28 | expect($log.info.logs).to.match(/Activated/);
29 | });
30 | });
31 | });
32 | });
33 |
--------------------------------------------------------------------------------
/hot-towel-done/src/client/app/admin/admin.html:
--------------------------------------------------------------------------------
1 |
' + (error.statusText || '') +
75 | ': ' + (error.status || '');
76 | logger.warning(msg, [toState]);
77 | $location.path('/');
78 | }
79 | );
80 | }
81 |
82 | function init() {
83 | handleRoutingErrors();
84 | updateDocTitle();
85 | }
86 |
87 | function getStates() { return $state.get(); }
88 |
89 | function updateDocTitle() {
90 | $rootScope.$on('$stateChangeSuccess',
91 | function(event, toState, toParams, fromState, fromParams) {
92 | stateCounts.changes++;
93 | handlingStateChangeError = false;
94 | var title = config.docTitle + ' ' + (toState.title || '');
95 | $rootScope.title = title; // data bind to