Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 342c576

Browse files
committed
feat: prefix virtual templates with uib/
- Change all virtual paths with built in templates to be prefixed by `uib/` BREAKING CHANGE: All virtual templates in UI Bootstrap now are prefixed with `uib/` - if one is overriding the templates via `$templateCache` path or manually building the templates from the UI Bootstrap repository, one needs to change the string used in the `$templateCache` representation to have the new prefix Closes #1205 Closes #4839
1 parent fe69386 commit 342c576

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+100
-93
lines changed

Gruntfile.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ module.exports = function(grunt) {
112112
dist: {
113113
options: {
114114
module: null, // no bundle module for all the html2js templates
115-
base: '.'
115+
base: '.',
116+
rename: function(moduleName) {
117+
return 'uib/' + moduleName;
118+
}
116119
},
117120
files: [{
118121
expand: true,

src/accordion/accordion.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
4848
controllerAs: 'accordion',
4949
transclude: true,
5050
templateUrl: function(element, attrs) {
51-
return attrs.templateUrl || 'template/accordion/accordion.html';
51+
return attrs.templateUrl || 'uib/template/accordion/accordion.html';
5252
}
5353
};
5454
})
@@ -60,7 +60,7 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
6060
transclude: true, // It transcludes the contents of the directive into the template
6161
replace: true, // The element containing the directive will be replaced with the template
6262
templateUrl: function(element, attrs) {
63-
return attrs.templateUrl || 'template/accordion/accordion-group.html';
63+
return attrs.templateUrl || 'uib/template/accordion/accordion-group.html';
6464
},
6565
scope: {
6666
heading: '@', // Interpolate the heading attribute onto this scope

src/accordion/docs/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The body of each accordion group is transcluded into the body of the collapsible
3333
Add ability to use Bootstrap's contextual panel classes (panel-primary, panel-success, panel-info, etc...) or your own. This must be a string.
3434

3535
* `template-url`
36-
_(Default: `template/accordion/accordion-group.html`)_ -
36+
_(Default: `uib/template/accordion/accordion-group.html`)_ -
3737
Add the ability to override the template used on the component.
3838

3939
### Default settings `uibAccordionConfig`

src/accordion/test/accordion.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ describe('uib-accordion', function() {
33

44
beforeEach(module('ui.bootstrap.accordion'));
55
beforeEach(module('ngAnimateMock'));
6-
beforeEach(module('template/accordion/accordion.html'));
7-
beforeEach(module('template/accordion/accordion-group.html'));
6+
beforeEach(module('uib/template/accordion/accordion.html'));
7+
beforeEach(module('uib/template/accordion/accordion-group.html'));
88

99
beforeEach(inject(function(_$animate_, $rootScope) {
1010
$animate = _$animate_;
@@ -124,7 +124,7 @@ describe('uib-accordion', function() {
124124
}));
125125

126126
it('should expose the controller on the view', function() {
127-
$templateCache.put('template/accordion/accordion.html', '<div>{{accordion.text}}</div>');
127+
$templateCache.put('uib/template/accordion/accordion.html', '<div>{{accordion.text}}</div>');
128128

129129
element = $compile('<uib-accordion></uib-accordion>')(scope);
130130
scope.$digest();

src/alert/alert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ angular.module('ui.bootstrap.alert', [])
1818
controller: 'UibAlertController',
1919
controllerAs: 'alert',
2020
templateUrl: function(element, attrs) {
21-
return attrs.templateUrl || 'template/alert/alert.html';
21+
return attrs.templateUrl || 'uib/template/alert/alert.html';
2222
},
2323
transclude: true,
2424
replace: true,

src/alert/docs/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This directive can be used both to generate alerts from static and dynamic model
66
A callback function that gets fired when an `alert` is closed. If the attribute exists, a close button is displayed as well.
77
* `dismiss-on-timeout` _(Default: `none`)(Optional)_ -
88
Takes the number of milliseconds that specify the timeout duration, after which the alert will be closed. This attribute requires the presence of the `close` attribute.
9-
* `template-url` _(Default: `template/alert/alert.html`)_ -
9+
* `template-url` _(Default: `uib/template/alert/alert.html`)_ -
1010
Add the ability to override the template used in the component.
1111
* `type` _(Default: `warning`)_ -
1212
Defines the type of the alert. Go to [bootstrap page](http://getbootstrap.com/components/#alerts) to see the type of alerts available.

src/alert/test/alert.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ describe('uib-alert', function() {
22
var element, scope, $compile, $templateCache, $timeout;
33

44
beforeEach(module('ui.bootstrap.alert'));
5-
beforeEach(module('template/alert/alert.html'));
5+
beforeEach(module('uib/template/alert/alert.html'));
66

77
beforeEach(inject(function($rootScope, _$compile_, _$templateCache_, _$timeout_) {
88
scope = $rootScope;
@@ -39,7 +39,7 @@ describe('uib-alert', function() {
3939
}
4040

4141
it('should expose the controller to the view', function() {
42-
$templateCache.put('template/alert/alert.html', '<div>{{alert.text}}</div>');
42+
$templateCache.put('uib/template/alert/alert.html', '<div>{{alert.text}}</div>');
4343

4444
element = $compile('<uib-alert></uib-alert>')(scope);
4545
scope.$digest();

src/carousel/carousel.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ angular.module('ui.bootstrap.carousel', [])
202202
controller: 'UibCarouselController',
203203
controllerAs: 'carousel',
204204
templateUrl: function(element, attrs) {
205-
return attrs.templateUrl || 'template/carousel/carousel.html';
205+
return attrs.templateUrl || 'uib/template/carousel/carousel.html';
206206
},
207207
scope: {
208208
interval: '=',
@@ -219,7 +219,7 @@ angular.module('ui.bootstrap.carousel', [])
219219
transclude: true,
220220
replace: true,
221221
templateUrl: function(element, attrs) {
222-
return attrs.templateUrl || 'template/carousel/slide.html';
222+
return attrs.templateUrl || 'uib/template/carousel/slide.html';
223223
},
224224
scope: {
225225
active: '=?',

src/carousel/docs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Use a `<uib-carousel>` element with `<uib-slide>` elements inside it.
2323
Whether to disable the transition animation between slides. Setting this to truthy, disables this transition.
2424

2525
* `template-url`
26-
_(Default: `template/carousel/carousel.html`)_ -
26+
_(Default: `uib/template/carousel/carousel.html`)_ -
2727
Add the ability to override the template used on the component.
2828

2929
### uib-slide settings
@@ -41,5 +41,5 @@ Use a `<uib-carousel>` element with `<uib-slide>` elements inside it.
4141
Use this attribute to change how the slides are ordered.
4242

4343
* `template-url`
44-
_(Default: `template/carousel/slide.html`)_ -
44+
_(Default: `uib/template/carousel/slide.html`)_ -
4545
Add the ability to override the template used on the component.

src/carousel/test/carousel.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('carousel', function() {
1212
});
1313
}
1414
}));
15-
beforeEach(module('template/carousel/carousel.html', 'template/carousel/slide.html'));
15+
beforeEach(module('uib/template/carousel/carousel.html', 'uib/template/carousel/slide.html'));
1616

1717
var $rootScope, $compile, $controller, $interval, $templateCache;
1818
beforeEach(inject(function(_$rootScope_, _$compile_, _$controller_, _$interval_, _$templateCache_) {
@@ -495,7 +495,7 @@ describe('carousel', function() {
495495
});
496496

497497
it('should be exposed in the template', inject(function($templateCache) {
498-
$templateCache.put('template/carousel/carousel.html', '<div>{{carousel.text}}</div>');
498+
$templateCache.put('uib/template/carousel/carousel.html', '<div>{{carousel.text}}</div>');
499499

500500
var scope = $rootScope.$new();
501501
var elm = $compile('<uib-carousel interval="bar" no-transition="false" no-pause="true"></uib-carousel>')(scope);

src/datepicker/datepicker.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
443443
return {
444444
replace: true,
445445
templateUrl: function(element, attrs) {
446-
return attrs.templateUrl || 'template/datepicker/datepicker.html';
446+
return attrs.templateUrl || 'uib/template/datepicker/datepicker.html';
447447
},
448448
scope: {
449449
datepickerMode: '=?',
@@ -466,7 +466,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
466466
return {
467467
replace: true,
468468
templateUrl: function(element, attrs) {
469-
return attrs.templateUrl || 'template/datepicker/day.html';
469+
return attrs.templateUrl || 'uib/template/datepicker/day.html';
470470
},
471471
require: ['^?uibDatepicker', 'uibDaypicker', '^?datepicker'],
472472
controller: 'UibDaypickerController',
@@ -483,7 +483,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
483483
return {
484484
replace: true,
485485
templateUrl: function(element, attrs) {
486-
return attrs.templateUrl || 'template/datepicker/month.html';
486+
return attrs.templateUrl || 'uib/template/datepicker/month.html';
487487
},
488488
require: ['^?uibDatepicker', 'uibMonthpicker', '^?datepicker'],
489489
controller: 'UibMonthpickerController',
@@ -500,7 +500,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
500500
return {
501501
replace: true,
502502
templateUrl: function(element, attrs) {
503-
return attrs.templateUrl || 'template/datepicker/year.html';
503+
return attrs.templateUrl || 'uib/template/datepicker/year.html';
504504
},
505505
require: ['^?uibDatepicker', 'uibYearpicker', '^?datepicker'],
506506
controller: 'UibYearpickerController',
@@ -516,8 +516,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
516516

517517
.constant('uibDatepickerPopupConfig', {
518518
datepickerPopup: 'yyyy-MM-dd',
519-
datepickerPopupTemplateUrl: 'template/datepicker/popup.html',
520-
datepickerTemplateUrl: 'template/datepicker/datepicker.html',
519+
datepickerPopupTemplateUrl: 'uib/template/datepicker/popup.html',
520+
datepickerTemplateUrl: 'uib/template/datepicker/datepicker.html',
521521
html5Types: {
522522
date: 'yyyy-MM-dd',
523523
'datetime-local': 'yyyy-MM-ddTHH:mm:ss.sss',
@@ -888,7 +888,7 @@ function(scope, element, attrs, $compile, $parse, $document, $rootScope, $positi
888888
replace: true,
889889
transclude: true,
890890
templateUrl: function(element, attrs) {
891-
return attrs.templateUrl || 'template/datepicker/popup.html';
891+
return attrs.templateUrl || 'uib/template/datepicker/popup.html';
892892
}
893893
};
894894
});

src/datepicker/docs/readme.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ All settings can be provided as attributes in the `uib-datepicker` or globally c
8686
An option to disable or enable shortcut's event propagation.
8787

8888
* `template-url`
89-
_(Default: 'template/datepicker/datepicker.html')_ :
89+
_(Default: 'uib/template/datepicker/datepicker.html')_ :
9090
Allows overriding of default template of the datepicker
9191

9292

@@ -120,11 +120,11 @@ Specific settings for the `uib-datepicker-popup`, that can globally configured t
120120
Whether to close calendar when a date is chosen.
121121

122122
* `datepicker-popup-template-url`
123-
_(Default: 'template/datepicker/popup.html')_ :
123+
_(Default: 'uib/template/datepicker/popup.html')_ :
124124
Allows overriding of default template of the popup
125125

126126
* `datepicker-template-url`
127-
_(Default: 'template/datepicker/datepicker.html')_ :
127+
_(Default: 'uib/template/datepicker/datepicker.html')_ :
128128
Allows overriding of default template of the datepicker used in popup
129129

130130
* `datepicker-append-to-body`

src/datepicker/test/datepicker.spec.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
describe('datepicker directive', function() {
22
var $rootScope, $compile, $templateCache, element;
33
beforeEach(module('ui.bootstrap.datepicker'));
4-
beforeEach(module('template/datepicker/datepicker.html'));
5-
beforeEach(module('template/datepicker/day.html'));
6-
beforeEach(module('template/datepicker/month.html'));
7-
beforeEach(module('template/datepicker/year.html'));
8-
beforeEach(module('template/datepicker/popup.html'));
4+
beforeEach(module('uib/template/datepicker/datepicker.html'));
5+
beforeEach(module('uib/template/datepicker/day.html'));
6+
beforeEach(module('uib/template/datepicker/month.html'));
7+
beforeEach(module('uib/template/datepicker/year.html'));
8+
beforeEach(module('uib/template/datepicker/popup.html'));
99
beforeEach(module(function($compileProvider) {
1010
$compileProvider.directive('dateModel', function() {
1111
return {
@@ -382,7 +382,7 @@ describe('datepicker directive', function() {
382382
});
383383

384384
it('should expose the controller in the template', function() {
385-
$templateCache.put('template/datepicker/datepicker.html', '<div>{{datepicker.text}}</div>');
385+
$templateCache.put('uib/template/datepicker/datepicker.html', '<div>{{datepicker.text}}</div>');
386386

387387
element = $compile('<uib-datepicker ng-model="date"></uib-datepicker>')($rootScope);
388388
$rootScope.$digest();

src/modal/modal.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
6868

6969
return {
7070
replace: true,
71-
templateUrl: 'template/modal/backdrop.html',
71+
templateUrl: 'uib/template/modal/backdrop.html',
7272
compile: function(tElement, tAttrs) {
7373
tElement.addClass(tAttrs.backdropClass);
7474
return linkFn;
@@ -122,7 +122,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
122122
replace: true,
123123
transclude: true,
124124
templateUrl: function(tElement, tAttrs) {
125-
return tAttrs.templateUrl || 'template/modal/window.html';
125+
return tAttrs.templateUrl || 'uib/template/modal/window.html';
126126
},
127127
link: function(scope, element, attrs) {
128128
element.addClass(attrs.windowClass || '');

src/modal/test/modal.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ describe('$uibModal', function () {
44

55
beforeEach(module('ngAnimateMock'));
66
beforeEach(module('ui.bootstrap.modal'));
7-
beforeEach(module('template/modal/backdrop.html'));
8-
beforeEach(module('template/modal/window.html'));
7+
beforeEach(module('uib/template/modal/backdrop.html'));
8+
beforeEach(module('uib/template/modal/window.html'));
99
beforeEach(module(function(_$controllerProvider_, _$uibModalProvider_){
1010
$controllerProvider = _$controllerProvider_;
1111
$uibModalProvider = _$uibModalProvider_;

src/modal/test/modalWindow.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ describe('modal window', function() {
22
var $rootScope, $compile;
33

44
beforeEach(module('ui.bootstrap.modal'));
5-
beforeEach(module('template/modal/window.html'));
5+
beforeEach(module('uib/template/modal/window.html'));
66
beforeEach(inject(function (_$rootScope_, _$compile_) {
77
$rootScope = _$rootScope_;
88
$compile = _$compile_;

src/pagination/docs/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Settings can be provided as attributes in the `<uib-pagination>` or globally con
7070
Whether to always display the first and last page numbers. If `max-size` is smaller than the number of pages, then the first and last page numbers are still shown with ellipses in-between as necessary. NOTE: `max-size` refers to the center of the range. This option may add up to 2 more numbers on each side of the displayed range for the end value and what would be an ellipsis but is replaced by a number because it is sequential.
7171

7272
* `template-url`
73-
_(Default: 'template/pagination/pagination.html')_ :
73+
_(Default: 'uib/template/pagination/pagination.html')_ :
7474
Override the template for the component with a custom provided template
7575

7676
### Pager Settings ###

src/pagination/pagination.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ angular.module('ui.bootstrap.pagination', [])
105105
controller: 'UibPaginationController',
106106
controllerAs: 'pagination',
107107
templateUrl: function(element, attrs) {
108-
return attrs.templateUrl || 'template/pagination/pagination.html';
108+
return attrs.templateUrl || 'uib/template/pagination/pagination.html';
109109
},
110110
replace: true,
111111
link: function(scope, element, attrs, ctrls) {
@@ -243,7 +243,7 @@ angular.module('ui.bootstrap.pagination', [])
243243
controller: 'UibPaginationController',
244244
controllerAs: 'pagination',
245245
templateUrl: function(element, attrs) {
246-
return attrs.templateUrl || 'template/pagination/pager.html';
246+
return attrs.templateUrl || 'uib/template/pagination/pager.html';
247247
},
248248
replace: true,
249249
link: function(scope, element, attrs, ctrls) {

src/pagination/test/pager.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe('pager directive', function() {
22
var $compile, $rootScope, $document, $templateCache, body, element;
33
beforeEach(module('ui.bootstrap.pagination'));
4-
beforeEach(module('template/pagination/pager.html'));
4+
beforeEach(module('uib/template/pagination/pager.html'));
55
beforeEach(inject(function(_$compile_, _$rootScope_, _$document_, _$templateCache_) {
66
$compile = _$compile_;
77
$rootScope = _$rootScope_;
@@ -54,7 +54,7 @@ describe('pager directive', function() {
5454
});
5555

5656
it('exposes the controller on the template', function() {
57-
$templateCache.put('template/pagination/pager.html', '<div>{{pagination.text}}</div>');
57+
$templateCache.put('uib/template/pagination/pager.html', '<div>{{pagination.text}}</div>');
5858

5959
element = $compile('<uib-pager></uib-pager>')($rootScope);
6060
$rootScope.$digest();

src/pagination/test/pagination.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe('pagination directive', function() {
22
var $compile, $rootScope, $document, $templateCache, body, element;
33
beforeEach(module('ui.bootstrap.pagination'));
4-
beforeEach(module('template/pagination/pagination.html'));
4+
beforeEach(module('uib/template/pagination/pagination.html'));
55
beforeEach(inject(function(_$compile_, _$rootScope_, _$document_, _$templateCache_) {
66
$compile = _$compile_;
77
$rootScope = _$rootScope_;
@@ -55,7 +55,7 @@ describe('pagination directive', function() {
5555
});
5656

5757
it('exposes the controller to the template', function() {
58-
$templateCache.put('template/pagination/pagination.html', '<div>{{pagination.randomText}}</div>');
58+
$templateCache.put('uib/template/pagination/pagination.html', '<div>{{pagination.randomText}}</div>');
5959
var scope = $rootScope.$new();
6060

6161
element = $compile('<uib-pagination></uib-pagination>')(scope);
@@ -922,7 +922,7 @@ describe('pagination directive', function() {
922922
describe('pagination directive', function() {
923923
var $compile, $rootScope, element;
924924
beforeEach(module('ui.bootstrap.pagination'));
925-
beforeEach(module('template/pagination/pagination.html'));
925+
beforeEach(module('uib/template/pagination/pagination.html'));
926926
beforeEach(inject(function(_$compile_, _$rootScope_) {
927927
$compile = _$compile_;
928928
$rootScope = _$rootScope_;

src/popover/popover.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
1010
replace: true,
1111
scope: { title: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',
1212
originScope: '&' },
13-
templateUrl: 'template/popover/popover-template.html'
13+
templateUrl: 'uib/template/popover/popover-template.html'
1414
};
1515
})
1616

@@ -24,7 +24,7 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
2424
return {
2525
replace: true,
2626
scope: { contentExp: '&', title: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
27-
templateUrl: 'template/popover/popover-html.html'
27+
templateUrl: 'uib/template/popover/popover-html.html'
2828
};
2929
})
3030

@@ -38,7 +38,7 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
3838
return {
3939
replace: true,
4040
scope: { title: '@', content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
41-
templateUrl: 'template/popover/popover.html'
41+
templateUrl: 'uib/template/popover/popover.html'
4242
};
4343
})
4444

src/popover/test/popover-html.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('popover', function() {
99
beforeEach(module('ui.bootstrap.popover'));
1010

1111
// load the template
12-
beforeEach(module('template/popover/popover-html.html'));
12+
beforeEach(module('uib/template/popover/popover-html.html'));
1313

1414
beforeEach(inject(function($rootScope, $compile, $sce) {
1515
elmBody = angular.element(

0 commit comments

Comments
 (0)