├── .bowerrc ├── .editorconfig ├── .gitignore ├── .jscsrc ├── .jshintrc ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── bower.json ├── config.xml ├── gulp ├── config.js └── tasks │ ├── bower-install.js │ ├── default.js │ ├── install-source-modules.js │ ├── js-prepare.js │ ├── source.js │ ├── style-guide.js │ ├── styles.js │ └── watch.js ├── gulpfile.js ├── hooks ├── README.md └── after_prepare │ └── 010_add_platform_class.js ├── ionic.project ├── modules └── .keep ├── package.json ├── scripts ├── install │ ├── install-modules.js │ ├── install-search.js │ └── install-submodules.js ├── ted.js └── watch │ └── watch.js ├── src ├── app.js ├── img │ └── ionic.png ├── index.html ├── modals │ └── login.html ├── scss │ └── main.scss ├── shared │ ├── configure-keyboard.js │ ├── configure-status-bar.js │ ├── ig-button-loading │ │ ├── ig-button-loading.controller.js │ │ ├── ig-button-loading.directive.js │ │ └── ig-button-loading.spec.js │ └── wait │ │ └── wait.directive.js └── states │ ├── browse │ ├── route.js │ └── template.html │ ├── come-back │ ├── controller.js │ ├── route.js │ └── template.html │ ├── index │ └── route.js │ ├── infinite-scroll │ ├── controller.js │ ├── route.js │ └── template.html │ ├── loading │ ├── controller.js │ ├── route.js │ └── template.html │ ├── playlists │ ├── controller.js │ ├── route.js │ └── template.html │ ├── refresher │ ├── controller.js │ ├── route.js │ └── template.html │ ├── search │ ├── route.js │ └── template.html │ ├── sidemenu │ ├── controller.js │ ├── route.js │ └── template.html │ ├── single │ ├── controller.js │ ├── route.js │ └── template.html │ └── spinners │ ├── controller.js │ ├── route.js │ └── template.html └── www └── .keep /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "src/lib" 3 | } 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | root = true 3 | 4 | [*] 5 | end_of_line = lf 6 | insert_final_newline = true 7 | charset = utf-8 8 | indent_size = 2 9 | indent_style = space 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Specifies intentionally untracked files to ignore when using Git 2 | # http://git-scm.com/docs/gitignore 3 | 4 | node_modules/ 5 | platforms/ 6 | plugins/ 7 | src/lib/ 8 | npm-debug.log 9 | modules/* 10 | !modules/.keep 11 | .idea 12 | www/* 13 | !www/.keep 14 | -------------------------------------------------------------------------------- /.jscsrc: -------------------------------------------------------------------------------- 1 | { 2 | "excludeFiles": ["src/ngLocale/**"], 3 | "disallowKeywords": ["with"], 4 | "disallowKeywordsOnNewLine": ["else"], 5 | "disallowMixedSpacesAndTabs": true, 6 | "disallowMultipleLineStrings": true, 7 | "disallowNewlineBeforeBlockStatements": true, 8 | "disallowSpaceAfterObjectKeys": true, 9 | "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], 10 | "disallowSpaceBeforeBinaryOperators": [","], 11 | "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], 12 | "disallowSpacesInAnonymousFunctionExpression": { 13 | "beforeOpeningRoundBrace": true 14 | }, 15 | "disallowSpacesInCallExpression": true, 16 | "disallowSpacesInFunctionDeclaration": { 17 | "beforeOpeningRoundBrace": true 18 | }, 19 | "disallowSpacesInNamedFunctionExpression": { 20 | "beforeOpeningRoundBrace": true 21 | }, 22 | "disallowSpacesInsideArrayBrackets": true, 23 | "requireSpaceBeforeKeywords": [ 24 | "else", 25 | "while", 26 | "catch" 27 | ], 28 | "disallowSpacesInsideParentheses": true, 29 | "disallowTrailingComma": true, 30 | "disallowTrailingWhitespace": true, 31 | "requireCommaBeforeLineBreak": true, 32 | "requireLineFeedAtFileEnd": true, 33 | "requireSpaceAfterBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"], 34 | "requireSpaceBeforeBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"], 35 | "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], 36 | "validateQuoteMarks": "'", 37 | "requireSpaceBeforeBlockStatements": true, 38 | "requireSpacesInConditionalExpression": { 39 | "afterTest": true, 40 | "beforeConsequent": true, 41 | "afterConsequent": true, 42 | "beforeAlternate": true 43 | }, 44 | "requireSpacesInForStatement": true, 45 | "requireSpacesInFunction": { 46 | "beforeOpeningCurlyBrace": true 47 | }, 48 | "validateLineBreaks": "LF", 49 | "requireSemicolons": true, 50 | "requireParenthesesAroundIIFE": true, 51 | "validateIndentation": 2, 52 | "disallowAnonymousFunctions": true, 53 | "plugins": [ 54 | "jscs-jsdoc" 55 | ], 56 | "jsDoc": { 57 | "checkParamNames": true, 58 | "requireParamTypes": true, 59 | "checkRedundantParams": true, 60 | "checkRedundantReturns": true, 61 | "requireReturnTypes": true, 62 | "requireParamDescription": true, 63 | "requireHyphenBeforeDescription": true, 64 | "disallowNewlineAfterDescription": true, 65 | "requireDescriptionCompleteSentence": true, 66 | "enforceExistence": "exceptExports" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /.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": 2, 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 | "cordova": false, 60 | "StatusBar": false 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | node_js: 4 | - 0.12 5 | - iojs 6 | 7 | script: 8 | - gulp style-guide 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing for Ionic Garden 2 | 3 | Are you thinking in contribute to Ionic Garden? Here's how you can do it. 4 | Before to start contributing with project, read this page with atention for to know how the project is organized. 5 | 6 | ### How to explore issues 7 | 8 | The [issues](https://github.com/IonicBrazil/ionic-garden/issues) is the place where, bug reports, features requests and submiting pull requests are done. We have some restrictions: 9 | - Do not use issues for personal support request. [Stack Overflow - tag Ionic](http://stackoverflow.com/questions/tagged/ionic-framework) is good for it. 10 | - Do not disrespect nobody. 11 | - Respect other opinions. 12 | 13 | ### Pull requests 14 | 15 | - [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your fork and add dependences 16 | ``` 17 | # Clone your fork of the repo into the current directory 18 | git clone https://github.com//ionic-garden 19 | # Navigate to the newly cloned directory 20 | cd ionic-garden 21 | # Add dependences 22 | npm install -d 23 | bower install 24 | ``` 25 | - If you cloned a while ago, get the latest changes from upstream 26 | ``` 27 | git checkout master 28 | git pull upstream master 29 | ``` 30 | - For add new resources your need to create a new branch 31 | ``` 32 | git branch branch_name 33 | ``` 34 | - Add, delete and modify files what you think necessary 35 | - Before to commit 36 | ``` 37 | git fetch 38 | ``` 39 | **OBS:** Fetches work from the remote into the local copy 40 | - Adds files from the working directory to the staging area 41 | ``` 42 | git add files_modified 43 | ``` 44 | - Permanently stores file changes from the staging area in the repository 45 | ``` 46 | git commit -m "message specifying your changes" 47 | ``` 48 | - Pushes a local branch to the origin remote 49 | ``` 50 | git push origin 51 | ``` 52 | - [Pull request](https://help.github.com/articles/using-pull-requests/) with clear description of your changes and a title specifying your modifications. 53 | - **IMPORTANT:** Remenber this project is under the terms of the MIT License (if it includes code changes). 54 | 55 | ### How to test your changes 56 | Before to realize a push, is advisable to test your changes with 57 | ``` 58 | ionic serve 59 | ```. 60 | And acess your project in browser with: 61 | ``` 62 | localhost:8100 63 | ```. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015-present Drifty Co. 2 | http://drifty.com/ 3 | 4 | MIT License 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ionic Garden 2 | 3 | This project is for every ionite who wants to play with Ionic's Source 4 | 5 | If you want to colaborate with this project, check out our first milestone [1.0.0-beta.1](https://github.com/IonicBrazil/ionic-garden/milestones/1.0.0-beta.1) 6 | 7 | ## Run Ionites, Run! 8 | 9 | To run this project, first lets clone it 10 | 11 | ```sh 12 | git clone git@github.com:ionicbrazil/ionic-garden 13 | ``` 14 | 15 | Install dependencies 16 | 17 | ```sh 18 | npm install -d 19 | bower install 20 | ``` 21 | 22 | Run the project on your browser 23 | ```sh 24 | ionic serve 25 | ``` 26 | 27 | Access `localhost:8100`, and check out your new cool project running :) 28 | 29 | > Here begin Ionic Garden benefits. 30 | 31 | ## Load a specific Ionic version 32 | 33 | You can load a specific version of Ionic by using `ionic` parameter 34 | in the URL and put `nightly`, 'local' or any ionic version 35 | 36 | Like this: 37 | ``` 38 | localhost:8100?ionic=1.0.0-rc.4 39 | ``` 40 | 41 | It'll load Ionic from `//code.ionicframework.com/1.0.0-rc.4/js/ionic.bundle.min.js` 42 | 43 | You can choose a version at [code.ionicframework.com](http://code.ionicframework.com/), if not used, it will load 'local' by default 44 | 45 | It doesn't work with `ionic serve --lab` yet 46 | 47 | ## Edit Ionic source code 48 | 49 | Open `js` and `scss` folder of `./modules/ionic/` and change Ionic source, `ionic serve` will run `gulp bundle` inside ionic source, and it will reload in your browser. 50 | 51 | To load this source in your browser, remember to use `?ionic=build` in the URL 52 | 53 | ## Follow the Style Guide 54 | We recomend you to use this [Angular Code Style](https://github.com/johnpapa/angular-styleguide), it was created by a bunch of experienced angular developers, well, we recomend it. Feel free to adapt this Style Guide to attend your necessities 55 | 56 | ## Source Modules 57 | Source modules is used to clone modules source code from GitHub, these sources are listed in `ionic.project` like this: 58 | ```js 59 | "sourceModules": { 60 | "ionic": "git@github.com:driftyco/ionic.git", 61 | "ng-cordova": "git@github.com:driftyco/ng-cordova.git" 62 | } 63 | ``` 64 | 65 | [Checkout our default](https://github.com/felquis/ionic-garden/blob/master/ionic.project) `ionic.project` file 66 | 67 | `sourceModules` right now, only works with ionic source, but ng-cordova [will be added](https://github.com/felquis/ionic-garden/issues/18) soon 68 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HelloIonic", 3 | "private": "true", 4 | "devDependencies": { 5 | "ionic": "driftyco/ionic-bower#1.0.0", 6 | "load-ionic": "felquis/load-ionic#master" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ionic-garden 4 | 5 | An Ionic Framework and Cordova project. 6 | 7 | 8 | Ionic Framework Team 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /gulp/config.js: -------------------------------------------------------------------------------- 1 | var src = 'src'; 2 | var dest = 'www'; 3 | 4 | var tasks = {}; 5 | 6 | tasks.common = {}; 7 | 8 | // All files path 9 | tasks.common.allHTMLFiles = src + '/*.html'; 10 | tasks.common.allJSFiles = ['src/{,*/,*/*/}*.js', '!src/lib{,/**}']; 11 | tasks.common.scriptBase = src + '/{,*/}{,*/}*.js'; 12 | tasks.common.allSCSSFiles = src + '/scss/{,*/}*.scss'; 13 | tasks.common.allStaticFiles = [src + '/**', '!'+src+'/scss{,/**}', '!'+src+'/{,*/,*/*/}*.js']; 14 | tasks.common.src = src + '/'; 15 | tasks.common.allFiles = src + '/**'; 16 | 17 | tasks.common.jsFilesHeader = ';(function () {\n\'use strict\';\n'; 18 | tasks.common.jsFilesFooter = '\n}())'; 19 | 20 | // Dest paths 21 | tasks.common.destBase = dest; 22 | tasks.common.destCSS = tasks.common.destBase + '/css/'; 23 | 24 | module.exports = tasks; 25 | -------------------------------------------------------------------------------- /gulp/tasks/bower-install.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var jscs = require('gulp-jscs'); 3 | var bower = require('bower'); 4 | var gutil = require('gulp-util'); 5 | var sh = require('shelljs'); 6 | 7 | gulp.task('bower-install', ['git-check'], function() { 8 | return bower.commands.install() 9 | .on('log', function(data) { 10 | gutil.log('bower', gutil.colors.cyan(data.id), data.message); 11 | }); 12 | }); 13 | 14 | gulp.task('git-check', function(done) { 15 | if (!sh.which('git')) { 16 | console.log( 17 | ' ' + gutil.colors.red('Git is not installed.'), 18 | '\n Git, the version control system, is required to download Ionic.', 19 | '\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.', 20 | '\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.' 21 | ); 22 | process.exit(1); 23 | } 24 | done(); 25 | }); 26 | -------------------------------------------------------------------------------- /gulp/tasks/default.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | 3 | gulp.task('default', ['style-guide', 'styles', 'source']); 4 | -------------------------------------------------------------------------------- /gulp/tasks/install-source-modules.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var appRoot = require('app-root-path') 3 | var path = require('canonical-path') 4 | var git = require('gulp-git'); 5 | var fs = require('fs'); 6 | 7 | var ionicProject = JSON.parse(fs.readFileSync(path.join(appRoot.path, 'ionic.project'), 'utf8')); 8 | 9 | gulp.task('install-source-modules', function() { 10 | var array = Object.keys(ionicProject.sourceModules); 11 | 12 | array.forEach(function (propertyName) { 13 | console.log( 14 | 'git clone', 15 | ionicProject.sourceModules[propertyName], 16 | path.join('modules', propertyName) 17 | ); 18 | 19 | var cwd = path.join(appRoot.path, 'modules'); 20 | var modulePath = path.join(cwd, propertyName); 21 | var directory = null; 22 | try { 23 | directory = fs.lstatSync(modulePath); 24 | } catch (e) { 25 | console.log('We\'re cloning your repo right now! Just wait.'); 26 | } 27 | 28 | if (directory != null && directory.isDirectory()) { 29 | git.pull('origin', 'master', {cwd: modulePath, args: '--rebase'}, function (err) { 30 | if (err) throw err; 31 | 32 | console.log('Updated ', propertyName); 33 | }); 34 | } else { 35 | git.clone(ionicProject.sourceModules[propertyName], { 36 | cwd: cwd 37 | }, function (err) { 38 | if (err) throw err; 39 | 40 | console.log('Cloned ', propertyName); 41 | }); 42 | } 43 | }) 44 | }); 45 | -------------------------------------------------------------------------------- /gulp/tasks/js-prepare.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var header = require('gulp-header'); 3 | var footer = require('gulp-footer'); 4 | var inject = require('gulp-inject'); 5 | var config = require('../config').common; 6 | 7 | gulp.task('js-prepare', function(done) { 8 | var jsFiles = gulp.src(config.allJSFiles); 9 | 10 | gulp.src(config.allHTMLFiles) 11 | .pipe(inject(jsFiles, {ignorePath: [config.src, config.destBase]})) 12 | .pipe(gulp.dest(config.destBase)); 13 | 14 | jsFiles 15 | .pipe(header(config.jsFilesHeader)) 16 | .pipe(footer(config.jsFilesFooter)) 17 | .pipe(gulp.dest(config.destBase)) 18 | .on('end', done); 19 | }); 20 | -------------------------------------------------------------------------------- /gulp/tasks/source.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var config = require('../config').common; 3 | 4 | gulp.task('source', function(done) { 5 | gulp.src(config.allStaticFiles) 6 | .pipe(gulp.dest(config.destBase)) 7 | .on('end', done); 8 | }); 9 | -------------------------------------------------------------------------------- /gulp/tasks/style-guide.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var jscs = require('gulp-jscs'); 3 | var jshint = require('gulp-jshint'); 4 | var config = require('../config').common; 5 | 6 | gulp.task('style-guide', function () { 7 | return gulp.src(config.allJSFiles) 8 | .pipe(jshint()) 9 | .pipe(jshint.reporter('jshint-stylish', {verbose: true})) 10 | .pipe(jscs()); 11 | }); 12 | -------------------------------------------------------------------------------- /gulp/tasks/styles.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var sass = require('gulp-sass'); 3 | var minifyCss = require('gulp-minify-css'); 4 | var rename = require('gulp-rename'); 5 | var autoprefixer = require('gulp-autoprefixer'); 6 | var plumber = require('gulp-plumber'); 7 | var config = require('../config').common; 8 | 9 | gulp.task('styles', function(done) { 10 | gulp.src(config.allSCSSFiles) 11 | .pipe(plumber()) 12 | .pipe(sass({ errLogToConsole: true })) 13 | .pipe(autoprefixer({browsers: ['last 2 version', '> 5%']})) 14 | .pipe(gulp.dest(config.destCSS)) 15 | 16 | // Minifield version 17 | .pipe(minifyCss()) 18 | .pipe(rename({ extname: '.min.css' })) 19 | .pipe(gulp.dest(config.destCSS)) 20 | .on('end', done); 21 | }); 22 | -------------------------------------------------------------------------------- /gulp/tasks/watch.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var exec = require('child_process').execFile 3 | 4 | var config = require('../config').common; 5 | 6 | gulp.task('watch', ['js-prepare', 'styles', 'source'], function() { 7 | gulp.watch(config.allSCSSFiles, ['styles']); 8 | gulp.watch(config.allStaticFiles, ['source']); 9 | gulp.watch(config.allJSFiles, ['js-prepare']); 10 | 11 | var child = exec('node ./scripts/watch/watch.js') 12 | 13 | child.stdout.on('data', console.log) 14 | }); 15 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var requireDir = require('require-dir'); 2 | requireDir('./gulp/tasks', { recurse: true }); 3 | -------------------------------------------------------------------------------- /hooks/README.md: -------------------------------------------------------------------------------- 1 | 21 | # Cordova Hooks 22 | 23 | This directory may contain scripts used to customize cordova commands. This 24 | directory used to exist at `.cordova/hooks`, but has now been moved to the 25 | project root. Any scripts you add to these directories will be executed before 26 | and after the commands corresponding to the directory name. Useful for 27 | integrating your own build systems or integrating with version control systems. 28 | 29 | __Remember__: Make your scripts executable. 30 | 31 | ## Hook Directories 32 | The following subdirectories will be used for hooks: 33 | 34 | after_build/ 35 | after_compile/ 36 | after_docs/ 37 | after_emulate/ 38 | after_platform_add/ 39 | after_platform_rm/ 40 | after_platform_ls/ 41 | after_plugin_add/ 42 | after_plugin_ls/ 43 | after_plugin_rm/ 44 | after_plugin_search/ 45 | after_prepare/ 46 | after_run/ 47 | after_serve/ 48 | before_build/ 49 | before_compile/ 50 | before_docs/ 51 | before_emulate/ 52 | before_platform_add/ 53 | before_platform_rm/ 54 | before_platform_ls/ 55 | before_plugin_add/ 56 | before_plugin_ls/ 57 | before_plugin_rm/ 58 | before_plugin_search/ 59 | before_prepare/ 60 | before_run/ 61 | before_serve/ 62 | pre_package/ <-- Windows 8 and Windows Phone only. 63 | 64 | ## Script Interface 65 | 66 | All scripts are run from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables: 67 | 68 | * CORDOVA_VERSION - The version of the Cordova-CLI. 69 | * CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios). 70 | * CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer) 71 | * CORDOVA_HOOK - Path to the hook that is being executed. 72 | * CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate) 73 | 74 | If a script returns a non-zero exit code, then the parent cordova command will be aborted. 75 | 76 | 77 | ## Writing hooks 78 | 79 | We highly recommend writting your hooks using Node.js so that they are 80 | cross-platform. Some good examples are shown here: 81 | 82 | [http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/) 83 | 84 | -------------------------------------------------------------------------------- /hooks/after_prepare/010_add_platform_class.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Add Platform Class 4 | // v1.0 5 | // Automatically adds the platform class to the body tag 6 | // after the `prepare` command. By placing the platform CSS classes 7 | // directly in the HTML built for the platform, it speeds up 8 | // rendering the correct layout/style for the specific platform 9 | // instead of waiting for the JS to figure out the correct classes. 10 | 11 | var fs = require('fs'); 12 | var path = require('path'); 13 | 14 | var rootdir = process.argv[2]; 15 | 16 | function addPlatformBodyTag(indexPath, platform) { 17 | // add the platform class to the body tag 18 | try { 19 | var platformClass = 'platform-' + platform; 20 | var cordovaClass = 'platform-cordova platform-webview'; 21 | 22 | var html = fs.readFileSync(indexPath, 'utf8'); 23 | 24 | var bodyTag = findBodyTag(html); 25 | if(!bodyTag) return; // no opening body tag, something's wrong 26 | 27 | if(bodyTag.indexOf(platformClass) > -1) return; // already added 28 | 29 | var newBodyTag = bodyTag; 30 | 31 | var classAttr = findClassAttr(bodyTag); 32 | if(classAttr) { 33 | // body tag has existing class attribute, add the classname 34 | var endingQuote = classAttr.substring(classAttr.length-1); 35 | var newClassAttr = classAttr.substring(0, classAttr.length-1); 36 | newClassAttr += ' ' + platformClass + ' ' + cordovaClass + endingQuote; 37 | newBodyTag = bodyTag.replace(classAttr, newClassAttr); 38 | 39 | } else { 40 | // add class attribute to the body tag 41 | newBodyTag = bodyTag.replace('>', ' class="' + platformClass + ' ' + cordovaClass + '">'); 42 | } 43 | 44 | html = html.replace(bodyTag, newBodyTag); 45 | 46 | fs.writeFileSync(indexPath, html, 'utf8'); 47 | 48 | process.stdout.write('add to body class: ' + platformClass + '\n'); 49 | } catch(e) { 50 | process.stdout.write(e); 51 | } 52 | } 53 | 54 | function findBodyTag(html) { 55 | // get the body tag 56 | try{ 57 | return html.match(/])(.*?)>/gi)[0]; 58 | }catch(e){} 59 | } 60 | 61 | function findClassAttr(bodyTag) { 62 | // get the body tag's class attribute 63 | try{ 64 | return bodyTag.match(/ class=["|'](.*?)["|']/gi)[0]; 65 | }catch(e){} 66 | } 67 | 68 | if (rootdir) { 69 | 70 | // go through each of the platform directories that have been prepared 71 | var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []); 72 | 73 | for(var x=0; x'), 26 | ted.say.happy(cwd) 27 | ) 28 | 29 | var installing = exec(npm, ['install', '-d', '-s'], { 30 | cwd: cwd 31 | }, function (err, out, erout) { 32 | // Good output 33 | if (out) { 34 | console.log(ted.say.debug(out)) 35 | } 36 | 37 | // Bad output 38 | if (err) { 39 | console.log(ted.say.error(err)) 40 | } 41 | }) 42 | 43 | // When everything is done, tell me what happened 44 | installing.on('close', function (exit, error) { 45 | if (exit === 0 && !error) { 46 | console.log(cwd, ted.say.happy('done')) 47 | } 48 | 49 | if (error) { 50 | console.log(ted.say.error(error)) 51 | } 52 | }) 53 | } 54 | 55 | module.exports = installModules 56 | -------------------------------------------------------------------------------- /scripts/install/install-search.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // It'll search for package.json files in a given directory 4 | var ted = require('../ted') 5 | var sh = require('shelljs') 6 | var blog = require('glob') 7 | var path = require('canonical-path') 8 | 9 | // @opt 10 | // @opt.cwd - Directory to use, default is `./modules` 11 | 12 | // @callback is called with 13 | // @files Array of results 14 | // @whatTheyAre string `file` or `files`, depends on @files.length 15 | var findModulesAndReturnPaths = function (opt, callback) { 16 | opt = opt || {} 17 | opt.cwd = opt.cwd || './modules' 18 | 19 | // Hello log 20 | console.log( 21 | ted.say.happy('Humm let me see your'), 22 | ted.say.path(opt.cwd), 23 | ted.say.happy('folder') 24 | ) 25 | 26 | blog(path.join(opt.cwd, '/{,*/}package.json'), {}, function (err, files) { 27 | // I'm not sure if it need a comment, but it's an error 28 | // I don't know how to simulate 29 | if (err) { 30 | console.log(ted.say.error('Something went really wrong here')) 31 | 32 | console.log(ted.say.error(err)) 33 | 34 | process.exit(1) 35 | } 36 | 37 | // Did not found anything 38 | if (files.length === 0) { 39 | console.log( 40 | ted.say.warn('Weird:'), 41 | 'I did not found any', 42 | ted.say.path('package.json') 43 | ) 44 | 45 | ted.abort() 46 | 47 | return 48 | } 49 | 50 | var whatTheyAre = (files.length === 1)? 'file' : 'files' 51 | 52 | // Tell me what you found Ted 53 | console.log( 54 | ted.say.happy('I found'), 55 | ted.say.data(files.length), 56 | ted.say.happy(whatTheyAre) 57 | ) 58 | 59 | console.log(ted.say.data(files)) 60 | 61 | callback(files, whatTheyAre) 62 | }) 63 | } 64 | 65 | module.exports = findModulesAndReturnPaths 66 | -------------------------------------------------------------------------------- /scripts/install/install-submodules.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // It will install all package.json files found at `.gitmodules` 4 | // Just run `npm run install` 5 | 6 | var ted = require('../ted') 7 | var findFiles = require('./install-search') 8 | var installThem = require('./install-modules') 9 | 10 | findFiles(null, installThem) 11 | -------------------------------------------------------------------------------- /scripts/ted.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Ted is your best friend 4 | var Ted = {} 5 | 6 | // Arguments 7 | var yargs = require('yargs') 8 | 9 | // Elias 10 | yargs.alias('r', 'recursive') 11 | 12 | Ted.args = yargs.argv 13 | 14 | // Colors to improve logs 15 | Ted.say = require('colors') 16 | 17 | // Colors Theme 18 | Ted.say.setTheme({ 19 | silly: 'rainbow', 20 | input: 'grey', 21 | verbose: 'cyan', 22 | prompt: 'grey', 23 | info: 'green', 24 | data: 'grey', 25 | help: 'cyan', 26 | warn: 'yellow', 27 | debug: 'blue', 28 | error: 'red', 29 | path: 'cyan', 30 | happy: 'green' 31 | }); 32 | 33 | // Ted abort 34 | Ted.abort = function () { 35 | Ted.say.error('Aborting :(') 36 | } 37 | 38 | module.exports = Ted 39 | -------------------------------------------------------------------------------- /scripts/watch/watch.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var ted = require('../ted') 4 | var exec = require('child_process').execFile 5 | var gulp = require('gulp') 6 | var batch = require('gulp-batch'); 7 | 8 | // What is going on log 9 | console.log( 10 | ted.say.happy('Drops the bass'), 11 | ted.say.warn('->'), 12 | ted.say.happy('gulp watch') 13 | ) 14 | 15 | gulp.watch( 16 | './modules/ionic/dist/{,*/}*.{js,css,scss,json,eot,svg,ttf,woff}', 17 | batch(function (event, cb) { 18 | process.stdout.write('ionic source changed') 19 | return gulp.src('./modules/ionic/dist/**') 20 | .pipe(gulp.dest('src/lib/ionic/build')) 21 | }) 22 | ); 23 | 24 | process.stdout.write(ted.say.happy('Watching Ionic source')) 25 | 26 | exec('gulp', ['watch'], { 27 | cwd: './modules/ionic/' 28 | }) 29 | -------------------------------------------------------------------------------- /src/app.js: -------------------------------------------------------------------------------- 1 | angular.module('ionicGarden', [ 2 | 'ionic', 3 | 'ionicGarden.configureKeyBoard', 4 | 'ionicGarden.configureStatusBar', 5 | 'ionicGarden.state.sidemenu', 6 | 'ionicGarden.state.search', 7 | 'ionicGarden.state.browse', 8 | 'ionicGarden.state.playlists', 9 | 'ionicGarden.state.single', 10 | 'ionicGarden.state.index', 11 | 'ionicGarden.state.infinite-scroll', 12 | 'ionicGarden.state.refresher', 13 | 'ionicGarden.state.spinners', 14 | 'ionicGarden.state.come-back', 15 | 'ionicGarden.state.loading' 16 | ]); 17 | -------------------------------------------------------------------------------- /src/img/ionic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IonicBrazil/ionic-garden/beae473454081431ba62262a99cda2825c5ca5bd/src/img/ionic.png -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/modals/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Login

4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 15 | 19 | 22 |
23 |
24 |
25 |
26 | -------------------------------------------------------------------------------- /src/scss/main.scss: -------------------------------------------------------------------------------- 1 | /* 2 | To customize the look and feel of Ionic, you can override the variables 3 | in ionic's _variables.scss file. 4 | 5 | For example, you might change some of the default colors: 6 | 7 | $light: #fff !default; 8 | $stable: #f8f8f8 !default; 9 | $positive: #387ef5 !default; 10 | $calm: #11c1f3 !default; 11 | $balanced: #33cd5f !default; 12 | $energized: #ffc900 !default; 13 | $assertive: #ef473a !default; 14 | $royal: #886aea !default; 15 | $dark: #444 !default; 16 | */ 17 | 18 | // The path for our ionicons font files, relative to the built CSS in www/css 19 | $ionicons-font-path: "../lib/ionic/fonts" !default; 20 | 21 | // Include all of Ionic 22 | @import "../lib/ionic/scss/ionic"; 23 | -------------------------------------------------------------------------------- /src/shared/configure-keyboard.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.configureKeyBoard', []) 3 | .run(configKeyBoard); 4 | 5 | /** 6 | * Configure Keyboard 7 | */ 8 | function configKeyBoard($ionicPlatform) { 9 | $ionicPlatform.ready(platformReady); 10 | 11 | /** 12 | * Configure Keyboard plugin 13 | */ 14 | function platformReady() { 15 | if (window.cordova && window.cordova.plugins.Keyboard) { 16 | cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/shared/configure-status-bar.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.configureStatusBar', []) 3 | .run(configStatusBar); 4 | 5 | /** 6 | * Configure Status Bar style 7 | */ 8 | function configStatusBar($ionicPlatform) { 9 | $ionicPlatform.ready(platformReady); 10 | 11 | /** 12 | * Configure StatusBar plugin 13 | */ 14 | function platformReady() { 15 | if (window.StatusBar) { 16 | StatusBar.styleDefault(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/shared/ig-button-loading/ig-button-loading.controller.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.shared.ig-button-loading.controller', []) 3 | .controller('IGButtonLoadingController', IGButtonLoadingController); 4 | 5 | IGButtonLoadingController.$inject = ['$scope', '$element', '$state', '$timeout', '$ionicLoading']; 6 | 7 | var DEFAULT_LOADING_OPTIONS = { 8 | noBackdrop: false, 9 | hideOnStateChange: false, 10 | delay: 0, 11 | duration: undefined 12 | }; 13 | 14 | /** 15 | * Controller Definition 16 | */ 17 | function IGButtonLoadingController($scope, $element, $state, $timeout, $ionicLoading) { 18 | 19 | var vm = this; 20 | vm.link = link 21 | vm.show = show 22 | vm.hide = hide 23 | 24 | $scope.$on('$destroy', destroy); 25 | 26 | function link() { 27 | $element.on('click', show); 28 | } 29 | 30 | /** 31 | * Scope Destroy 32 | */ 33 | function destroy() { 34 | $element.off('click'); 35 | } 36 | 37 | /** 38 | * Show loading 39 | */ 40 | function show() { 41 | $ionicLoading.show($scope.ig); 42 | 43 | // console.log('show', $scope, $element); 44 | 45 | if ($scope.ig.hideOn > 0) { 46 | $timeout(hide, $scope.ig.hideOn); 47 | } 48 | } 49 | 50 | /** 51 | * Show loading with no backdrop option 52 | */ 53 | function showNoBackdrop() { 54 | $ionicLoading.show({ 55 | template: $scope.title, 56 | noBackdrop: true 57 | }); 58 | } 59 | 60 | /** 61 | * Hide loading 62 | */ 63 | function hide() { 64 | $ionicLoading.hide(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/shared/ig-button-loading/ig-button-loading.directive.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.shared.ig-button-loading', [ 3 | 'ionicGarden.shared.ig-button-loading.controller', 4 | 'ionicGarden.shared.wait' 5 | ]) 6 | .directive('igLoading', igLoading); 7 | 8 | /** 9 | * Directive Definition 10 | */ 11 | function igLoading() { 12 | var directive = { 13 | restrict: 'E', 14 | scope: { 15 | duration: '=duration', 16 | noBackdrop: '=noBackdrop', 17 | hideOnStateChange: '=hideOnStateChange', 18 | hideOn: '=hideOn' 19 | }, 20 | link: link, 21 | controller: 'IGButtonLoadingController', 22 | controllerAs: 'ig', 23 | bindToController: true 24 | }; 25 | 26 | return directive; 27 | 28 | /** 29 | * Directive Link Function 30 | */ 31 | function link(scope, element, attr, controller) { 32 | controller.link(scope, element, attr); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/shared/ig-button-loading/ig-button-loading.spec.js: -------------------------------------------------------------------------------- 1 | // TODO 2 | -------------------------------------------------------------------------------- /src/shared/wait/wait.directive.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.shared.wait', []) 3 | .directive('wait', ['$timeout', '$state', Wait]); 4 | 5 | /** 6 | * Directive Definition 7 | */ 8 | function Wait($timeout, $state) { 9 | var directive = { 10 | restrict: 'A', 11 | link: link 12 | }; 13 | 14 | return directive; 15 | 16 | /** 17 | * Directive Link Function 18 | */ 19 | function link(scope, element, attr, controller) { 20 | element.on('click', click); 21 | 22 | /** 23 | * Timeout andGo function when clicked 24 | */ 25 | function click() { 26 | console.log(attr.wait); 27 | $timeout(andGo, attr.wait); 28 | } 29 | 30 | function andGo() { 31 | $state.go(attr.andGo); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/states/browse/route.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.browse', []) 3 | .config(configBrowse); 4 | 5 | /** 6 | * Define Browse Route 7 | */ 8 | function configBrowse($stateProvider) { 9 | $stateProvider 10 | .state('app.browse', { 11 | url: '/browse', 12 | views: { 13 | 'menuContent': { 14 | templateUrl: 'states/browse/template.html' 15 | } 16 | } 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /src/states/browse/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Browse

4 |
5 |
6 | -------------------------------------------------------------------------------- /src/states/come-back/controller.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.come-back.controller', []) 3 | .controller('ComeBackController', ComeBackController); 4 | 5 | ComeBackController.$inject = ['$scope', '$timeout', '$ionicHistory']; 6 | 7 | /** 8 | * Define Come Back Controller 9 | */ 10 | function ComeBackController($scope, $timeout, $ionicHistory) { 11 | $scope.title = 'Wait a second'; 12 | 13 | $scope.$on('$ionicView.enter', returnAfter2Seconds); 14 | 15 | /** 16 | * Return to previous view after two seconds in the current view 17 | */ 18 | function returnAfter2Seconds() { 19 | $timeout(next, 1000); 20 | 21 | /** 22 | * Navigate to previous view 23 | */ 24 | function next() { 25 | $ionicHistory.goBack(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/states/come-back/route.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.come-back', ['ionicGarden.state.come-back.controller']) 3 | .config(configComeBack); 4 | 5 | /** 6 | * Define Come Back Route 7 | */ 8 | function configComeBack($stateProvider) { 9 | $stateProvider.state('app.comeBack', { 10 | url: '/come-back', 11 | views: { 12 | 'menuContent': { 13 | templateUrl: 'states/come-back/template.html', 14 | controller: 'ComeBackController as vm' 15 | } 16 | } 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /src/states/come-back/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

{{ title }}

4 |
5 |
6 | -------------------------------------------------------------------------------- /src/states/index/route.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.index', []) 3 | .config(configIndex); 4 | 5 | /** 6 | * Define default/index route 7 | */ 8 | function configIndex($urlRouterProvider) { 9 | $urlRouterProvider.otherwise('/app/playlists'); 10 | } 11 | -------------------------------------------------------------------------------- /src/states/infinite-scroll/controller.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.infinite-scroll.controller', []) 3 | .controller('InfiniteScrollController', InfiniteScrollController); 4 | 5 | InfiniteScrollController.$inject = ['$scope', '$state', '$timeout']; 6 | 7 | var total = 10; 8 | 9 | /** 10 | * Define Infinite Scroll Controller 11 | */ 12 | function InfiniteScrollController($scope, $state, $timeout) { 13 | var vm = this; 14 | 15 | vm.title = 'Infinite Scroll'; 16 | vm.list = getList(); 17 | vm.loadMore = loadMore; 18 | 19 | /** 20 | * Return a list of itens 21 | */ 22 | function getList(limit) { 23 | var dados = []; 24 | for (var i = limit; i >= 0; i--) { 25 | dados[i] = i; 26 | } 27 | 28 | return dados; 29 | } 30 | 31 | /** 32 | * Load more items in the current state 33 | */ 34 | function loadMore() { 35 | total = total + 20; 36 | 37 | $timeout(loadComplete, 1500); 38 | 39 | /** 40 | * Called when the load is finished 41 | */ 42 | function loadComplete() { 43 | $scope.vm.list = getList(total); 44 | $scope.$broadcast('scroll.refreshComplete'); 45 | } 46 | } 47 | 48 | $scope.vm = vm; 49 | } 50 | -------------------------------------------------------------------------------- /src/states/infinite-scroll/route.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.infinite-scroll', ['ionicGarden.state.infinite-scroll.controller']) 3 | .config(configInfiniteScroll); 4 | 5 | /** 6 | * Define Infinite Scroll Route 7 | */ 8 | function configInfiniteScroll($stateProvider) { 9 | $stateProvider.state('app.infinite-scroll', { 10 | url: '/infinite-scroll', 11 | views: { 12 | 'menuContent': { 13 | templateUrl: 'states/infinite-scroll/template.html', 14 | controller: 'InfiniteScrollController' 15 | } 16 | } 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /src/states/infinite-scroll/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

{{ vm.title }}

4 | 5 |
    6 |
  • 7 | {{ $index }} 8 |
  • 9 |
10 | 11 | 15 | 16 |
17 |
18 | -------------------------------------------------------------------------------- /src/states/loading/controller.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.loading.controller', []) 3 | .controller('LoadingController', LoadingController); 4 | 5 | LoadingController.$inject = ['$scope', '$state', '$timeout', '$ionicLoading']; 6 | 7 | /** 8 | * Define Loading Controller 9 | */ 10 | function LoadingController($scope, $state, $timeout, $ionicLoading) { 11 | $scope.title = 'Loading'; 12 | } 13 | -------------------------------------------------------------------------------- /src/states/loading/route.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.loading', [ 3 | 'ionicGarden.state.loading.controller', 4 | 'ionicGarden.shared.ig-button-loading' 5 | ]).config(configRefresher); 6 | 7 | /** 8 | * Define Loading Route 9 | */ 10 | function configRefresher($stateProvider) { 11 | $stateProvider.state('app.loading', { 12 | url: '/loading', 13 | views: { 14 | 'menuContent': { 15 | templateUrl: 'states/loading/template.html', 16 | controller: 'LoadingController' 17 | } 18 | } 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /src/states/loading/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 |

{{ title }}

9 | 10 | 11 | Show Basic Loading 12 | 13 | 14 | 15 | Show with no backdrop 16 | 17 | 18 | 19 | Hide on State Change 20 | 21 |
22 |
23 | -------------------------------------------------------------------------------- /src/states/playlists/controller.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.playlists.controller', []) 3 | .controller('PlaylistsController', PlaylistsController); 4 | 5 | /** 6 | * Define Playlists Controller 7 | */ 8 | function PlaylistsController() { 9 | var vm = this; 10 | 11 | vm.playlists = [ 12 | {title: 'Reggae', id: 1}, 13 | {title: 'Chill', id: 2}, 14 | {title: 'Dubstep', id: 3}, 15 | {title: 'Indie', id: 4}, 16 | {title: 'Rap', id: 5}, 17 | {title: 'Cowbell', id: 6} 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /src/states/playlists/route.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.playlists', ['ionicGarden.state.playlists.controller']) 3 | .config(configPlaylists); 4 | 5 | /** 6 | * Define Playlists Route 7 | */ 8 | function configPlaylists($stateProvider, $urlRouterProvider) { 9 | $stateProvider 10 | .state('app.playlists', { 11 | url: '/playlists', 12 | views: { 13 | 'menuContent': { 14 | templateUrl: 'states/playlists/template.html', 15 | controller: 'PlaylistsController as vm' 16 | } 17 | } 18 | }); 19 | } 20 | -------------------------------------------------------------------------------- /src/states/playlists/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ ::playlist.title }} 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/states/refresher/controller.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.refresher.controller', []) 3 | .controller('RefresherController', RefresherController); 4 | 5 | RefresherController.$inject = ['$scope', '$state', '$timeout']; 6 | 7 | var total = 10; 8 | 9 | /** 10 | * Define Refresher Controller 11 | */ 12 | function RefresherController($scope, $state, $timeout) { 13 | var vm = this; 14 | 15 | vm.title = 'Refresher'; 16 | vm.list = getList(); 17 | vm.loadMore = loadMore; 18 | 19 | /** 20 | * Return a list of itens 21 | */ 22 | function getList(limit) { 23 | var dados = []; 24 | for (var i = limit; i >= 0; i--) { 25 | dados[i] = i; 26 | } 27 | 28 | return dados; 29 | } 30 | 31 | /** 32 | * Load more items in the current state 33 | */ 34 | function loadMore() { 35 | total = total + 20; 36 | 37 | $timeout(loadComplete, 1500); 38 | 39 | /** 40 | * Called when the load is finished 41 | */ 42 | function loadComplete() { 43 | $scope.vm.list = getList(total); 44 | $scope.$broadcast('scroll.refreshComplete'); 45 | } 46 | } 47 | 48 | $scope.vm = vm; 49 | } 50 | -------------------------------------------------------------------------------- /src/states/refresher/route.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.refresher', ['ionicGarden.state.refresher.controller']) 3 | .config(configRefresher); 4 | 5 | /** 6 | * Define Refresher Route 7 | */ 8 | function configRefresher($stateProvider) { 9 | $stateProvider.state('app.refresher', { 10 | url: '/refresher', 11 | views: { 12 | 'menuContent': { 13 | templateUrl: 'states/refresher/template.html', 14 | controller: 'RefresherController' 15 | } 16 | } 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /src/states/refresher/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 |

{{ vm.title }}

9 | 10 |
    11 |
  • 12 | {{ $index }} 13 |
  • 14 |
15 |
16 |
17 | -------------------------------------------------------------------------------- /src/states/search/route.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.search', []) 3 | .config(configSearch); 4 | 5 | /** 6 | * Define Search Route 7 | */ 8 | function configSearch($stateProvider) { 9 | $stateProvider 10 | .state('app.search', { 11 | url: '/search', 12 | views: { 13 | 'menuContent': { 14 | templateUrl: 'states/search/template.html' 15 | } 16 | } 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /src/states/search/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Search

4 |
5 |
6 | -------------------------------------------------------------------------------- /src/states/sidemenu/controller.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.sidemenu.controller', []) 3 | .controller('SidemenuController', SidemenuController); 4 | 5 | SidemenuController.$inject = ['$scope', '$ionicModal', '$timeout']; 6 | 7 | /** 8 | * Define Sidemenu Controller 9 | */ 10 | function SidemenuController($scope, $ionicModal, $timeout) { 11 | var vm = this; 12 | 13 | // Form data for the login modal 14 | vm.loginData = {}; 15 | vm.closeLogin = closeLogin; 16 | vm.login = login; 17 | vm.doLogin = doLogin; 18 | 19 | /** 20 | * Create the login modal that we will use later 21 | */ 22 | $ionicModal.fromTemplateUrl('modals/login.html', { 23 | scope: $scope 24 | }).then(resolveModal, rejectModal); 25 | 26 | /** 27 | * Modal successful created 28 | */ 29 | function resolveModal(modal) { 30 | vm.modal = modal; 31 | $scope.vm = vm; 32 | } 33 | 34 | /** 35 | * Log an error if the modal is rejected 36 | */ 37 | function rejectModal(err) { 38 | console.error('Modal reject: ', err); 39 | } 40 | 41 | /** 42 | * Triggered in the login modal to close it 43 | */ 44 | function closeLogin() { 45 | vm.modal.hide(); 46 | } 47 | 48 | /** 49 | * Open the login modal 50 | */ 51 | function login() { 52 | vm.modal.show(); 53 | } 54 | 55 | /** 56 | * Perform the login action when the user submits the login form 57 | */ 58 | function doLogin() { 59 | console.log('Doing login', vm.loginData); 60 | 61 | // Simulate a login delay. Remove this and replace with your login 62 | // code if using a login system 63 | $timeout(delayLoad, 1000); 64 | 65 | /** 66 | * Closes the modal 67 | */ 68 | function delayLoad() { 69 | vm.closeLogin(); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/states/sidemenu/route.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.sidemenu', ['ionicGarden.state.sidemenu.controller']) 3 | .config(configSidemenu); 4 | 5 | /** 6 | * Define Side Menu Route 7 | */ 8 | function configSidemenu($stateProvider) { 9 | $stateProvider.state('app', { 10 | url: '/app', 11 | abstract: true, 12 | templateUrl: 'states/sidemenu/template.html', 13 | controller: 'SidemenuController as vm' 14 | }); 15 | } 16 | -------------------------------------------------------------------------------- /src/states/sidemenu/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |

Left

18 |
19 | 20 | 21 | 22 | Login 23 | 24 | 25 | Search 26 | 27 | 28 | Browse 29 | 30 | 31 | Playlists 32 | 33 | 34 | Infinite Scroll 35 | 36 | 37 | Pull To Refresh 38 | 39 | 40 | Spinners 41 | 42 | 43 | Loading 44 | 45 | 46 | 47 |
48 |
49 | -------------------------------------------------------------------------------- /src/states/single/controller.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.single.controller', []) 3 | .controller('SingleController', SingleController); 4 | 5 | SingleController.$inject = ['$state']; 6 | 7 | /** 8 | * Define Single Controller 9 | */ 10 | function SingleController($state) { 11 | var vm = this; 12 | 13 | vm.id = $state.params.singleId; 14 | } 15 | -------------------------------------------------------------------------------- /src/states/single/route.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.single', ['ionicGarden.state.single.controller']) 3 | .config(configSingle); 4 | 5 | /** 6 | * Define Single Route 7 | */ 8 | function configSingle($stateProvider) { 9 | $stateProvider.state('app.single', { 10 | url: '/single/:singleId', 11 | views: { 12 | 'menuContent': { 13 | templateUrl: 'states/single/template.html', 14 | controller: 'SingleController as vm' 15 | } 16 | } 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /src/states/single/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Single {{ ::vm.id }}

4 |
5 |
6 | -------------------------------------------------------------------------------- /src/states/spinners/controller.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.spinners.controller', []) 3 | .controller('SpinnersController', SpinnersController); 4 | 5 | SpinnersController.$inject = ['$scope', '$state', '$timeout']; 6 | 7 | /** 8 | * Define State Controller 9 | */ 10 | function SpinnersController($scope, $state, $timeout) { 11 | var total = 10; 12 | var vm = this; 13 | 14 | vm.title = 'Spinners'; 15 | vm.list = getList(); 16 | vm.loadMore = loadMore; 17 | vm.isChecked = true; 18 | 19 | /** 20 | * Get an array of items. 21 | * @param {Number} limit - Number of items to return 22 | * @return {Array} - Returns generated array 23 | */ 24 | function getList(limit) { 25 | var dados = []; 26 | for (var i = limit; i >= 0; i--) { 27 | dados[i] = i; 28 | } 29 | 30 | return dados; 31 | } 32 | 33 | /** 34 | * Used by ion-infinite-scroll to load more itens 35 | */ 36 | function loadMore() { 37 | total = total + 20; 38 | 39 | $timeout(loadComplete, 1500); 40 | 41 | /** 42 | * Called when the load is finished 43 | */ 44 | function loadComplete() { 45 | $scope.vm.list = getList(total); 46 | $scope.$broadcast('scroll.refreshComplete'); 47 | } 48 | } 49 | 50 | $scope.vm = vm; 51 | } 52 | -------------------------------------------------------------------------------- /src/states/spinners/route.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('ionicGarden.state.spinners', ['ionicGarden.state.spinners.controller']) 3 | .config(configRefresher); 4 | 5 | /** 6 | * Define Spinner Route 7 | */ 8 | function configRefresher($stateProvider) { 9 | $stateProvider.state('app.spinners', { 10 | url: '/spinners', 11 | views: { 12 | 'menuContent': { 13 | templateUrl: 'states/spinners/template.html', 14 | controller: 'SpinnersController' 15 | } 16 | } 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /src/states/spinners/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 |

{{ vm.title }}

9 | 10 | Show Spinner 11 | 12 | 13 | 14 | 18 |
19 |
20 | -------------------------------------------------------------------------------- /www/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IonicBrazil/ionic-garden/beae473454081431ba62262a99cda2825c5ca5bd/www/.keep --------------------------------------------------------------------------------