diff --git a/Gruntfile.js b/Gruntfile.js index 029f70ecc8..9544cb5276 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -17,7 +17,7 @@ module.exports = function(grunt) { grunt.initConfig({ ngversion: '1.2.10', - bsversion: '3.0.3', + bsversion: '3.1.1', modules: [],//to be filled in by build task pkg: grunt.file.readJSON('package.json'), dist: 'dist', diff --git a/src/modal/docs/demo.html b/src/modal/docs/demo.html index c1365a08c5..0496451c53 100644 --- a/src/modal/docs/demo.html +++ b/src/modal/docs/demo.html @@ -1,7 +1,7 @@
+ +
Selection from a modal: {{ selected }}
\ No newline at end of file diff --git a/src/modal/docs/demo.js b/src/modal/docs/demo.js index 34b8be0efd..191ca03b66 100644 --- a/src/modal/docs/demo.js +++ b/src/modal/docs/demo.js @@ -2,11 +2,12 @@ var ModalDemoCtrl = function ($scope, $modal, $log) { $scope.items = ['item1', 'item2', 'item3']; - $scope.open = function () { + $scope.open = function (size) { var modalInstance = $modal.open({ templateUrl: 'myModalContent.html', controller: ModalInstanceCtrl, + size: size, resolve: { items: function () { return $scope.items; diff --git a/src/modal/docs/readme.md b/src/modal/docs/readme.md index 44dd951ce4..8b64252d4c 100644 --- a/src/modal/docs/readme.md +++ b/src/modal/docs/readme.md @@ -12,6 +12,7 @@ The `$modal` service has only one method: `open(options)` where available option * `keyboard` - indicates whether the dialog should be closable by hitting the ESC key, defaults to true * `windowClass` - additional CSS class(es) to be added to a modal window template * `windowTemplateUrl` - a path to a template overriding modal's window template +* `size` - optional size of modal window. Allowed values: `'sm'` (small) or `'lg'` (large). Requires Bootstrap 3.1.0 or later The `open` method returns a modal instance, an object with the following properties: diff --git a/src/modal/modal.js b/src/modal/modal.js index bf8de5374b..c753b5fc5b 100644 --- a/src/modal/modal.js +++ b/src/modal/modal.js @@ -88,6 +88,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition']) }, link: function (scope, element, attrs) { element.addClass(attrs.windowClass || ''); + scope.size = attrs.size; $timeout(function () { // trigger CSS transitions @@ -232,6 +233,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition']) angularDomEl.attr({ 'template-url': modal.windowTemplateUrl, 'window-class': modal.windowClass, + 'size': modal.size, 'index': openedWindows.length() - 1, 'animate': 'animate' }).html(modal.content); @@ -359,7 +361,8 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition']) backdrop: modalOptions.backdrop, keyboard: modalOptions.keyboard, windowClass: modalOptions.windowClass, - windowTemplateUrl: modalOptions.windowTemplateUrl + windowTemplateUrl: modalOptions.windowTemplateUrl, + size: modalOptions.size }); }, function resolveError(reason) { diff --git a/src/modal/test/modal.spec.js b/src/modal/test/modal.spec.js index 6c6259a15b..28d2117795 100644 --- a/src/modal/test/modal.spec.js +++ b/src/modal/test/modal.spec.js @@ -431,6 +431,27 @@ describe('$modal', function () { expect($document.find('div.modal')).toHaveClass('additional'); }); }); + + describe('size', function () { + + it('should support creating small modal dialogs', function () { + open({ + template: '
Small modal dialog
', + size: 'sm' + }); + + expect($document.find('div.modal-dialog')).toHaveClass('modal-sm'); + }); + + it('should support creating large modal dialogs', function () { + open({ + template: '
Large modal dialog
', + size: 'lg' + }); + + expect($document.find('div.modal-dialog')).toHaveClass('modal-lg'); + }); + }); }); describe('multiple modals', function () { diff --git a/template/modal/window.html b/template/modal/window.html index 419c4b764c..250d1c20c5 100644 --- a/template/modal/window.html +++ b/template/modal/window.html @@ -1,3 +1,3 @@ \ No newline at end of file