diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..352204d8f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +*.html eol=lf +*.css eol=lf +*.js eol=lf +*.md eol=lf +*.json eol=lf +*.yml eol=lf diff --git a/.travis.yml b/.travis.yml index f4f24e0e28..bcad7a389a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ - language: node_js - node_js: - - "0.8" - - before_script: - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start - - npm install --quiet -g grunt-cli karma - - npm install - + language: node_js + node_js: + - "0.8" + + before_script: + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start + - npm install --quiet -g grunt-cli karma + - npm install + script: grunt \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b445dcd1dd..72e7a82d39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,93 +1,93 @@ -# 0.3.0 (2013-04-30) - -## Features - -- **progressbar:** - - add progressbar directive ([261f2072](https://github.com/angular-ui/bootstrap/commit/261f2072)) -- **rating:** - - add rating directive ([6b5e6369](https://github.com/angular-ui/bootstrap/commit/6b5e6369)) -- **typeahead:** - - support the editable property ([a40c3fbe](https://github.com/angular-ui/bootstrap/commit/a40c3fbe)) - - support typeahead-loading bindable expression ([b58c9c88](https://github.com/angular-ui/bootstrap/commit/b58c9c88)) -- **tooltip:** - - added popup-delay option ([a79a2ba8](https://github.com/angular-ui/bootstrap/commit/a79a2ba8)) - - added appendToBody to $tooltip ([1ee467f8](https://github.com/angular-ui/bootstrap/commit/1ee467f8)) - - added tooltip-html-unsafe directive ([45ed2805](https://github.com/angular-ui/bootstrap/commit/45ed2805)) - - support for custom triggers ([b1ba821b](https://github.com/angular-ui/bootstrap/commit/b1ba821b)) - -## Bug Fixes - -- **alert:** - - don't show close button if no close callback specified ([c2645f4a](https://github.com/angular-ui/bootstrap/commit/c2645f4a)) -- **carousel:** - - Hide navigation indicators if only one slide ([aedc0565](https://github.com/angular-ui/bootstrap/commit/aedc0565)) -- **collapse:** - - remove reference to msTransition for IE10 ([55437b16](https://github.com/angular-ui/bootstrap/commit/55437b16)) -- **dialog:** - - set _open to false on init ([dcc9ef31](https://github.com/angular-ui/bootstrap/commit/dcc9ef31)) - - close dialog on location change ([474ce52e](https://github.com/angular-ui/bootstrap/commit/474ce52e)) - - IE8 fix to not set data() against text nodes ([a6c540e5](https://github.com/angular-ui/bootstrap/commit/a6c540e5)) - - fix $apply in progres on $location change ([77e6acb9](https://github.com/angular-ui/bootstrap/commit/77e6acb9)) -- **tabs:** - - remove superfluous href from tabs template ([38c1badd](https://github.com/angular-ui/bootstrap/commit/38c1badd)) -- **tooltip:** - - fix positioning issues in tooltips and popovers ([6458f487](https://github.com/angular-ui/bootstrap/commit/6458f487)) -- **typeahead:** - - close matches popup on click outside typeahead ([acca7dcd](https://github.com/angular-ui/bootstrap/commit/acca7dcd)) - - stop keydown event propagation when ESC pressed to discard matches ([22a00cd0](https://github.com/angular-ui/bootstrap/commit/22a00cd0)) - - correctly render initial model value ([929a46fa](https://github.com/angular-ui/bootstrap/commit/929a46fa)) - - correctly higlight matches if query contains regexp-special chars ([467afcd6](https://github.com/angular-ui/bootstrap/commit/467afcd6)) - - fix matches pop-up positioning issues ([74beecdb](https://github.com/angular-ui/bootstrap/commit/74beecdb)) - -# 0.2.0 (2013-03-03) - -## Features - -- **dialog:** - - Make $dialog 'resolve' property to work the same way of $routeProvider.when ([739f86f](https://github.com/angular-ui/bootstrap/commit/739f86f)) -- **modal:** - - allow global override of modal options ([acaf72b](https://github.com/angular-ui/bootstrap/commit/acaf72b)) -- **buttons:** - - add checkbox and radio buttons ([571ccf4](https://github.com/angular-ui/bootstrap/commit/571ccf4)) -- **carousel:** - - add slide indicators ([3b677ee](https://github.com/angular-ui/bootstrap/commit/3b677ee)) -- **typeahead:** - - add typeahead directive ([6a97da2](https://github.com/angular-ui/bootstrap/commit/6a97da2)) -- **accordion:** - - enable HTML in accordion headings ([3afcaa4](https://github.com/angular-ui/bootstrap/commit/3afcaa4)) -- **pagination:** - - add first/last link & constant congif options ([0ff0454](https://github.com/angular-ui/bootstrap/commit/0ff0454)) - -## Bug fixes - -- **dialog:** - - update resolve section to new syntax ([1f87486](https://github.com/angular-ui/bootstrap/commit/1f87486)) - - $compile entire modal ([7575b3c](https://github.com/angular-ui/bootstrap/commit/7575b3c)) -- **tooltip:** - - don't show tooltips if there is no content to show ([030901e](https://github.com/angular-ui/bootstrap/commit/030901e)) - - fix placement issues ([a2bbf4d](https://github.com/angular-ui/bootstrap/commit/a2bbf4d)) -- **collapse:** - - Avoids fixed height on collapse ([ff5d119](https://github.com/angular-ui/bootstrap/commit/ff5d119)) -- **accordion:** - - fix minification issues ([f4da4d6](https://github.com/angular-ui/bootstrap/commit/f4da4d6)) -- **typeahead:** - - update inputs value on mapping where label is not derived from the model ([a5f64de](https://github.com/angular-ui/bootstrap/commit/a5f64de)) - -# 0.1.0 (2013-02-02) - -_Very first, initial release_. - -## Features - -Version `0.1.0` was released with the following directives: - -* accordion -* alert -* carousel -* dialog -* dropdownToggle -* modal -* pagination -* popover -* tabs -* tooltip +# 0.3.0 (2013-04-30) + +## Features + +- **progressbar:** + - add progressbar directive ([261f2072](https://github.com/angular-ui/bootstrap/commit/261f2072)) +- **rating:** + - add rating directive ([6b5e6369](https://github.com/angular-ui/bootstrap/commit/6b5e6369)) +- **typeahead:** + - support the editable property ([a40c3fbe](https://github.com/angular-ui/bootstrap/commit/a40c3fbe)) + - support typeahead-loading bindable expression ([b58c9c88](https://github.com/angular-ui/bootstrap/commit/b58c9c88)) +- **tooltip:** + - added popup-delay option ([a79a2ba8](https://github.com/angular-ui/bootstrap/commit/a79a2ba8)) + - added appendToBody to $tooltip ([1ee467f8](https://github.com/angular-ui/bootstrap/commit/1ee467f8)) + - added tooltip-html-unsafe directive ([45ed2805](https://github.com/angular-ui/bootstrap/commit/45ed2805)) + - support for custom triggers ([b1ba821b](https://github.com/angular-ui/bootstrap/commit/b1ba821b)) + +## Bug Fixes + +- **alert:** + - don't show close button if no close callback specified ([c2645f4a](https://github.com/angular-ui/bootstrap/commit/c2645f4a)) +- **carousel:** + - Hide navigation indicators if only one slide ([aedc0565](https://github.com/angular-ui/bootstrap/commit/aedc0565)) +- **collapse:** + - remove reference to msTransition for IE10 ([55437b16](https://github.com/angular-ui/bootstrap/commit/55437b16)) +- **dialog:** + - set _open to false on init ([dcc9ef31](https://github.com/angular-ui/bootstrap/commit/dcc9ef31)) + - close dialog on location change ([474ce52e](https://github.com/angular-ui/bootstrap/commit/474ce52e)) + - IE8 fix to not set data() against text nodes ([a6c540e5](https://github.com/angular-ui/bootstrap/commit/a6c540e5)) + - fix $apply in progres on $location change ([77e6acb9](https://github.com/angular-ui/bootstrap/commit/77e6acb9)) +- **tabs:** + - remove superfluous href from tabs template ([38c1badd](https://github.com/angular-ui/bootstrap/commit/38c1badd)) +- **tooltip:** + - fix positioning issues in tooltips and popovers ([6458f487](https://github.com/angular-ui/bootstrap/commit/6458f487)) +- **typeahead:** + - close matches popup on click outside typeahead ([acca7dcd](https://github.com/angular-ui/bootstrap/commit/acca7dcd)) + - stop keydown event propagation when ESC pressed to discard matches ([22a00cd0](https://github.com/angular-ui/bootstrap/commit/22a00cd0)) + - correctly render initial model value ([929a46fa](https://github.com/angular-ui/bootstrap/commit/929a46fa)) + - correctly higlight matches if query contains regexp-special chars ([467afcd6](https://github.com/angular-ui/bootstrap/commit/467afcd6)) + - fix matches pop-up positioning issues ([74beecdb](https://github.com/angular-ui/bootstrap/commit/74beecdb)) + +# 0.2.0 (2013-03-03) + +## Features + +- **dialog:** + - Make $dialog 'resolve' property to work the same way of $routeProvider.when ([739f86f](https://github.com/angular-ui/bootstrap/commit/739f86f)) +- **modal:** + - allow global override of modal options ([acaf72b](https://github.com/angular-ui/bootstrap/commit/acaf72b)) +- **buttons:** + - add checkbox and radio buttons ([571ccf4](https://github.com/angular-ui/bootstrap/commit/571ccf4)) +- **carousel:** + - add slide indicators ([3b677ee](https://github.com/angular-ui/bootstrap/commit/3b677ee)) +- **typeahead:** + - add typeahead directive ([6a97da2](https://github.com/angular-ui/bootstrap/commit/6a97da2)) +- **accordion:** + - enable HTML in accordion headings ([3afcaa4](https://github.com/angular-ui/bootstrap/commit/3afcaa4)) +- **pagination:** + - add first/last link & constant congif options ([0ff0454](https://github.com/angular-ui/bootstrap/commit/0ff0454)) + +## Bug fixes + +- **dialog:** + - update resolve section to new syntax ([1f87486](https://github.com/angular-ui/bootstrap/commit/1f87486)) + - $compile entire modal ([7575b3c](https://github.com/angular-ui/bootstrap/commit/7575b3c)) +- **tooltip:** + - don't show tooltips if there is no content to show ([030901e](https://github.com/angular-ui/bootstrap/commit/030901e)) + - fix placement issues ([a2bbf4d](https://github.com/angular-ui/bootstrap/commit/a2bbf4d)) +- **collapse:** + - Avoids fixed height on collapse ([ff5d119](https://github.com/angular-ui/bootstrap/commit/ff5d119)) +- **accordion:** + - fix minification issues ([f4da4d6](https://github.com/angular-ui/bootstrap/commit/f4da4d6)) +- **typeahead:** + - update inputs value on mapping where label is not derived from the model ([a5f64de](https://github.com/angular-ui/bootstrap/commit/a5f64de)) + +# 0.1.0 (2013-02-02) + +_Very first, initial release_. + +## Features + +Version `0.1.0` was released with the following directives: + +* accordion +* alert +* carousel +* dialog +* dropdownToggle +* modal +* pagination +* popover +* tabs +* tooltip diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bab1ffded6..68367292ab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,12 +1,12 @@ -We are always looking for the quality contributions and will be happy to accept your Pull Requests as long as those adhere to some basic rules: - -* Please make sure that your contribution fits well in the project's context: - * we are aiming at rebuilding boostrap directives in pure AngularJS, without any dependencies on any external JavaScript library; - * the only dependency should be boostrap CSS and its markup structure; - * directives should be html-agnostic as much as possible which in practice means: - * templates should be referred to using the `templateUrl` property - * it should be easy to change a default template to a custom one - * directives shouldn't manipulate DOM structure directly (when possible) -* Please assure that you are submitting quality code, specifically make sure that: - * your directive has accompanying tests and all the tests are passing; don't hesitate to contact us (angular-ui@googlegroups.com) if you ned any help with unit testing - * your PR doesn't break the build; check the Travis-CI build status after opening a PR and push corrective commits if anything goes wrong +We are always looking for the quality contributions and will be happy to accept your Pull Requests as long as those adhere to some basic rules: + +* Please make sure that your contribution fits well in the project's context: + * we are aiming at rebuilding boostrap directives in pure AngularJS, without any dependencies on any external JavaScript library; + * the only dependency should be boostrap CSS and its markup structure; + * directives should be html-agnostic as much as possible which in practice means: + * templates should be referred to using the `templateUrl` property + * it should be easy to change a default template to a custom one + * directives shouldn't manipulate DOM structure directly (when possible) +* Please assure that you are submitting quality code, specifically make sure that: + * your directive has accompanying tests and all the tests are passing; don't hesitate to contact us (angular-ui@googlegroups.com) if you ned any help with unit testing + * your PR doesn't break the build; check the Travis-CI build status after opening a PR and push corrective commits if anything goes wrong diff --git a/Gruntfile.js b/Gruntfile.js index fd0386ec30..4317b037e8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -11,6 +11,8 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-karma'); // Project configuration. + grunt.util.linefeed = '\n'; + grunt.initConfig({ ngversion: '1.0.5', bsversion: '2.3.1', diff --git a/misc/changelog.tpl.md b/misc/changelog.tpl.md index 21eec97e84..f311f47c54 100644 --- a/misc/changelog.tpl.md +++ b/misc/changelog.tpl.md @@ -1,28 +1,28 @@ -# <%= version%> (<%= today%>) - -## Features - -<% _(changelog.feat).forEach(function(changes, component) { %> -- **<%= component%>:** - <% changes.forEach(function(change) { %> - - <%= change.msg%> ([<%= change.sha1%>](https://github.com/angular-ui/bootstrap/commit/<%= change.sha1%>)) - <% }) %> -<% }) %> - -## Bug Fixes - -<% _(changelog.fix).forEach(function(changes, component) { %> -- **<%= component%>:** - <% changes.forEach(function(change) { %> - - <%= change.msg%> ([<%= change.sha1%>](https://github.com/angular-ui/bootstrap/commit/<%= change.sha1%>)) - <% }) %> -<% }) %> - -## Breaking Changes - -<% _(changelog.breaking).forEach(function(changes, component) { %> -- **<%= component%>:** - <% changes.forEach(function(change) { %> - <%= change.msg%> - <% }) %> -<% }) %> +# <%= version%> (<%= today%>) + +## Features + +<% _(changelog.feat).forEach(function(changes, component) { %> +- **<%= component%>:** + <% changes.forEach(function(change) { %> + - <%= change.msg%> ([<%= change.sha1%>](https://github.com/angular-ui/bootstrap/commit/<%= change.sha1%>)) + <% }) %> +<% }) %> + +## Bug Fixes + +<% _(changelog.fix).forEach(function(changes, component) { %> +- **<%= component%>:** + <% changes.forEach(function(change) { %> + - <%= change.msg%> ([<%= change.sha1%>](https://github.com/angular-ui/bootstrap/commit/<%= change.sha1%>)) + <% }) %> +<% }) %> + +## Breaking Changes + +<% _(changelog.breaking).forEach(function(changes, component) { %> +- **<%= component%>:** + <% changes.forEach(function(change) { %> + <%= change.msg%> + <% }) %> +<% }) %> diff --git a/misc/demo/assets/demo.css b/misc/demo/assets/demo.css index 2f77fbe6fe..7c58d86d10 100644 --- a/misc/demo/assets/demo.css +++ b/misc/demo/assets/demo.css @@ -1,92 +1,92 @@ -body { - opacity: 1; - -webkit-transition: opacity 1s ease; - -moz-transition: opacity 1s ease; - transition: opacity 1s; -} - -.ng-cloak { - opacity: 0; -} - -section { - padding-top: 30px; -} - -.page-header h1 > small > a { - color: #999; -} -.page-header h1 > small > a:hover { - text-decoration: none; -} - -.footer { - text-align: center; - padding: 30px 0; - margin-top: 70px; - border-top: 1px solid #e5e5e5; - background-color: #f5f5f5; -} - -.hero-unit { - position: relative; - padding: 40px 0; - color: #fff; - text-align: center; - text-shadow: 0 1px 3px rgba(0,0,0,.4), 0 0 30px rgba(0,0,0,.075); - background: #020031; - background: -moz-linear-gradient(45deg, #020031 0%, #6d3353 100%); - background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#020031), color-stop(100%,#6d3353)); - background: -webkit-linear-gradient(45deg, #020031 0%,#6d3353 100%); - background: -o-linear-gradient(45deg, #020031 0%,#6d3353 100%); - background: -ms-linear-gradient(45deg, #020031 0%,#6d3353 100%); - background: linear-gradient(45deg, #020031 0%,#6d3353 100%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#020031', endColorstr='#6d3353',GradientType=1 ); - -webkit-box-shadow: inset 0 3px 7px rgba(0,0,0,.2), inset 0 -3px 7px rgba(0,0,0,.2); - -moz-box-shadow: inset 0 3px 7px rgba(0,0,0,.2), inset 0 -3px 7px rgba(0,0,0,.2); - box-shadow: inset 0 3px 7px rgba(0,0,0,.2), inset 0 -3px 7px rgba(0,0,0,.2); - border-radius: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - -o-border-radius: 0; -} -.hero-unit .btn, .pagination-centered .btn { - float: none; - font-weight: normal; -} -.hero-unit p { - margin: 1em 0; -} -.bs-docs-social { - margin-top: 1em; - padding: 15px 0; - text-align: center; - background-color: rgba(245,245,245,0.3); - border-top: 1px solid rgba(255,255,255,0.3); - border-bottom: 1px solid rgba(221,221,221,0.3); -} -.bs-docs-social-buttons { - margin-left: 0; - margin-bottom: 0; - padding-left: 0; - list-style: none; -} -.bs-docs-social-buttons li { - display: inline-block; - padding: 5px 8px; - line-height: 1; -} - -.icon-github { - background: no-repeat url('github-16px.png'); - width: 16px; - height: 16px; -} - -/* Not enough room on mobile for markup tab, js tab, and plunk btn. - And no one cares about plunk button on a phone anyway */ -@media only screen and (max-device-width: 480px) { - #plunk-btn { - display: none; - } +body { + opacity: 1; + -webkit-transition: opacity 1s ease; + -moz-transition: opacity 1s ease; + transition: opacity 1s; +} + +.ng-cloak { + opacity: 0; +} + +section { + padding-top: 30px; +} + +.page-header h1 > small > a { + color: #999; +} +.page-header h1 > small > a:hover { + text-decoration: none; +} + +.footer { + text-align: center; + padding: 30px 0; + margin-top: 70px; + border-top: 1px solid #e5e5e5; + background-color: #f5f5f5; +} + +.hero-unit { + position: relative; + padding: 40px 0; + color: #fff; + text-align: center; + text-shadow: 0 1px 3px rgba(0,0,0,.4), 0 0 30px rgba(0,0,0,.075); + background: #020031; + background: -moz-linear-gradient(45deg, #020031 0%, #6d3353 100%); + background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#020031), color-stop(100%,#6d3353)); + background: -webkit-linear-gradient(45deg, #020031 0%,#6d3353 100%); + background: -o-linear-gradient(45deg, #020031 0%,#6d3353 100%); + background: -ms-linear-gradient(45deg, #020031 0%,#6d3353 100%); + background: linear-gradient(45deg, #020031 0%,#6d3353 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#020031', endColorstr='#6d3353',GradientType=1 ); + -webkit-box-shadow: inset 0 3px 7px rgba(0,0,0,.2), inset 0 -3px 7px rgba(0,0,0,.2); + -moz-box-shadow: inset 0 3px 7px rgba(0,0,0,.2), inset 0 -3px 7px rgba(0,0,0,.2); + box-shadow: inset 0 3px 7px rgba(0,0,0,.2), inset 0 -3px 7px rgba(0,0,0,.2); + border-radius: 0; + -moz-border-radius: 0; + -webkit-border-radius: 0; + -o-border-radius: 0; +} +.hero-unit .btn, .pagination-centered .btn { + float: none; + font-weight: normal; +} +.hero-unit p { + margin: 1em 0; +} +.bs-docs-social { + margin-top: 1em; + padding: 15px 0; + text-align: center; + background-color: rgba(245,245,245,0.3); + border-top: 1px solid rgba(255,255,255,0.3); + border-bottom: 1px solid rgba(221,221,221,0.3); +} +.bs-docs-social-buttons { + margin-left: 0; + margin-bottom: 0; + padding-left: 0; + list-style: none; +} +.bs-docs-social-buttons li { + display: inline-block; + padding: 5px 8px; + line-height: 1; +} + +.icon-github { + background: no-repeat url('github-16px.png'); + width: 16px; + height: 16px; +} + +/* Not enough room on mobile for markup tab, js tab, and plunk btn. + And no one cares about plunk button on a phone anyway */ +@media only screen and (max-device-width: 480px) { + #plunk-btn { + display: none; + } } \ No newline at end of file diff --git a/misc/demo/assets/plunker.js b/misc/demo/assets/plunker.js index 32f1cff222..ffd809ebec 100644 --- a/misc/demo/assets/plunker.js +++ b/misc/demo/assets/plunker.js @@ -1,58 +1,58 @@ -angular.module('plunker', []) - - .factory('plunkGenerator', function ($document) { - - return function (ngVersion, bsVersion, version, module, content) { - - var form = angular.element('
'); - var addField = function (name, value) { - var input = angular.element(''); - input.attr('value', value); - form.append(input); - }; - - var indexContent = function (content, version) { - return '\n' + - '\n' + - ' \n' + - ' \n' + - ' \n' + - ' \n' + - ' \n' + - ' \n' + - ' \n\n' + - content + '\n' + - ' \n' + - '\n'; - }; - - var scriptContent = function(content) { - return "angular.module('plunker', ['ui.bootstrap']);" + "\n" + content; - }; - - addField('description', 'http://angular-ui.github.io/bootstrap/'); - addField('files[index.html]', indexContent(content.markup, version)); - addField('files[example.js]', scriptContent(content.javascript)); - - $document.find('body').append(form); - form[0].submit(); - form.remove(); - }; - }) - - .controller('PlunkerCtrl', function ($scope, plunkGenerator) { - - $scope.content = {}; - - $scope.edit = function (ngVersion, bsVersion, version, module) { - plunkGenerator(ngVersion, bsVersion, version, module, $scope.content); - }; - }) - - .directive('plunkerContent', function () { - return { - link:function (scope, element, attrs) { - scope.$parent.content[attrs.plunkerContent] = element.text(); - } - } - }); +angular.module('plunker', []) + + .factory('plunkGenerator', function ($document) { + + return function (ngVersion, bsVersion, version, module, content) { + + var form = angular.element(''); + var addField = function (name, value) { + var input = angular.element(''); + input.attr('value', value); + form.append(input); + }; + + var indexContent = function (content, version) { + return '\n' + + '\n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n\n' + + content + '\n' + + ' \n' + + '\n'; + }; + + var scriptContent = function(content) { + return "angular.module('plunker', ['ui.bootstrap']);" + "\n" + content; + }; + + addField('description', 'http://angular-ui.github.io/bootstrap/'); + addField('files[index.html]', indexContent(content.markup, version)); + addField('files[example.js]', scriptContent(content.javascript)); + + $document.find('body').append(form); + form[0].submit(); + form.remove(); + }; + }) + + .controller('PlunkerCtrl', function ($scope, plunkGenerator) { + + $scope.content = {}; + + $scope.edit = function (ngVersion, bsVersion, version, module) { + plunkGenerator(ngVersion, bsVersion, version, module, $scope.content); + }; + }) + + .directive('plunkerContent', function () { + return { + link:function (scope, element, attrs) { + scope.$parent.content[attrs.plunkerContent] = element.text(); + } + } + }); diff --git a/src/accordion/accordion.js b/src/accordion/accordion.js index 54f33452c8..9179e6e81d 100644 --- a/src/accordion/accordion.js +++ b/src/accordion/accordion.js @@ -1,141 +1,141 @@ -angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse']) - -.constant('accordionConfig', { - closeOthers: true -}) - -.controller('AccordionController', ['$scope', '$attrs', 'accordionConfig', function ($scope, $attrs, accordionConfig) { - - // This array keeps track of the accordion groups - this.groups = []; - - // Ensure that all the groups in this accordion are closed, unless close-others explicitly says not to - this.closeOthers = function(openGroup) { - var closeOthers = angular.isDefined($attrs.closeOthers) ? $scope.$eval($attrs.closeOthers) : accordionConfig.closeOthers; - if ( closeOthers ) { - angular.forEach(this.groups, function (group) { - if ( group !== openGroup ) { - group.isOpen = false; - } - }); - } - }; - - // This is called from the accordion-group directive to add itself to the accordion - this.addGroup = function(groupScope) { - var that = this; - this.groups.push(groupScope); - - groupScope.$on('$destroy', function (event) { - that.removeGroup(groupScope); - }); - }; - - // This is called from the accordion-group directive when to remove itself - this.removeGroup = function(group) { - var index = this.groups.indexOf(group); - if ( index !== -1 ) { - this.groups.splice(this.groups.indexOf(group), 1); - } - }; - -}]) - -// The accordion directive simply sets up the directive controller -// and adds an accordion CSS class to itself element. -.directive('accordion', function () { - return { - restrict:'EA', - controller:'AccordionController', - transclude: true, - replace: false, - templateUrl: 'template/accordion/accordion.html' - }; -}) - -// The accordion-group directive indicates a block of html that will expand and collapse in an accordion -.directive('accordionGroup', ['$parse', '$transition', '$timeout', function($parse, $transition, $timeout) { - return { - require:'^accordion', // We need this directive to be inside an accordion - restrict:'EA', - transclude:true, // It transcludes the contents of the directive into the template - replace: true, // The element containing the directive will be replaced with the template - templateUrl:'template/accordion/accordion-group.html', - scope:{ heading:'@' }, // Create an isolated scope and interpolate the heading attribute onto this scope - controller: ['$scope', function($scope) { - this.setHeading = function(element) { - this.heading = element; - }; - }], - link: function(scope, element, attrs, accordionCtrl) { - var getIsOpen, setIsOpen; - - accordionCtrl.addGroup(scope); - - scope.isOpen = false; - - if ( attrs.isOpen ) { - getIsOpen = $parse(attrs.isOpen); - setIsOpen = getIsOpen.assign; - - scope.$watch( - function watchIsOpen() { return getIsOpen(scope.$parent); }, - function updateOpen(value) { scope.isOpen = value; } - ); - - scope.isOpen = getIsOpen ? getIsOpen(scope.$parent) : false; - } - - scope.$watch('isOpen', function(value) { - if ( value ) { - accordionCtrl.closeOthers(scope); - } - if ( setIsOpen ) { - setIsOpen(scope.$parent, value); - } - }); - } - }; -}]) - -// Use accordion-heading below an accordion-group to provide a heading containing HTML -//{{singleModel}}- -
{{checkModel}}-
{{radioModel}}-
{{singleModel}}+ +
{{checkModel}}+
{{radioModel}}+
Some other content | -
- Content
- |
-
Some other content | -
- Content
- |
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur non velit nulla. Suspendisse sit amet tempus diam. Sed at ultricies neque. Suspendisse id felis a sem placerat ornare. Donec auctor, purus at molestie tempor, arcu enim molestie lacus, ac imperdiet massa urna eu massa. Praesent velit tellus, scelerisque a fermentum ut, ornare in diam. Phasellus egestas molestie feugiat. Vivamus sit amet viverra metus.
-Etiam ultricies odio commodo erat ullamcorper sodales. Nullam ac dui ac libero dictum mollis. Quisque convallis adipiscing facilisis. In nec nisi velit, id auctor lectus. Cras interdum urna non felis lacinia vulputate. Integer dignissim, mi aliquam gravida auctor, massa odio cursus lorem, eu ultrices eros nisl tempus diam. Maecenas tristique pellentesque nisi sed adipiscing. Aenean hendrerit sapien quis arcu lobortis vitae pulvinar ante volutpat. Morbi consectetur erat eu lacus facilisis eu ullamcorper orci euismod. Quisque diam dui, interdum in suscipit et, fringilla non justo. Pellentesque non nibh odio. Proin sit amet massa sem.
-Nam in urna erat, at congue nisi. Donec eu tellus lorem, sed facilisis tellus. Aliquam suscipit faucibus ipsum, at hendrerit metus interdum at. Integer et eros ac lacus vulputate sagittis quis quis erat. Suspendisse consectetur vehicula purus vitae imperdiet. Suspendisse in augue magna, quis imperdiet enim. Nullam non diam ac erat auctor bibendum. Praesent ante mauris, egestas sit amet molestie sed, tristique at lorem. Nam at mi ac nisl venenatis semper nec eget mi. Pellentesque a lectus ac leo feugiat suscipit. Quisque tristique dui nec urna placerat a viverra mi iaculis. Ut et tellus et turpis sagittis iaculis nec eu magna. Sed quis nunc non arcu tincidunt ultricies viverra id mauris.
-Curabitur luctus rutrum ultricies. Aenean ut rutrum orci. Sed molestie lorem in leo cursus id feugiat nisi scelerisque. Maecenas pulvinar neque nec lacus feugiat dictum. Donec viverra felis nec nisi mollis feugiat. Phasellus vehicula, ligula at mattis porttitor, sapien urna hendrerit quam, at fringilla nisl quam vel elit. In eu lacus ligula. Praesent eget gravida nisl. Suspendisse velit diam, pellentesque a tempus quis, vestibulum vel leo.
-Maecenas feugiat ultrices laoreet. Sed congue posuere diam ac faucibus. Pellentesque eget leo ligula. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed nec quam eu tellus sagittis cursus a sit amet eros. Mauris sit amet orci at orci vulputate commodo ut ut nunc. Etiam sagittis erat ut nisi ultricies feugiat. Morbi sed eros nisi. Cras vitae augue in risus aliquet commodo non id est.
-Maecenas laoreet nisi pretium elit bibendum eget tempor nunc aliquet. Vivamus interdum nisi sit amet tortor fermentum congue. Suspendisse at posuere erat. Aliquam hendrerit ultricies nunc non adipiscing. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis molestie viverra nulla a aliquet. Nullam non eros vel sem vehicula suscipit. Ut sit amet arcu ac tortor dignissim viverra in a ligula.
- -Some other content | +
+ Content
+ |
+
Some other content | +
+ Content
+ |
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur non velit nulla. Suspendisse sit amet tempus diam. Sed at ultricies neque. Suspendisse id felis a sem placerat ornare. Donec auctor, purus at molestie tempor, arcu enim molestie lacus, ac imperdiet massa urna eu massa. Praesent velit tellus, scelerisque a fermentum ut, ornare in diam. Phasellus egestas molestie feugiat. Vivamus sit amet viverra metus.
+Etiam ultricies odio commodo erat ullamcorper sodales. Nullam ac dui ac libero dictum mollis. Quisque convallis adipiscing facilisis. In nec nisi velit, id auctor lectus. Cras interdum urna non felis lacinia vulputate. Integer dignissim, mi aliquam gravida auctor, massa odio cursus lorem, eu ultrices eros nisl tempus diam. Maecenas tristique pellentesque nisi sed adipiscing. Aenean hendrerit sapien quis arcu lobortis vitae pulvinar ante volutpat. Morbi consectetur erat eu lacus facilisis eu ullamcorper orci euismod. Quisque diam dui, interdum in suscipit et, fringilla non justo. Pellentesque non nibh odio. Proin sit amet massa sem.
+Nam in urna erat, at congue nisi. Donec eu tellus lorem, sed facilisis tellus. Aliquam suscipit faucibus ipsum, at hendrerit metus interdum at. Integer et eros ac lacus vulputate sagittis quis quis erat. Suspendisse consectetur vehicula purus vitae imperdiet. Suspendisse in augue magna, quis imperdiet enim. Nullam non diam ac erat auctor bibendum. Praesent ante mauris, egestas sit amet molestie sed, tristique at lorem. Nam at mi ac nisl venenatis semper nec eget mi. Pellentesque a lectus ac leo feugiat suscipit. Quisque tristique dui nec urna placerat a viverra mi iaculis. Ut et tellus et turpis sagittis iaculis nec eu magna. Sed quis nunc non arcu tincidunt ultricies viverra id mauris.
+Curabitur luctus rutrum ultricies. Aenean ut rutrum orci. Sed molestie lorem in leo cursus id feugiat nisi scelerisque. Maecenas pulvinar neque nec lacus feugiat dictum. Donec viverra felis nec nisi mollis feugiat. Phasellus vehicula, ligula at mattis porttitor, sapien urna hendrerit quam, at fringilla nisl quam vel elit. In eu lacus ligula. Praesent eget gravida nisl. Suspendisse velit diam, pellentesque a tempus quis, vestibulum vel leo.
+Maecenas feugiat ultrices laoreet. Sed congue posuere diam ac faucibus. Pellentesque eget leo ligula. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed nec quam eu tellus sagittis cursus a sit amet eros. Mauris sit amet orci at orci vulputate commodo ut ut nunc. Etiam sagittis erat ut nisi ultricies feugiat. Morbi sed eros nisi. Cras vitae augue in risus aliquet commodo non id est.
+Maecenas laoreet nisi pretium elit bibendum eget tempor nunc aliquet. Vivamus interdum nisi sit amet tortor fermentum congue. Suspendisse at posuere erat. Aliquam hendrerit ultricies nunc non adipiscing. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis molestie viverra nulla a aliquet. Nullam non eros vel sem vehicula suscipit. Ut sit amet arcu ac tortor dignissim viverra in a ligula.
+ +Model: {{selected| json}}- +
Model: {{selected| json}}+