diff --git a/docs/tag-defs/index.js b/docs/tag-defs/index.js index 8a603cf83da..4b19bdcbf06 100644 --- a/docs/tag-defs/index.js +++ b/docs/tag-defs/index.js @@ -2,9 +2,17 @@ module.exports = [ { name: 'controller', transformFn: function(doc, tag) { - return '{@link ionic.controller:' + tag.description.trim() + '}'; + var desc = tag.description.trim(); + var id = desc.split(' ')[0]; + var other = desc.split(' ').splice(1).join(' '); + + var link = '{@link ionic.controller:' + id + '}'; + return link + (other ? ' ' + other : ''); } }, + { + name: 'controllerBind', + }, { name: 'parent', transformFn: function(doc, tag) { diff --git a/docs/templates/api/api.template.html b/docs/templates/api/api.template.html index 1f870fb7f65..79233654217 100644 --- a/docs/templates/api/api.template.html +++ b/docs/templates/api/api.template.html @@ -22,13 +22,15 @@

<$ doc.name $> <@ endif @> <@ if doc.parentLinks @> +
- (child of <$ doc.parentLinks $>) + Child of <$ doc.parentLinks $> <@ endif @> <@ if doc.controller @> +
- (controller: <$ doc.controller $>) + Controller: <$ doc.controller $> <@ endif @>

diff --git a/gulpfile.js b/gulpfile.js index 43c86fb825e..7a3984632e9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -3,10 +3,10 @@ var buildConfig = require('./config/build.config.js'); var changelog = require('conventional-changelog'); var connect = require('connect'); var dgeni = require('dgeni'); -var lunr = require('lunr'); +var es = require('event-stream'); var htmlparser = require('htmlparser2'); +var lunr = require('lunr'); var yaml = require('js-yaml'); -var es = require('event-stream'); var http = require('http'); var cp = require('child_process'); @@ -47,7 +47,7 @@ gulp.task('build', ['bundle', 'sass']); gulp.task('docs-index', function() { var idx = lunr(function() { - this.field('path'); + this.field('path'); this.field('title', {boost: 10}); this.field('body'); this.ref('path') @@ -55,7 +55,7 @@ gulp.task('docs-index', function() { var ref = {}; return gulp.src([ - 'tmp/ionic-site/docs/{components,guide,overview,angularjs}/**/*.{md,html}', + 'tmp/ionic-site/docs/{components,guide,overview,angularjs}/**/*.{md,html}', 'tmp/ionic-site/tutorials/**/*.{md,html}' ]) .pipe(es.map(function(file, callback) { @@ -72,7 +72,7 @@ gulp.task('docs-index', function() { var properties = yaml.safeLoad(yamlRaw); contents = contents.slice(yamlEndIndex+3); - + if(properties.title && properties.layout) { title = properties.title; layout = properties.layout; @@ -87,7 +87,7 @@ gulp.task('docs-index', function() { // Ignore any Jekyll expressions body += text.replace(/{%.*%}/, '', 'g'); }, - }); + }); parser.write(contents); parser.end(); @@ -115,7 +115,7 @@ gulp.task('docs', function(done) { }); var IS_WATCH = false; -gulp.task('watch', function() { +gulp.task('watch', ['bundle'], function() { IS_WATCH = true; gulp.watch('js/**/*.js', ['bundle']); gulp.watch('scss/**/*.scss', ['sass']); diff --git a/js/controllers/sideMenuController.js b/js/controllers/sideMenuController.js index 8afd32c003f..8d018241c61 100644 --- a/js/controllers/sideMenuController.js +++ b/js/controllers/sideMenuController.js @@ -49,29 +49,43 @@ }; }, + isOpenLeft: function() { + return this._leftShowing; + }, + + isOpenRight: function() { + return this._rightShowing; + }, + /** * Toggle the left menu to open 100% */ - toggleLeft: function() { + toggleLeft: function(shouldOpen) { + if (arguments.length === 0) { + shouldOpen = !this._leftShowing; + } this.content.enableAnimation(); var openAmount = this.getOpenAmount(); - if(openAmount > 0) { - this.openPercentage(0); - } else { + if(shouldOpen) { this.openPercentage(100); + } else { + this.openPercentage(0); } }, /** * Toggle the right menu to open 100% */ - toggleRight: function() { + toggleRight: function(shouldOpen) { + if (arguments.length === 0) { + shouldOpen = !this._rightShowing; + } this.content.enableAnimation(); var openAmount = this.getOpenAmount(); - if(openAmount < 0) { - this.openPercentage(0); - } else { + if(shouldOpen) { this.openPercentage(-100); + } else { + this.openPercentage(0); } }, diff --git a/js/ext/angular/src/directive/ionicBar.js b/js/ext/angular/src/directive/ionicBar.js index 8443a0901ab..5844c01cd62 100644 --- a/js/ext/angular/src/directive/ionicBar.js +++ b/js/ext/angular/src/directive/ionicBar.js @@ -17,7 +17,7 @@ angular.module('ionic.ui.header', ['ngAnimate', 'ngSanitize']) * @name ionHeaderBar * @module ionic * @restrict E - * @controller ionicBar + * @controller ionicBar as $scope.$ionicHeaderBarController * * @description * Adds a fixed header bar above some content. @@ -25,9 +25,9 @@ angular.module('ionic.ui.header', ['ngAnimate', 'ngSanitize']) * Is able to have left or right buttons, and additionally its title can be * aligned through the {@link ionic.controller:ionicBar ionicBar controller}. * - * @param {string=} model The model to assign this headerBar's + * @param {string=} controller-bind The scope variable to bind this header bar's * {@link ionic.controller:ionicBar ionicBar controller} to. - * Defaults to assigning to $scope.headerBarController. + * Default: $scope.$ionicHeaderBarController. * @param {string=} align-title Where to align the title at the start. * Avaialble: 'left', 'right', or 'center'. Defaults to 'center'. * @@ -54,7 +54,7 @@ angular.module('ionic.ui.header', ['ngAnimate', 'ngSanitize']) * @name ionFooterBar * @module ionic * @restrict E - * @controller ionicBar + * @controller ionicBar as $scope.$ionicFooterBarController * * @description * Adds a fixed footer bar below some content. @@ -62,9 +62,9 @@ angular.module('ionic.ui.header', ['ngAnimate', 'ngSanitize']) * Is able to have left or right buttons, and additionally its title can be * aligned through the {@link ionic.controller:ionicBar ionicBar controller}. * - * @param {string=} model The model to assign this footerBar's + * @param {string=} controller-bind The scope variable to bind this footer bar's * {@link ionic.controller:ionicBar ionicBar controller} to. - * Defaults to assigning to $scope.footerBarController. + * Default: $scope.$ionicFooterBarController. * @param {string=} align-title Where to align the title at the start. * Avaialble: 'left', 'right', or 'center'. Defaults to 'center'. * @@ -91,8 +91,8 @@ function barDirective(isHeader) { '
' : ''; var BAR_MODEL_DEFAULT = isHeader ? - 'headerBarController' : - 'footerBarController'; + '$ionicHeaderBarController' : + '$ionicFooterBarController'; return ['$parse', function($parse) { return { restrict: 'E', @@ -105,7 +105,7 @@ function barDirective(isHeader) { alignTitle: $attr.alignTitle || 'center' }); - $parse($attr.model || BAR_MODEL_DEFAULT).assign($scope, hb); + $parse($attr.controllerBind || BAR_MODEL_DEFAULT).assign($scope, hb); } }; }]; diff --git a/js/ext/angular/src/directive/ionicNavAnimation.js b/js/ext/angular/src/directive/ionicNavAnimation.js deleted file mode 100644 index f573f355a58..00000000000 --- a/js/ext/angular/src/directive/ionicNavAnimation.js +++ /dev/null @@ -1,43 +0,0 @@ -(function() { -angular.module('ionic.ui.navAnimation', []) -/** - * @ngdoc directive - * @name ionNavAnimation - * @module ionic - * @restrict A - * @parent ionic.directive:ionNavView - * - * @description - * When used under an {@link ionic.directive:ionNavView} and on an `` element, - * allows you to set the animation all clicks on that link within the navView use. - * - * @usage - * ```html - * - * - * - * - * Click me and #/some-page will transition in with the slide-in-up animation! - * - * - * - * - * ``` - * - * @param {string} ion-nav-animation The animation to make the parent ionNavView change pages with when clicking this element. - */ -.directive('ionNavAnimation', function() { - return { - restrict: 'A', - require: '^?ionNavView', - link: function($scope, $element, $attrs, navViewCtrl) { - if (!navViewCtrl) { - return; - } - ionic.on('tap', function() { - navViewCtrl.setNextAnimation($attrs.ionNavAnimation); - }, $element[0]); - } - }; -}); -})(); diff --git a/js/ext/angular/src/directive/ionicNavBar.js b/js/ext/angular/src/directive/ionicNavBar.js index f5603ce60db..cd2b39dc427 100644 --- a/js/ext/angular/src/directive/ionicNavBar.js +++ b/js/ext/angular/src/directive/ionicNavBar.js @@ -8,16 +8,18 @@ angular.module('ionic.ui.navBar', ['ionic.service.view', 'ngSanitize']) * @description * Controller for the {@link ionic.directive:ionNavBar} directive. */ -.controller('$ionicNavBar', ['$scope', '$element', '$ionicViewService', '$animate', '$compile', +.controller('$ionicNavBar', [ + '$scope', + '$element', + '$ionicViewService', + '$animate', + '$compile', function($scope, $element, $ionicViewService, $animate, $compile) { //Let the parent know about our controller too so that children of - //sibling content elements can know about us. + //sibling content elements can know about us $element.parent().data('$ionNavBarController', this); - var hb = this._headerBarView = new ionic.views.HeaderBar({ - el: $element[0], - alignTitle: $scope.alignTitle || 'center' - }); + var self = this; this.leftButtonsElement = angular.element( $element[0].querySelector('.buttons.left-buttons') @@ -148,7 +150,7 @@ function($scope, $element, $ionicViewService, $animate, $compile) { var insert = oldTitleEl && angular.element(oldTitleEl) || null; $animate.enter(newTitleEl, $element, insert, function() { - hb.align(); + self._headerBarView.align(); }); //Cleanup any old titles leftover (besides the one we already did replaceWith on) @@ -174,7 +176,7 @@ function($scope, $element, $ionicViewService, $animate, $compile) { * @ngdoc directive * @name ionNavBar * @module ionic - * @controller ionicNavBar + * @controller ionicNavBar as $scope.$ionicNavBarController * @restrict E * * @description @@ -186,25 +188,26 @@ function($scope, $element, $ionicViewService, $animate, $compile) { * We can add buttons depending on the currently visible view using * {@link ionic.directive:ionNavButtons}. * + * Assign an [animation class](/docs/components#animations) to the element to + * enable animated changing of titles (recommended: 'slide-left-right' or 'nav-title-slide-ios7') + * * @usage * * ```html * * - * + * * * * - * + * * * ``` * - * @param model {string=} The model to assign the + * @param controller-bind {string=} The scope expression to bind this element's * {@link ionic.controller:ionicNavBar ionicNavBar controller} to. - * Default: assigns it to $scope.navBarController. - * @param animation {string=} The animation used to transition between titles. - * @param align {string=} Where to align the title of the navbar. + * Default: $ionicNavBarController. + * @param align-title {string=} Where to align the title of the navbar. * Available: 'left', 'right', 'center'. Defaults to 'center'. */ .directive('ionNavBar', ['$ionicViewService', '$rootScope', '$animate', '$compile', '$parse', @@ -215,10 +218,6 @@ function($ionicViewService, $rootScope, $animate, $compile, $parse) { replace: true, transclude: true, controller: '$ionicNavBar', - scope: { - animation: '@', - alignTitle: '@' - }, template: '