diff --git a/config/demos/demos.config.js b/config/demos/demos.config.js new file mode 100644 index 00000000000..c60e09e9e44 --- /dev/null +++ b/config/demos/demos.config.js @@ -0,0 +1,51 @@ +var path = require('canonical-path'); +var _ = require('lodash'); +var staticSite = require('./static-site'); + +var projectBase = path.resolve(__dirname, '../..'); + +module.exports = function(config) { + + config = staticSite(config); + + config.merge('rendering.nunjucks.config.tags', { + variableStart: '{$', + variableEnd: '$}', + blockStart: '{%', + blockEnd: '%}' + }); + + config.set('logging.level', 'info'); + + config.set('rendering.outputFolder', path.resolve(projectBase, 'dist/ionic-demo')); + + config.set('rendering.templateFolders', [ + path.resolve(__dirname, 'templates') + ]); + config.set('rendering.templatePatterns', [ + '${ doc.template }', + '${doc.area}/${ doc.id }.${ doc.docType }.template.html', + '${doc.area}/${ doc.id }.template.html', + '${doc.area}/${ doc.docType }.template.html', + '${ doc.id }.${ doc.docType }.template.html', + '${ doc.id }.template.html', + '${ doc.docType }.template.html' + ]); + + config.append('processing.processors', [ + require('../docs/processors/version-data'), + require('./processors/demos') + ]); + + config.set('basePath', __dirname); + config.set('source.projectPath', '.'); + + config.set('source.files', [ + { pattern: 'demos/**/*.html', basePath: projectBase }, + { pattern: 'demos/**/*.js', basePath: projectBase }, + { pattern: 'demos/**/*.css', basePath: projectBase } + ]); + + + return config; +}; diff --git a/config/demos/processors/demos.js b/config/demos/processors/demos.js new file mode 100644 index 00000000000..257999bfdbe --- /dev/null +++ b/config/demos/processors/demos.js @@ -0,0 +1,99 @@ +var _ = require('lodash'); +var log = require('dgeni').log; +var path = require('canonical-path'); + +var typeTransform = { + markdown: 'md' +}; + +module.exports = { + name: 'demos', + description: 'Output demos to their files on ionic-demo website', + runAfter: ['files-read'], + runBefore: ['processing-docs'], + process: function(docs, config) { + + var contentsFolder = config.rendering.contentsFolder; + var assetOutputPath = path.join(contentsFolder, '${component}/${name}/${fileName}'); + + var pages = []; + + var demos = _(docs) + .filter('yaml') + .groupBy(function(doc) { + return doc.yaml.component + '-' + doc.yaml.name; + }) + .map(function(fragmentsForId, id) { + + var demoData = { + files: [] + }; + fragmentsForId.forEach(function(fragment) { + var doc = fragment.yaml; + if (!doc.name || !doc.component) { + log.error('Doc ' + fragment.filePath + + ' expects yaml keys "name" and "component"!'); + } + + doc.id = doc.component + '-' + doc.name; + doc.fileType = typeTransform[fragment.fileType] || fragment.fileType; + doc.fileName = fragment.fileName; + doc.contents = fragment.contents; + doc.extension = doc.fileType.replace(/^\./,''); + + doc.template = 'asset.contents.template', + doc.outputPath = _.template(assetOutputPath, doc); + + demoData.files.push(doc); + pages.push(doc); + }); + + var firstDoc = demoData.files[0]; + + var indexOutputPath = _.template(assetOutputPath, _.assign({}, firstDoc, { + fileName: 'index.html' + })); + var appOutputPath = _.template(assetOutputPath, _.assign({}, firstDoc, { + fileName: 'index-ionic-demo-app.js' + }, demoData)); + + + demoData.files = _.groupBy(demoData.files, 'extension'); + demoData.id = firstDoc.id; + demoData.name = firstDoc.name; + demoData.component = firstDoc.component; + demoData.href = '/' + _.template(assetOutputPath, _.assign({}, firstDoc, { fileName: '' })); + + pages.push({ + template: 'index.template.html', + demoData: demoData, + outputPath: indexOutputPath + }); + pages.push({ + template: 'app.template.js', + demoData: demoData, + outputPath: appOutputPath + }); + + return demoData; + + }) + .value(); + + pages.push({ + template: 'pages-data.template.js', + demos: demos, + outputPath: path.join(contentsFolder, 'pages-data.js') + }); + pages.push({ + template: 'index.template.html', + outputPath: path.join(contentsFolder, 'index.html') + }); + pages.push({ + template: 'app.template.js', + outputPath: path.join(contentsFolder, 'index-ionic-demo-app.js') + }); + + return pages; +} +}; diff --git a/config/demos/static-site/file-readers/yaml.js b/config/demos/static-site/file-readers/yaml.js new file mode 100644 index 00000000000..895ac00c8c9 --- /dev/null +++ b/config/demos/static-site/file-readers/yaml.js @@ -0,0 +1,37 @@ +var jsYaml = require('js-yaml'); +var path = require('canonical-path'); +var YAML_LINE_REGEX = /---+/; + +module.exports = { + pattern: /\.*$/, + processFile: function(filePath, contents, basePath) { + + contents = contents.trim(); + + var yamlStartMatch = contents.match(YAML_LINE_REGEX); + if (!yamlStartMatch || yamlStartMatch.index !== 0) { + return []; + } + + var yamlContents = contents.substring(yamlStartMatch.index + yamlStartMatch[0].length + 1); + + var yamlEndMatch = yamlContents.match(YAML_LINE_REGEX); + if (!yamlEndMatch) { + return []; + } + + contents = yamlContents.substring(yamlEndMatch.index + yamlEndMatch[0].length); + yamlContents = yamlContents.substring(0, yamlEndMatch.index); + + var yamlJson = jsYaml.safeLoad(yamlContents); + + return [{ + fileType: path.extname(filePath), + file: filePath, + basePath: basePath, + contents: contents, + yaml: yamlJson + }]; + } +}; + diff --git a/config/demos/static-site/index.js b/config/demos/static-site/index.js new file mode 100644 index 00000000000..be55015cdd2 --- /dev/null +++ b/config/demos/static-site/index.js @@ -0,0 +1,14 @@ +module.exports = function(config) { + + require('dgeni-packages/base')(config); + require('dgeni-packages/nunjucks')(config); + + config.append('source.fileReaders', [ + require('./file-readers/yaml') + ]); + + config.append('processing.processors', [ + ]); + + return config; +}; diff --git a/config/demos/static-site/spec/file-readers/_test-data/long-header.md b/config/demos/static-site/spec/file-readers/_test-data/long-header.md new file mode 100644 index 00000000000..d0ed28327f0 --- /dev/null +++ b/config/demos/static-site/spec/file-readers/_test-data/long-header.md @@ -0,0 +1,9 @@ + + +-------- +car: is fast +tortoise: is slow +--- + + +Some content diff --git a/config/demos/static-site/spec/file-readers/_test-data/markdown-title.md b/config/demos/static-site/spec/file-readers/_test-data/markdown-title.md new file mode 100644 index 00000000000..0e6cdb57f9a --- /dev/null +++ b/config/demos/static-site/spec/file-readers/_test-data/markdown-title.md @@ -0,0 +1,2 @@ +Here's a title +-------------- diff --git a/config/demos/static-site/spec/file-readers/_test-data/no-closing-header.md b/config/demos/static-site/spec/file-readers/_test-data/no-closing-header.md new file mode 100644 index 00000000000..84d1d6f9d49 --- /dev/null +++ b/config/demos/static-site/spec/file-readers/_test-data/no-closing-header.md @@ -0,0 +1,5 @@ +--- +something: is here + + +Hello there diff --git a/config/demos/static-site/spec/file-readers/_test-data/no-header.md b/config/demos/static-site/spec/file-readers/_test-data/no-header.md new file mode 100644 index 00000000000..ce013625030 --- /dev/null +++ b/config/demos/static-site/spec/file-readers/_test-data/no-header.md @@ -0,0 +1 @@ +hello diff --git a/config/demos/static-site/spec/file-readers/_test-data/normal-header.md b/config/demos/static-site/spec/file-readers/_test-data/normal-header.md new file mode 100644 index 00000000000..1a5973d24cd --- /dev/null +++ b/config/demos/static-site/spec/file-readers/_test-data/normal-header.md @@ -0,0 +1,6 @@ +--- +hello: world +works: true +--- + +**Here's** some content. diff --git a/config/demos/static-site/spec/file-readers/yaml.spec.js b/config/demos/static-site/spec/file-readers/yaml.spec.js new file mode 100644 index 00000000000..44103ef4d6d --- /dev/null +++ b/config/demos/static-site/spec/file-readers/yaml.spec.js @@ -0,0 +1,35 @@ +var fs = require('fs'); +var path = require('canonical-path'); +var processor = require('../../file-readers/yaml'); + +describe('yaml file-reader', function() { + + function readTestFile(name) { + return fs.readFileSync(path.resolve(__dirname, '_test-data', name)).toString(); + } + + it('normal yaml header should process', function() { + var contents = readTestFile('normal-header.md'); + + var result = processor.processFile('some/file.md', contents); + expect(result.contents.trim()).toEqual('**Here\'s** some content.'); + expect(result.yaml).toEqual({hello: 'world', works: true}); + }); + + it('long yaml header should process', function() { + var contents = readTestFile('long-header.md'); + + var result = processor.processFile('cool/file.md', contents); + expect(result.contents.trim()).toEqual('Some content'); + expect(result.yaml).toEqual({car: 'is fast', tortoise: 'is slow'}); + }); + + ['markdown-title.md', 'no-closing-header.md', 'no-header.md'].forEach(function(file) { + it(file + ' should not be processed', function() { + var contents = readTestFile(file); + var result = processor.processFile('cool/file.md', contents); + expect(result).toBeFalsy(); + }); + }); + +}); diff --git a/config/dgeni/templates/demo/app.template.js b/config/demos/templates/app.template.js similarity index 64% rename from config/dgeni/templates/demo/app.template.js rename to config/demos/templates/app.template.js index 4771ed335b1..a6e490d05fc 100644 --- a/config/dgeni/templates/demo/app.template.js +++ b/config/demos/templates/app.template.js @@ -1,14 +1,14 @@ var DEMO; -<@ if doc.demoData @> - DEMO = <$ doc.demoData | json $>; -<@ endif @> +{% if doc.demoData %} + DEMO = {$ doc.demoData | json $}; +{% endif %} -angular.module(<@ if doc.demoData @>'<$ doc.demoData.module $>' - <@ else @>'demoApp', ['ionic']<@ endif @>) +angular.module({% if doc.demoData %}'{$ doc.demoData.name $}' + {% else %}'demoApp', ['ionic']{% endif %}) .controller('IonicDemoCtrl', function($scope, $ionicModal, $ionicLoading) { $scope.$demos = DEMOS; - <@ if doc.demoData @> + {% if doc.demoData %} $scope.$demo = DEMO; $ionicModal.fromTemplateUrl('ionic-demo-modal.html', { scope: $scope, @@ -30,34 +30,40 @@ angular.module(<@ if doc.demoData @>'<$ doc.demoData.module $>' var form = angular.element('
'); var htmlInput = angular.element(' + + + Hide Backdrop? + + + + diff --git a/demos/service/loading/index.js b/demos/service/loading/index.js new file mode 100644 index 00000000000..3125880f96f --- /dev/null +++ b/demos/service/loading/index.js @@ -0,0 +1,16 @@ +--- +name: complete +component: $ionicLoading +--- +angular.module('complete', []) +.controller('LoadingCtrl', function($scope, $ionicLoading) { + $scope.loadingOptions = { + duration: 1000, + delay: 0, + template: '\n
\nLoading...', + noBackdrop: false + }; + $scope.showLoading = function() { + $ionicLoading.show($scope.loadingOptions); + }; +}); diff --git a/demos/service/popup/popping/index.html b/demos/service/popup/popping/index.html new file mode 100644 index 00000000000..8537a2acd14 --- /dev/null +++ b/demos/service/popup/popping/index.html @@ -0,0 +1,25 @@ +--- +name: popping +component: $ionicPopup +--- + + +

Popups

+
+ + + + + + + + + + diff --git a/demos/service/popup/popping/index.js b/demos/service/popup/popping/index.js new file mode 100644 index 00000000000..cd072a826dc --- /dev/null +++ b/demos/service/popup/popping/index.js @@ -0,0 +1,88 @@ +--- +name: popping +component: $ionicPopup +--- +angular.module('popping', ['ionic']) +.controller('PopupCtrl', function($scope, $timeout, $q, $ionicPopup) { + $scope.showPopup = function() { + $scope.data = {} + + $ionicPopup.show({ + templateUrl: 'popup-template.html', + title: 'Enter Wi-Fi Password', + subTitle: 'Please use normal things', + scope: $scope, + buttons: [ + { text: 'Cancel', onTap: function(e) { return true; } }, + { + text: 'Save', + type: 'button-positive', + onTap: function(e) { + return $scope.data.wifi; + } + }, + ] + }).then(function(res) { + console.log('Tapped!', res); + }, function(err) { + console.log('Err:', err); + }, function(msg) { + console.log('message:', msg); + }); + + $timeout(function() { + $ionicPopup.confirm({ + title: 'Do you like ice cream?', + cancelText: 'No', + okText: 'Yes, of course' + }).then(function(res) { + console.log('Your love for ice cream:', res); + }); + }, 1000); + }; + + $scope.showConfirm = function() { + $ionicPopup.confirm({ + title: 'Consume Ice Cream', + content: 'Are you sure you want to eat this ice cream?' + }).then(function(res) { + if(res) { + console.log('You are sure'); + } else { + console.log('You are not sure'); + } + }); + }; + $scope.showPrompt = function() { + $ionicPopup.prompt({ + title: 'ID Check', + subTitle: 'What is your name?' + }).then(function(res) { + console.log('Your name is', res); + }); + }; + $scope.showPasswordPrompt = function() { + $ionicPopup.prompt({ + title: 'Password Check', + subTitle: 'Enter your secret password', + inputType: 'password', + inputPlaceholder: 'Your password' + }).then(function(res) { + console.log('Your name is', res); + }); + }; + $scope.showAlert = function() { + $ionicPopup.alert({ + title: 'Draft Saved', + content: 'Your Data has been saved!' + }).then(function(res) { + console.log('Your Data has been saved!'); + }, function(err) {}, + function(popup) { + console.log('Got popup', popup); + $timeout(function() { + popup.close(); + }, 1000); + }); + }; +}); diff --git a/gulpfile.js b/gulpfile.js index 06807660acc..eec50900fa4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -56,14 +56,14 @@ gulp.task('default', ['build']); gulp.task('build', ['bundle', 'sass']); gulp.task('validate', ['jshint', 'ddescribe-iit', 'karma']); -gulp.task('docs', function(done) { - var docVersion = argv['doc-version']; +gulp.task('docs', function() { + var docVersion = argv['doc-version'] || 'nightly'; if (docVersion != 'nightly' && !semver.valid(docVersion)) { console.log('Usage: gulp docs --doc-version=(nightly|versionName)'); return process.exit(1); } - var config = dgeni.loadConfig(path.join(__dirname, '/config/dgeni/docs.config.js')); + var config = dgeni.loadConfig(path.join(__dirname, '/config/docs/docs.config.js')); config.set('currentVersion', docVersion); return dgeni.generator(config)().then(function() { @@ -71,6 +71,28 @@ gulp.task('docs', function(done) { }); }); +gulp.task('demos', function(done) { + var demoVersion = argv['demo-version'] || 'nightly'; + if (demoVersion != 'nightly' && !semver.valid(demoVersion)) { + console.log('Usage: gulp docs --doc-version=(nightly|versionName)'); + return process.exit(1); + } + + var config = dgeni.loadConfig(path.join(__dirname, '/config/demos/demos.config.js')); + config.set('currentVersion', demoVersion); + + dgeni.generator(config)().then(function() { + gutil.log('Demos for', gutil.colors.cyan(demoVersion), 'generated!'); + gutil.log('Building ionic into demo folder...'); + cp.spawn('gulp', [ + 'build', + IS_RELEASE_BUILD ? '--release' : '--no-release', + '--dist='+config.get('rendering.outputFolder')+'/'+config.get('rendering.contentsFolder')+'/ionic' + ]) + .on('exit', done); + }); +}); + var IS_WATCH = false; gulp.task('watch', ['build'], function() { IS_WATCH = true; @@ -109,7 +131,7 @@ gulp.task('bundle', [ 'vendor', 'version', ], function() { - IS_RELEASE_BUILD && gulp.src(buildConfig.ionicBundleFiles.map(function(src) { + gulp.src(buildConfig.ionicBundleFiles.map(function(src) { return src.replace(/.js$/, '.min.js'); }), { base: buildConfig.dist, @@ -422,17 +444,6 @@ gulp.task('protractor-sauce', ['sauce-connect', 'connect-server'], function(cb) return protractor(cb, ['config/protractor-sauce.conf.js']); }); -function karma(cb, args) { - cp.spawn('node', [ - __dirname + '/node_modules/karma/bin/karma', - 'start' - ].concat(args), { stdio: 'inherit' }) - .on('exit', function(code) { - if (code) return cb('Karma test(s) failed. Exit code: ' + code); - cb(); - }); -} - function pad(n) { if (n<10) { return '0' + n; } return n; diff --git a/js/angular/directive/checkbox.js b/js/angular/directive/checkbox.js index 6e1b0c1f610..2fb5208063f 100644 --- a/js/angular/directive/checkbox.js +++ b/js/angular/directive/checkbox.js @@ -15,59 +15,6 @@ * Checkbox Label * ``` */ -/** - * @ngdoc demo - * @name ionCheckbox#simple - * @module checkboxSimple - * @javascript - * var app = angular.module('checkboxSimple', ['ionic']); - * app.controller('CheckboxSimpleCtrl', function($scope) { - * $scope.pizza = { - * pepperoni: true, - * sausage: false, - * anchovies: true, - * jalapenos: false - * }; - * - * $scope.toppings = function() { - * var toppings = Object.keys($scope.pizza).filter(function(flavor) { - * return $scope.pizza[flavor]; - * }); - * if (toppings.length > 1) { - * toppings[toppings.length - 1] = 'and ' + toppings[toppings.length - 1]; - * } - * if (toppings.length > 2) { - * return toppings.join(', '); - * } else if (toppings.length) { - * return toppings.join(' '); - * } else { - * return 'nothing'; - * } - * }; - * }); - * - * @html - * - *

- * Checkbox: Simple Usage - *

- *
- * - *

Your pizza has {{toppings()}}!

- * - * Pepperoni? - * - * - * Sausage? - * - * - * Jalapeno? - * - * - * Anchovies? - * - *
- */ IonicModule .directive('ionCheckbox', function() { diff --git a/js/angular/directive/collectionRepeat.js b/js/angular/directive/collectionRepeat.js index 819c949e134..15069ef3c9b 100644 --- a/js/angular/directive/collectionRepeat.js +++ b/js/angular/directive/collectionRepeat.js @@ -128,153 +128,6 @@ * @param {expression} collection-item-height The height of the repeated element. Can be a number (in pixels), or a percentage. * */ -/** - * @ngdoc demo - * @name collectionRepeat#contacts - * @module collectionRepeatContacts - * @javascript -angular.module('collectionRepeatContacts', ['ionic']) -.controller('ContactsCtrl', function($scope, $ionicScrollDelegate, $http, $ionicLoading) { - var contacts = $scope.contacts = []; - var currentCharCode = 'A'.charCodeAt(0) - 1; - - $ionicLoading.show({ - template: 'Fetching Contacts...' - }); - - $http.get('/contacts.json').then(function(response) { - $ionicLoading.hide(); - response.data.sort(function(a, b) { - return a.last_name > b.last_name ? 1 : -1; - }) - .forEach(function(person) { - //Get the first letter of the last name, and if the last name changes - //put the letter in the array - var personCharCode = person.last_name.toUpperCase().charCodeAt(0); - //We may jump two letters, be sure to put both in - //(eg if we jump from Adam Bradley to Bob Doe, add both C and D) - var difference = personCharCode - currentCharCode; - for (var i = 1; i <= difference; i++) { - addLetter(currentCharCode + i); - } - currentCharCode = personCharCode; - contacts.push(person); - }); - - //If names ended before Z, add everything up to Z - for (var i = currentCharCode + 1; i <= 'Z'.charCodeAt(0); i++) { - addLetter(i); - } - }); - - function addLetter(code) { - var letter = String.fromCharCode(code); - contacts.push({ - isLetter: true, - letter: letter - }); - } - - //Letters are shorter, everything else is 100 pixels - $scope.getItemHeight = function(item) { - return item.isLetter ? 40 : 100; - }; - - $scope.scrollBottom = function() { - $ionicScrollDelegate.scrollBottom(true); - }; - - $scope.scrollTop = function() { - $ionicScrollDelegate.scrollTop(); - }; - - var letterHasMatch = {}; - $scope.getContacts = function() { - letterHasMatch = {}; - //Filter contacts by $scope.search. - //Additionally, filter letters so that they only show if there - //is one or more matching contact - return contacts.filter(function(item) { - var itemDoesMatch = !$scope.search || item.isLetter || - item.first_name.toLowerCase().indexOf($scope.search.toLowerCase()) > -1 || - item.last_name.toLowerCase().indexOf($scope.search.toLowerCase()) > -1; - - //Mark this person's last name letter as 'has a match' - if (!item.isLetter && itemDoesMatch) { - var letter = item.last_name.charAt(0).toUpperCase(); - letterHasMatch[letter] = true; - } - - return itemDoesMatch; - }).filter(function(item) { - //Finally, re-filter all of the letters and take out ones that don't - //have a match - if (item.isLetter && !letterHasMatch[item.letter]) { - return false; - } - return true; - }); - }; - - $scope.clearSearch = function() { - $scope.search = ''; - }; -}); - * - * @html -
- -

1000 Contacts

-
- Bottom -
-
- - - - - - - -
- * - * @css -.button.button-icon.input-button { - position: absolute; - right: 0; - top: 5px; - color: #bbb; -} -.list .item.contact-item img { - height: 60px; - width: 60px; - float: left; - margin-top: 20px; - margin-right: 10px; -} -.list .item.contact-item { - left: 0; - right: 0; - padding-top: 0; - padding-bottom: 0; -} - */ var COLLECTION_REPEAT_SCROLLVIEW_XY_ERROR = "Cannot create a collection-repeat within a scrollView that is scrollable on both x and y axis. Choose either x direction or y direction."; var COLLECTION_REPEAT_ATTR_HEIGHT_ERROR = "collection-repeat expected attribute collection-item-height to be a an expression that returns a number (in pixels) or percentage."; var COLLECTION_REPEAT_ATTR_WIDTH_ERROR = "collection-repeat expected attribute collection-item-width to be a an expression that returns a number (in pixels) or percentage."; diff --git a/js/angular/directive/headerFooterBar.js b/js/angular/directive/headerFooterBar.js index 69b94f2e389..f5585fdd31f 100644 --- a/js/angular/directive/headerFooterBar.js +++ b/js/angular/directive/headerFooterBar.js @@ -40,45 +40,6 @@ IonicModule * * ``` */ -/** - * @ngdoc demo - * @name ionHeaderBar#simple - * @module headerBarSimple - * @javascript - * angular.module('headerBarSimple', ['ionic']) - * .controller('HeaderBarSimpleCtrl', function($scope) { - * $scope.data = { - * isSubheader: false, - * isShown: true - * }; - * $scope.items = []; - * for (var i = 0; i < 20; i++) { - * $scope.items.push('Item ' + i); - * } - * }); - * - * @html - *
- * - *

Tap Me to Scroll Top

- *
- * - * - * Make it a Subheader? - * - * - * Show it? - * - *
- *
- * {{item}} - *
- *
- *
- *
- */ .directive('ionHeaderBar', headerFooterBarDirective(true)) /** @@ -115,46 +76,6 @@ IonicModule * * ``` */ -/** - * @ngdoc demo - * @name ionFooterBar#simple - * @module footerBarSimple - * @javascript - * angular.module('footerBarSimple', ['ionic']) - * .controller('FooterBarSimpleCtrl', function($scope) { - * $scope.data = { - * isSubfooter: false, - * isShown: true - * }; - * - * $scope.items = []; - * for (var i = 0; i < 20; i++) { - * $scope.items.push('Item ' + i); - * } - * }); - * - * @html - *
- * - *

Footer

- *
- * - * - * Make it a Subfooter? - * - * - * Show it? - * - *
- *
- * {{item}} - *
- *
- *
- *
- */ .directive('ionFooterBar', headerFooterBarDirective(false)); function tapScrollToTopDirective() { diff --git a/js/angular/directive/infiniteScroll.js b/js/angular/directive/infiniteScroll.js index 4b3c9765b71..05c0ff5c65d 100644 --- a/js/angular/directive/infiniteScroll.js +++ b/js/angular/directive/infiniteScroll.js @@ -54,47 +54,6 @@ * * ``` */ -/** - * @ngdoc demo - * @name ionInfiniteScroll#forever - * @module infiniteScrollForever - * @javascript - * angular.module('infiniteScrollForever', ['ionic']) - * .controller('ForeverCtrl', function($scope, $timeout) { - * $scope.items = []; - * for (var i = 0; i < 20; i++) { - * $scope.items.push(i); - * } - * - * //Load more after 1 second delay - * $scope.loadMoreItems = function() { - * $timeout(function() { - * var i = $scope.items.length; - * var j = $scope.items.length + 5; - * for (; i < j; i++) { - * $scope.items.push('Item ' + i); - * } - * $scope.$broadcast('scroll.infiniteScrollComplete'); - * }, 1000); - * }; - * }); - * - * @html - * - *

Scroll Down to Load More

- *
- * - *
- *
- * {{item}} - *
- *
- * - * - * - *
- */ IonicModule .directive('ionInfiniteScroll', ['$timeout', function($timeout) { function calculateMaxValue(distance, maximum, isPercent) { diff --git a/js/angular/directive/list.js b/js/angular/directive/list.js index d5c01b1a5cd..ea0ba950679 100644 --- a/js/angular/directive/list.js +++ b/js/angular/directive/list.js @@ -72,155 +72,6 @@ * @param can-swipe {boolean=} Whether the items in the list are allowed to be swiped to reveal * option buttons. Default: true. */ -/** - * @ngdoc demo - * @name ionList#reorderDelete - * @module listEverything - * @javascript - * angular.module('listEverything', ['ionic']) - * .controller('ListCtrl', function($scope, $ionicPopup) { - * $scope.data = { - * showReorder: false, - * showDelete: false - * }; - * - * $scope.items = []; - * for (var i = 0; i < 20; i++) { - * $scope.items.push(i); - * } - * - * $scope.toggleDelete = function() { - * $scope.data.showReorder = false; - * $scope.data.showDelete = !$scope.data.showDelete; - * }; - * $scope.toggleReorder = function() { - * $scope.data.showDelete = false; - * $scope.data.showReorder = !$scope.data.showReorder; - * }; - * - * $scope.share = function(item) { - * alert('Sharing ' + item); - * }; - * $scope.edit = function(item) { - * alert('Editing ' + item); - * }; - * - * $scope.reorderItem = function(item, fromIndex, toIndex) { - * $scope.items.splice(fromIndex, 1) - * $scope.items.splice(toIndex, 0, item) - * }; - * }); - * - * @html - *
- * - * - * Delete - * - *

List

- * - * Reorder - * - *
- * - * - * - * - * - *

Item {{item}}

- *

Here's an item description.

- * - * Share - * - * - * Edit - * - * - * - * - * - * - *
- *
- *
- *
- */ -/** - * @ngdoc demo - * @name ionList#animated - * @module listAnimated - * @javascript - * angular.module('listAnimated', ['ionic']) - * .controller('AnimatedListCtrl', function($scope, $timeout) { - * var nextItem = 0; - * $scope.items = []; - * for (var i=0; i < 5; i++) { - * $scope.items.push('Item ' + (nextItem++)); - * } - * - * $scope.addItem = function(atIndex) { - * $scope.items.splice(atIndex + 1, 0, 'Item ' + nextItem); - * nextItem++; - * }; - * }); - * - * @html - *
- * - *

Animated List

- *
- * - * - * - * - * {{item}} - * - * - * - * - * - *
- * - * @css - * .animated-item .item-note .button { - * margin-top: 10px; - * } - * .animated-item { - * line-height: 52px; - * max-height: 52px; - * padding-top: 0; - * padding-bottom: 0; - * -webkit-transition: all 0.15s linear; - * -moz-transition: all 0.15s linear; - * transition: all 0.15s linear; - * } - * .animated-item.ng-leave.ng-leave-active, - * .animated-item.ng-enter { - * opacity: 0; - * max-height: 0; - * } - * .animated-item.ng-leave, - * .animated-item.ng-enter.ng-enter-active { - * opacity: 1; - * max-height: 52px; - * } - */ IonicModule .directive('ionList', [ '$animate', diff --git a/js/angular/directive/refresher.js b/js/angular/directive/refresher.js index a24573fa044..56dd26f94f6 100644 --- a/js/angular/directive/refresher.js +++ b/js/angular/directive/refresher.js @@ -57,45 +57,6 @@ * the refresher. * */ -/** - * @ngdoc demo - * @name ionRefresher#withAList - * @module refresherList - * @javascript - * angular.module('refresherList', ['ionic']) - * .controller('RefresherCtrl', function($scope, $timeout) { - * $scope.items = ['Item 1', 'Item 2', 'Item 3']; - * - * $scope.doRefresh = function() { - * $timeout(function() { - * $scope.items.push('New Item ' + Math.floor(Math.random() * 1000) + 4); - * $scope.items.push('New Item ' + Math.floor(Math.random() * 1000) + 4); - * $scope.items.push('New Item ' + Math.floor(Math.random() * 1000) + 4); - * $scope.items.push('New Item ' + Math.floor(Math.random() * 1000) + 4); - * $scope.$broadcast('scroll.refreshComplete'); - * }, 1000); - * }; - * }); - * - * @html - * - *

Refresher

- *
- * - * - * - * - * - * - * - * {{item}} - * - * - * - */ IonicModule .directive('ionRefresher', ['$ionicBind', function($ionicBind) { return { diff --git a/js/angular/directive/sideMenus.js b/js/angular/directive/sideMenus.js index 152eef1d7d7..ee59a53c6a0 100644 --- a/js/angular/directive/sideMenus.js +++ b/js/angular/directive/sideMenus.js @@ -50,211 +50,12 @@ IonicModule * with {@link ionic.service:$ionicSideMenuDelegate}. * */ -/** - * @ngdoc demo - * @name ionSideMenus#simple - * @module sideMenusSimple - * @javascript -var app = angular.module('sideMenusSimple', ['ionic']); -app.controller('SideMenusSimpleCtrl', function($scope, $ionicSideMenuDelegate) { - - $scope.toggleLeft = function() { - $ionicSideMenuDelegate.toggleLeft(); - }; - -}); - * - * @html - - - - - -
-
- -
-
-
- -

Slide the content or press the button on the header to open a side menu.

-
-
- - - - - - - Close Menu - - - - -
-
- */ -/** - * @ngdoc demo - * @name ionSideMenus#navWithMenu - * @module sideMenuWithNav - * @javascript -angular.module('sideMenuWithNav', ['ionic']) -.config(function($stateProvider, $urlRouterProvider) { - $stateProvider - - .state('app', { - url: "/app", - abstract: true, - templateUrl: "templates/menu.html", - controller: 'AppCtrl' - }) - - .state('app.search', { - url: "/search", - views: { - 'menuContent' :{ - templateUrl: "templates/search.html" - } - } - }) - - .state('app.browse', { - url: "/browse", - views: { - 'menuContent' :{ - templateUrl: "templates/browse.html" - } - } - }) - .state('app.playlists', { - url: "/playlists", - views: { - 'menuContent' :{ - templateUrl: "templates/playlists.html", - controller: 'PlaylistsCtrl' - } - } - }) - - .state('app.single', { - url: "/playlists/:playlistId", - views: { - 'menuContent' :{ - templateUrl: "templates/playlist.html", - controller: 'PlaylistCtrl' - } - } - }); - // if none of the above states are matched, use this as the fallback - $urlRouterProvider.otherwise('/app/playlists'); -}) - -.controller('AppCtrl', function($scope) { -}) - -.controller('PlaylistsCtrl', function($scope) { - $scope.playlists = [ - { title: 'Reggae', id: 1 }, - { title: 'Chill', id: 2 }, - { title: 'Dubstep', id: 3 }, - { title: 'Indie', id: 4 }, - { title: 'Rap', id: 5 }, - { title: 'Cowbell', id: 6 } - ]; -}) - -.controller('PlaylistCtrl', function($scope, $stateParams) { -}) - * - * @html - - - - - - - - - - - - - */ - .directive('ionSideMenus', [function() { return { restrict: 'ECA', - replace: true, - transclude: true, controller: '$ionicSideMenus', - template: '
' + compile: function(element, attr) { + attr.$set('class', (attr['class'] || '') + ' view'); + } }; }]); diff --git a/js/angular/directive/tabs.js b/js/angular/directive/tabs.js index 983525de626..f4330643166 100644 --- a/js/angular/directive/tabs.js +++ b/js/angular/directive/tabs.js @@ -43,186 +43,11 @@ * @param {string=} delegate-handle The handle used to identify these tabs * with {@link ionic.service:$ionicTabsDelegate}. */ -/** - * @ngdoc demo - * @name ionTabs#navigation - * @module tabsAndNavigation - * @javascript -angular.module('tabsAndNavigation', ['ionic']) -.config(function ($stateProvider, $urlRouterProvider) { - - $stateProvider - .state('tabs', { - url: "/tab", - abstract: true, - templateUrl: "tabs.html" - }) - .state('tabs.home', { - url: "/home", - views: { - 'home-tab': { - templateUrl: "home.html", - controller: 'HomeTabCtrl' - } - } - }) - .state('tabs.facts', { - url: "/facts", - views: { - 'home-tab': { - templateUrl: "facts.html" - } - } - }) - .state('tabs.facts2', { - url: "/facts2", - views: { - 'home-tab': { - templateUrl: "facts2.html" - } - } - }) - .state('tabs.about', { - url: "/about", - views: { - 'about-tab': { - templateUrl: "about.html" - } - } - }) - .state('tabs.navstack', { - url: "/navstack", - views: { - 'about-tab': { - templateUrl: "nav-stack.html" - } - } - }) - .state('tabs.contact', { - url: "/contact", - views: { - 'contact-tab': { - templateUrl: "contact.html" - } - } - }); - - - $urlRouterProvider.otherwise("/tab/home"); - -}) - -.controller('HomeTabCtrl', function ($scope) { - console.log('We have arrived at HomeTabCtrl.'); -}); - * - * @html - - - - - - - - - - - - - - - - - - - - -*/ IonicModule .directive('ionTabs', [ - '$ionicViewService', - '$ionicTabsDelegate', + '$ionicViewService', + '$ionicTabsDelegate', function($ionicViewService, $ionicTabsDelegate) { return { restrict: 'E', diff --git a/js/angular/service/actionSheet.js b/js/angular/service/actionSheet.js index ac7e14b735c..27223c6757d 100644 --- a/js/angular/service/actionSheet.js +++ b/js/angular/service/actionSheet.js @@ -40,66 +40,6 @@ * ``` * */ - -/** - * @ngdoc demo - * @name $ionicActionSheet#simple - * @module actionSheetSimple - * @javascript - * angular.module('actionSheetSimple', ['ionic']) - * .controller('ActionSheetCtrl', function($scope, $ionicActionSheet) { - * $scope.messages = []; - * $scope.takeAction = function() { - * $ionicActionSheet.show({ - * buttons: [ - * { text: 'Share ' }, - * { text: 'Edit ' } - * ], - * destructiveText: 'Delete ', - * titleText: 'Modify your album', - * cancelText: 'Cancel', - * cancel: function() { - * $scope.message('Cancel'); - * return true; - * }, - * buttonClicked: function(index) { - * $scope.message(index === 0 ? 'Share' : 'Edit'); - * return true; - * }, - * destructiveButtonClicked: function() { - * $scope.message('Delete'); - * return true; - * } - * }); - * }; - * $scope.message = function(msg) { - * $scope.messages.unshift({ - * text: 'User pressed ' + msg - * }); - * }; - * - * }); - * - * @html - * - *

Action

- *
- * - *
- * Take Action! - *
- *
- *
- * User Log - *
- *
- *
- * {{message.text}} - *
- *
- *
- *
- */ IonicModule .factory('$ionicActionSheet', [ '$rootScope', diff --git a/js/angular/service/loading.js b/js/angular/service/loading.js index e13ee5e44f8..e6c26446c77 100644 --- a/js/angular/service/loading.js +++ b/js/angular/service/loading.js @@ -30,53 +30,6 @@ var LOADING_SET_DEPRECATED = '$ionicLoading instance.setContent() has been depre * }); * ``` */ -/** - * @ngdoc demo - * @name $ionicLoading#loadThemAll - * @module loadingThemAll - * @javascript - * angular.module('loadingThemAll', ['ionic']) - * .controller('LoadingCtrl', function($scope, $ionicLoading) { - * $scope.loadingOptions = { - * duration: 1000, - * delay: 0, - * template: '\n
\nLoading...', - * noBackdrop: false - * }; - * $scope.showLoading = function() { - * $ionicLoading.show($scope.loadingOptions); - * }; - * }); - * @html - *
- * - *

Loading Demo

- * - * Load - * - *
- * - *
- * - * - * - * - * Hide Backdrop? - * - *
- *
- *
- */ IonicModule .factory('$ionicLoading', [ '$document', diff --git a/js/angular/service/popup.js b/js/angular/service/popup.js index c83b5eb587a..57367175759 100644 --- a/js/angular/service/popup.js +++ b/js/angular/service/popup.js @@ -97,118 +97,6 @@ var POPUP_TPL = *``` */ -/** - * @ngdoc demo - * @name $ionicPopup#simple - * @module popupSimple - * @javascript -angular.module('popupSimple', ['ionic']) -.controller('PopupCtrl', function($scope, $timeout, $q, $ionicPopup) { - $scope.showPopup = function() { - $scope.data = {} - - $ionicPopup.show({ - templateUrl: 'popup-template.html', - title: 'Enter Wi-Fi Password', - subTitle: 'Please use normal things', - scope: $scope, - buttons: [ - { text: 'Cancel', onTap: function(e) { return true; } }, - { - text: 'Save', - type: 'button-positive', - onTap: function(e) { - return $scope.data.wifi; - } - }, - ] - }).then(function(res) { - console.log('Tapped!', res); - }, function(err) { - console.log('Err:', err); - }, function(msg) { - console.log('message:', msg); - }); - - $timeout(function() { - $ionicPopup.confirm({ - title: 'Do you like ice cream?', - cancelText: 'No', - okText: 'Yes, of course' - }).then(function(res) { - console.log('Your love for ice cream:', res); - }); - }, 1000); - }; - - $scope.showConfirm = function() { - $ionicPopup.confirm({ - title: 'Consume Ice Cream', - content: 'Are you sure you want to eat this ice cream?' - }).then(function(res) { - if(res) { - console.log('You are sure'); - } else { - console.log('You are not sure'); - } - }); - }; - $scope.showPrompt = function() { - $ionicPopup.prompt({ - title: 'ID Check', - subTitle: 'What is your name?' - }).then(function(res) { - console.log('Your name is', res); - }); - }; - $scope.showPasswordPrompt = function() { - $ionicPopup.prompt({ - title: 'Password Check', - subTitle: 'Enter your secret password', - inputType: 'password', - inputPlaceholder: 'Your password' - }).then(function(res) { - console.log('Your name is', res); - }); - }; - $scope.showAlert = function() { - $ionicPopup.alert({ - title: 'Draft Saved', - content: 'Your Data has been saved!' - }).then(function(res) { - console.log('Your Data has been saved!'); - }, function(err) {}, - function(popup) { - console.log('Got popup', popup); - $timeout(function() { - popup.close(); - }, 1000); - }); - }; -}); - * @html - -

Popups

-
- - - - - - - - - - - * - */ IonicModule .factory('$ionicPopup', [ '$ionicTemplateLoader', diff --git a/package.json b/package.json index 76004265625..b9fddd89932 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,6 @@ "karma-sauce-launcher": "~0.2.0", "karma-script-launcher": "~0.1.0", "sauce-connect-launcher": "^0.2.2", - "dgeni": "angular/dgeni#master", - "dgeni-packages": "angular/dgeni-packages#master", "gulp-template": "^0.1.1", "gulp-concat": "^2.1.7", "gulp-jshint": "^1.5.0", @@ -35,12 +33,10 @@ "minimist": "0.0.8", "gulp-minify-css": "^0.3.0", "semver": "^2.2.1", - "cp-r": "^0.1.1", "mkdirp": "^0.3.5", "conventional-changelog": "0.0.9", "lunr": "0.4.5", "htmlparser2": "3.7.0", - "js-yaml": "3.0.2", "event-stream": "3.1.0", "gulp-strip-debug": "^0.3.0", "gulp-footer": "^1.0.4", @@ -48,7 +44,13 @@ "ircb": "^0.3.1", "node-twitter-api": "^1.2.2", "chalk": "^0.4.0", - "jshint-summary": "^0.3.0" + "jshint-summary": "^0.3.0", + "js-yaml": "^3.0.2", + "jasmine-node": "^1.14.3", + "q": "^1.0.1", + "cpr": "^0.2.0", + "dgeni": "^0.3.0", + "dgeni-packages": "^0.9.3" }, "licenses": [ { diff --git a/scripts/demo/publish.sh b/scripts/demo/publish.sh new file mode 100755 index 00000000000..dfcf9c8c3a0 --- /dev/null +++ b/scripts/demo/publish.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +ARG_DEFS=( + "--version=(.*)" +) + +function init { + DEMO_DIR=$IONIC_DIST_DIR/ionic-demo + + echo "-- Cloning ionic-demo" + rm -rf $DEMO_DIR + mkdir -p $DEMO_DIR + git clone https://driftyco:$GH_TOKEN@github.com/driftyco/ionic-demo \ + $DEMO_DIR \ + --depth=1 \ + --branch=gh-pages +} + +function run { + cd $IONIC_DIR + + rm -rf $DEMO_DIR/$VERSION + gulp demos --release --demo-version=$VERSION + + cd $DEMO_DIR + + CHANGES=$(git status --porcelain) + + # if no changes, don't commit + if [[ "$CHANGES" == "" ]]; then + echo "-- No changes detected in demos for $VERSION; demos not updated." + else + git add -A + git commit -am "demos: update for $VERSION" + git push -q origin gh-pages + + echo "-- Updated demos for $VERSION succesfully!" + fi +} + +source $(dirname $0)/../utils.inc diff --git a/scripts/travis/ci.sh b/scripts/travis/ci.sh index 01768d08650..a0f8f050c29 100755 --- a/scripts/travis/ci.sh +++ b/scripts/travis/ci.sh @@ -25,7 +25,6 @@ function run { cd ../.. echo "GH_ORG=driftyco" - echo "RELEASE_REMOTE=$RELEASE_REMOTE" echo "TRAVIS_BRANCH=$TRAVIS_BRANCH" echo "TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER" echo "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST" @@ -118,7 +117,7 @@ function run { gulp changelog --standalone \ --html=true \ --subtitle="(changes since $OLD_VERSION)" \ - --dest="dist/CHANGELOG.html" \ + --dest="$IONIC_BUILD_DIR/CHANGELOG.html" \ --from="$(git tag | grep $OLD_VERSION)" fi @@ -134,6 +133,9 @@ function run { --version="$VERSION" \ --codename="$CODENAME" + ./scripts/demo/publish.sh \ + --version="$VERSION" + if [[ "$IS_RELEASE" == "true" ]]; then echo "################################################"