diff --git a/bower.json b/bower.json index 12bf8ae..3d37925 100644 --- a/bower.json +++ b/bower.json @@ -3,9 +3,9 @@ "name": "https://github.com/angular-ui/bootstrap/graphs/contributors" }, "name": "angular-bootstrap", - "version": "0.6.0", + "version": "0.6.0-SNAPSHOT", "main": ["./ui-bootstrap-tpls.js"], "dependencies": { - "angular": ">=1" + "angular": ">=1.2" } } diff --git a/ui-bootstrap-tpls.js b/ui-bootstrap-tpls.js index ed018f8..684d845 100644 --- a/ui-bootstrap-tpls.js +++ b/ui-bootstrap-tpls.js @@ -1386,31 +1386,21 @@ angular.module('ui.bootstrap.modal', []) /** * A helper directive for the $modal service. It creates a backdrop element. */ - .directive('modalBackdrop', ['$modalStack', '$timeout', function ($modalStack, $timeout) { + .directive('modalBackdrop', ['$timeout', function ($timeout) { return { restrict: 'EA', replace: true, templateUrl: 'template/modal/backdrop.html', link: function (scope, element, attrs) { - //trigger CSS transitions $timeout(function () { scope.animate = true; }); - - scope.close = function (evt) { - var modal = $modalStack.getTop(); - if (modal && modal.value.backdrop && modal.value.backdrop != 'static') { - evt.preventDefault(); - evt.stopPropagation(); - $modalStack.dismiss(modal.key, 'backdrop click'); - } - }; } }; }]) - .directive('modalWindow', ['$timeout', function ($timeout) { + .directive('modalWindow', ['$modalStack', '$timeout', function ($modalStack, $timeout) { return { restrict: 'EA', scope: { @@ -1426,6 +1416,15 @@ angular.module('ui.bootstrap.modal', []) $timeout(function () { scope.animate = true; }); + + scope.close = function (evt) { + var modal = $modalStack.getTop(); + if (modal && modal.value.backdrop && modal.value.backdrop != 'static' && (evt.target === evt.currentTarget)) { + evt.preventDefault(); + evt.stopPropagation(); + $modalStack.dismiss(modal.key, 'backdrop click'); + } + }; } }; }]) @@ -1450,6 +1449,10 @@ angular.module('ui.bootstrap.modal', []) return topBackdropIndex; } + $rootScope.$watch(openedWindows.length, function(noOfModals){ + body.toggleClass('modal-open', openedWindows.length() > 0); + }); + $rootScope.$watch(backdropIndex, function(newBackdropIndex){ backdropScope.index = newBackdropIndex; }); @@ -1513,9 +1516,9 @@ angular.module('ui.bootstrap.modal', []) }; $modalStack.close = function (modalInstance, result) { - var modal = openedWindows.get(modalInstance); - if (modal) { - modal.value.deferred.resolve(result); + var modalWindow = openedWindows.get(modalInstance).value; + if (modalWindow) { + modalWindow.deferred.resolve(result); removeModalWindow(modalInstance); } }; @@ -1537,11 +1540,13 @@ angular.module('ui.bootstrap.modal', []) .provider('$modal', function () { - var $modalProvider = { - options: { - backdrop: true, //can be also false or 'static' - keyboard: true - }, + var defaultOptions = { + backdrop: true, //can be also false or 'static' + keyboard: true + }; + + return { + options: defaultOptions, $get: ['$injector', '$rootScope', '$q', '$http', '$templateCache', '$controller', '$modalStack', function ($injector, $rootScope, $q, $http, $templateCache, $controller, $modalStack) { @@ -1574,15 +1579,15 @@ angular.module('ui.bootstrap.modal', []) result: modalResultDeferred.promise, opened: modalOpenedDeferred.promise, close: function (result) { - $modalStack.close(modalInstance, result); + $modalStack.close(this, result); }, dismiss: function (reason) { - $modalStack.dismiss(modalInstance, reason); + $modalStack.dismiss(this, reason); } }; //merge and clean up options - modalOptions = angular.extend({}, $modalProvider.options, modalOptions); + modalOptions = angular.extend({}, defaultOptions, modalOptions); modalOptions.resolve = modalOptions.resolve || {}; //verify options @@ -1597,8 +1602,6 @@ angular.module('ui.bootstrap.modal', []) templateAndResolvePromise.then(function resolveSuccess(tplAndVars) { var modalScope = (modalOptions.scope || $rootScope).$new(); - modalScope.$close = modalInstance.close; - modalScope.$dismiss = modalInstance.dismiss; var ctrlInstance, ctrlLocals = {}; var resolveIter = 1; @@ -1639,8 +1642,6 @@ angular.module('ui.bootstrap.modal', []) return $modal; }] }; - - return $modalProvider; }); angular.module('ui.bootstrap.pagination', []) @@ -2488,6 +2489,7 @@ function TabsetCtrl($scope, $element) { * Tabset is the outer container for the tabs directive * * @param {boolean=} vertical Whether or not to use vertical styling for the tabs. + * @param {boolean=} justified Whether or not to use justified styling for the tabs. * @param {string=} direction What direction the tabs should be rendered. Available: * 'right', 'left', 'below'. * @@ -2495,14 +2497,18 @@ function TabsetCtrl($scope, $element) { - First Content! - Second Content! + First Content! + Second Content!
First Vertical Content! Second Vertical Content! + + First Justified Content! + Second Justified Content! +
*/ @@ -2518,6 +2524,7 @@ function TabsetCtrl($scope, $element) { compile: function(elm, attrs, transclude) { return function(scope, element, attrs, tabsetCtrl) { scope.vertical = angular.isDefined(attrs.vertical) ? scope.$parent.$eval(attrs.vertical) : false; + scope.justified = angular.isDefined(attrs.justified) ? scope.$parent.$eval(attrs.justified) : false; scope.type = angular.isDefined(attrs.type) ? scope.$parent.$eval(attrs.type) : 'tabs'; scope.direction = angular.isDefined(attrs.direction) ? scope.$parent.$eval(attrs.direction) : 'top'; scope.tabsAbove = (scope.direction != 'below'); @@ -3309,21 +3316,26 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap }); angular.module("template/accordion/accordion-group.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("template/accordion/accordion-group.html", - "
\n" + - "
{{heading}}
\n" + - "
\n" + - "
\n" + + "
\n" + + "
\n" + + "

\n" + + " {{heading}}\n" + + "

\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + "
"); }]); angular.module("template/accordion/accordion.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("template/accordion/accordion.html", - "
"); + "
"); }]); angular.module("template/alert/alert.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("template/alert/alert.html", - "
\n" + + "
\n" + " \n" + "
\n" + "
\n" + @@ -3337,8 +3349,8 @@ angular.module("template/carousel/carousel.html", []).run(["$templateCache", fun "
  • \n" + " \n" + "
    \n" + - " 1\">‹\n" + - " 1\">›\n" + + " 1\">\n" + + " 1\">\n" + "
    \n" + ""); }]); @@ -3351,34 +3363,42 @@ angular.module("template/carousel/slide.html", []).run(["$templateCache", functi " 'next': (next || active) && direction=='next',\n" + " 'right': direction=='prev',\n" + " 'left': direction=='next'\n" + - " }\" class=\"item\" ng-transclude>
    \n" + + " }\" class=\"item text-center\" ng-transclude>\n" + ""); }]); angular.module("template/datepicker/datepicker.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("template/datepicker/datepicker.html", - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + + "
    \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + " \n" + - " 0\">\n" + - " \n" + - " \n" + + " 0\">\n" + + " \n" + + " \n" + " \n" + " \n" + " \n" + " \n" + - " \n" + - " \n" + + " \n" + " \n" + " \n" + - "
    \n" + + " \n" + + " \n" + + " \n" + + "
    #{{label}}
    #
    {{label}}
    {{ getWeekNumber(row) }}\n" + - " \n" + + " \n" + + " \n" + "
    \n" + - ""); + ""); }]); angular.module("template/datepicker/popup.html", []).run(["$templateCache", function($templateCache) { @@ -3388,41 +3408,39 @@ angular.module("template/datepicker/popup.html", []).run(["$templateCache", func "
  • \n" + "
  • \n" + " \n" + - " \n" + - " \n" + - " \n" + + " \n" + + " \n" + + " \n" + " \n" + - " \n" + + " \n" + "
  • \n" + ""); }]); angular.module("template/modal/backdrop.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("template/modal/backdrop.html", - "
    "); + "
    "); }]); angular.module("template/modal/window.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("template/modal/window.html", - "
    "); + "
    \n" + + "
    \n" + + "
    "); }]); angular.module("template/pagination/pager.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("template/pagination/pager.html", - "
    \n" + - "
    \n" + - ""); + ""); }]); angular.module("template/pagination/pagination.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("template/pagination/pagination.html", - "
    \n" + + "\n" + ""); }]); @@ -3474,12 +3492,6 @@ angular.module("template/rating/rating.html", []).run(["$templateCache", functio ""); }]); -angular.module("template/tabs/pane.html", []).run(["$templateCache", function($templateCache) { - $templateCache.put("template/tabs/pane.html", - "
    \n" + - ""); -}]); - angular.module("template/tabs/tab.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("template/tabs/tab.html", "
  • \n" + @@ -3488,22 +3500,9 @@ angular.module("template/tabs/tab.html", []).run(["$templateCache", function($te ""); }]); -angular.module("template/tabs/tabs.html", []).run(["$templateCache", function($templateCache) { - $templateCache.put("template/tabs/tabs.html", - "
    \n" + - " \n" + - "
    \n" + - "
    \n" + - ""); -}]); - angular.module("template/tabs/tabset-titles.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("template/tabs/tabset-titles.html", - "