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

Commit

Permalink
feat: prefix virtual templates with uib/
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
wesleycho committed Nov 7, 2015
1 parent fe69386 commit 342c576
Show file tree
Hide file tree
Showing 41 changed files with 100 additions and 93 deletions.
5 changes: 4 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ module.exports = function(grunt) {
dist: {
options: {
module: null, // no bundle module for all the html2js templates
base: '.'
base: '.',
rename: function(moduleName) {
return 'uib/' + moduleName;
}
},
files: [{
expand: true,
Expand Down
4 changes: 2 additions & 2 deletions src/accordion/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
controllerAs: 'accordion',
transclude: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'template/accordion/accordion.html';
return attrs.templateUrl || 'uib/template/accordion/accordion.html';
}
};
})
Expand All @@ -60,7 +60,7 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
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: function(element, attrs) {
return attrs.templateUrl || 'template/accordion/accordion-group.html';
return attrs.templateUrl || 'uib/template/accordion/accordion-group.html';
},
scope: {
heading: '@', // Interpolate the heading attribute onto this scope
Expand Down
2 changes: 1 addition & 1 deletion src/accordion/docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The body of each accordion group is transcluded into the body of the collapsible
Add ability to use Bootstrap's contextual panel classes (panel-primary, panel-success, panel-info, etc...) or your own. This must be a string.

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

### Default settings `uibAccordionConfig`
Expand Down
6 changes: 3 additions & 3 deletions src/accordion/test/accordion.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ describe('uib-accordion', function() {

beforeEach(module('ui.bootstrap.accordion'));
beforeEach(module('ngAnimateMock'));
beforeEach(module('template/accordion/accordion.html'));
beforeEach(module('template/accordion/accordion-group.html'));
beforeEach(module('uib/template/accordion/accordion.html'));
beforeEach(module('uib/template/accordion/accordion-group.html'));

beforeEach(inject(function(_$animate_, $rootScope) {
$animate = _$animate_;
Expand Down Expand Up @@ -124,7 +124,7 @@ describe('uib-accordion', function() {
}));

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

element = $compile('<uib-accordion></uib-accordion>')(scope);
scope.$digest();
Expand Down
2 changes: 1 addition & 1 deletion src/alert/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ angular.module('ui.bootstrap.alert', [])
controller: 'UibAlertController',
controllerAs: 'alert',
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'template/alert/alert.html';
return attrs.templateUrl || 'uib/template/alert/alert.html';
},
transclude: true,
replace: true,
Expand Down
2 changes: 1 addition & 1 deletion src/alert/docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This directive can be used both to generate alerts from static and dynamic model
A callback function that gets fired when an `alert` is closed. If the attribute exists, a close button is displayed as well.
* `dismiss-on-timeout` _(Default: `none`)(Optional)_ -
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.
* `template-url` _(Default: `template/alert/alert.html`)_ -
* `template-url` _(Default: `uib/template/alert/alert.html`)_ -
Add the ability to override the template used in the component.
* `type` _(Default: `warning`)_ -
Defines the type of the alert. Go to [bootstrap page](http://getbootstrap.com/components/#alerts) to see the type of alerts available.
4 changes: 2 additions & 2 deletions src/alert/test/alert.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ describe('uib-alert', function() {
var element, scope, $compile, $templateCache, $timeout;

beforeEach(module('ui.bootstrap.alert'));
beforeEach(module('template/alert/alert.html'));
beforeEach(module('uib/template/alert/alert.html'));

beforeEach(inject(function($rootScope, _$compile_, _$templateCache_, _$timeout_) {
scope = $rootScope;
Expand Down Expand Up @@ -39,7 +39,7 @@ describe('uib-alert', function() {
}

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

element = $compile('<uib-alert></uib-alert>')(scope);
scope.$digest();
Expand Down
4 changes: 2 additions & 2 deletions src/carousel/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ angular.module('ui.bootstrap.carousel', [])
controller: 'UibCarouselController',
controllerAs: 'carousel',
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'template/carousel/carousel.html';
return attrs.templateUrl || 'uib/template/carousel/carousel.html';
},
scope: {
interval: '=',
Expand All @@ -219,7 +219,7 @@ angular.module('ui.bootstrap.carousel', [])
transclude: true,
replace: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'template/carousel/slide.html';
return attrs.templateUrl || 'uib/template/carousel/slide.html';
},
scope: {
active: '=?',
Expand Down
4 changes: 2 additions & 2 deletions src/carousel/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Use a `<uib-carousel>` element with `<uib-slide>` elements inside it.
Whether to disable the transition animation between slides. Setting this to truthy, disables this transition.

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

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

* `template-url`
_(Default: `template/carousel/slide.html`)_ -
_(Default: `uib/template/carousel/slide.html`)_ -
Add the ability to override the template used on the component.
4 changes: 2 additions & 2 deletions src/carousel/test/carousel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('carousel', function() {
});
}
}));
beforeEach(module('template/carousel/carousel.html', 'template/carousel/slide.html'));
beforeEach(module('uib/template/carousel/carousel.html', 'uib/template/carousel/slide.html'));

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

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

var scope = $rootScope.$new();
var elm = $compile('<uib-carousel interval="bar" no-transition="false" no-pause="true"></uib-carousel>')(scope);
Expand Down
14 changes: 7 additions & 7 deletions src/datepicker/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
return {
replace: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'template/datepicker/datepicker.html';
return attrs.templateUrl || 'uib/template/datepicker/datepicker.html';
},
scope: {
datepickerMode: '=?',
Expand All @@ -466,7 +466,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
return {
replace: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'template/datepicker/day.html';
return attrs.templateUrl || 'uib/template/datepicker/day.html';
},
require: ['^?uibDatepicker', 'uibDaypicker', '^?datepicker'],
controller: 'UibDaypickerController',
Expand All @@ -483,7 +483,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
return {
replace: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'template/datepicker/month.html';
return attrs.templateUrl || 'uib/template/datepicker/month.html';
},
require: ['^?uibDatepicker', 'uibMonthpicker', '^?datepicker'],
controller: 'UibMonthpickerController',
Expand All @@ -500,7 +500,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
return {
replace: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'template/datepicker/year.html';
return attrs.templateUrl || 'uib/template/datepicker/year.html';
},
require: ['^?uibDatepicker', 'uibYearpicker', '^?datepicker'],
controller: 'UibYearpickerController',
Expand All @@ -516,8 +516,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst

.constant('uibDatepickerPopupConfig', {
datepickerPopup: 'yyyy-MM-dd',
datepickerPopupTemplateUrl: 'template/datepicker/popup.html',
datepickerTemplateUrl: 'template/datepicker/datepicker.html',
datepickerPopupTemplateUrl: 'uib/template/datepicker/popup.html',
datepickerTemplateUrl: 'uib/template/datepicker/datepicker.html',
html5Types: {
date: 'yyyy-MM-dd',
'datetime-local': 'yyyy-MM-ddTHH:mm:ss.sss',
Expand Down Expand Up @@ -888,7 +888,7 @@ function(scope, element, attrs, $compile, $parse, $document, $rootScope, $positi
replace: true,
transclude: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'template/datepicker/popup.html';
return attrs.templateUrl || 'uib/template/datepicker/popup.html';
}
};
});
6 changes: 3 additions & 3 deletions src/datepicker/docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ All settings can be provided as attributes in the `uib-datepicker` or globally c
An option to disable or enable shortcut's event propagation.

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


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

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

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

* `datepicker-append-to-body`
Expand Down
12 changes: 6 additions & 6 deletions src/datepicker/test/datepicker.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
describe('datepicker directive', function() {
var $rootScope, $compile, $templateCache, element;
beforeEach(module('ui.bootstrap.datepicker'));
beforeEach(module('template/datepicker/datepicker.html'));
beforeEach(module('template/datepicker/day.html'));
beforeEach(module('template/datepicker/month.html'));
beforeEach(module('template/datepicker/year.html'));
beforeEach(module('template/datepicker/popup.html'));
beforeEach(module('uib/template/datepicker/datepicker.html'));
beforeEach(module('uib/template/datepicker/day.html'));
beforeEach(module('uib/template/datepicker/month.html'));
beforeEach(module('uib/template/datepicker/year.html'));
beforeEach(module('uib/template/datepicker/popup.html'));
beforeEach(module(function($compileProvider) {
$compileProvider.directive('dateModel', function() {
return {
Expand Down Expand Up @@ -382,7 +382,7 @@ describe('datepicker directive', function() {
});

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

element = $compile('<uib-datepicker ng-model="date"></uib-datepicker>')($rootScope);
$rootScope.$digest();
Expand Down
4 changes: 2 additions & 2 deletions src/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])

return {
replace: true,
templateUrl: 'template/modal/backdrop.html',
templateUrl: 'uib/template/modal/backdrop.html',
compile: function(tElement, tAttrs) {
tElement.addClass(tAttrs.backdropClass);
return linkFn;
Expand Down Expand Up @@ -122,7 +122,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
replace: true,
transclude: true,
templateUrl: function(tElement, tAttrs) {
return tAttrs.templateUrl || 'template/modal/window.html';
return tAttrs.templateUrl || 'uib/template/modal/window.html';
},
link: function(scope, element, attrs) {
element.addClass(attrs.windowClass || '');
Expand Down
4 changes: 2 additions & 2 deletions src/modal/test/modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ describe('$uibModal', function () {

beforeEach(module('ngAnimateMock'));
beforeEach(module('ui.bootstrap.modal'));
beforeEach(module('template/modal/backdrop.html'));
beforeEach(module('template/modal/window.html'));
beforeEach(module('uib/template/modal/backdrop.html'));
beforeEach(module('uib/template/modal/window.html'));
beforeEach(module(function(_$controllerProvider_, _$uibModalProvider_){
$controllerProvider = _$controllerProvider_;
$uibModalProvider = _$uibModalProvider_;
Expand Down
2 changes: 1 addition & 1 deletion src/modal/test/modalWindow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ describe('modal window', function() {
var $rootScope, $compile;

beforeEach(module('ui.bootstrap.modal'));
beforeEach(module('template/modal/window.html'));
beforeEach(module('uib/template/modal/window.html'));
beforeEach(inject(function (_$rootScope_, _$compile_) {
$rootScope = _$rootScope_;
$compile = _$compile_;
Expand Down
2 changes: 1 addition & 1 deletion src/pagination/docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Settings can be provided as attributes in the `<uib-pagination>` or globally con
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.

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

### Pager Settings ###
Expand Down
4 changes: 2 additions & 2 deletions src/pagination/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ angular.module('ui.bootstrap.pagination', [])
controller: 'UibPaginationController',
controllerAs: 'pagination',
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'template/pagination/pagination.html';
return attrs.templateUrl || 'uib/template/pagination/pagination.html';
},
replace: true,
link: function(scope, element, attrs, ctrls) {
Expand Down Expand Up @@ -243,7 +243,7 @@ angular.module('ui.bootstrap.pagination', [])
controller: 'UibPaginationController',
controllerAs: 'pagination',
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'template/pagination/pager.html';
return attrs.templateUrl || 'uib/template/pagination/pager.html';
},
replace: true,
link: function(scope, element, attrs, ctrls) {
Expand Down
4 changes: 2 additions & 2 deletions src/pagination/test/pager.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe('pager directive', function() {
var $compile, $rootScope, $document, $templateCache, body, element;
beforeEach(module('ui.bootstrap.pagination'));
beforeEach(module('template/pagination/pager.html'));
beforeEach(module('uib/template/pagination/pager.html'));
beforeEach(inject(function(_$compile_, _$rootScope_, _$document_, _$templateCache_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
Expand Down Expand Up @@ -54,7 +54,7 @@ describe('pager directive', function() {
});

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

element = $compile('<uib-pager></uib-pager>')($rootScope);
$rootScope.$digest();
Expand Down
6 changes: 3 additions & 3 deletions src/pagination/test/pagination.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe('pagination directive', function() {
var $compile, $rootScope, $document, $templateCache, body, element;
beforeEach(module('ui.bootstrap.pagination'));
beforeEach(module('template/pagination/pagination.html'));
beforeEach(module('uib/template/pagination/pagination.html'));
beforeEach(inject(function(_$compile_, _$rootScope_, _$document_, _$templateCache_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
Expand Down Expand Up @@ -55,7 +55,7 @@ describe('pagination directive', function() {
});

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

element = $compile('<uib-pagination></uib-pagination>')(scope);
Expand Down Expand Up @@ -922,7 +922,7 @@ describe('pagination directive', function() {
describe('pagination directive', function() {
var $compile, $rootScope, element;
beforeEach(module('ui.bootstrap.pagination'));
beforeEach(module('template/pagination/pagination.html'));
beforeEach(module('uib/template/pagination/pagination.html'));
beforeEach(inject(function(_$compile_, _$rootScope_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
Expand Down
6 changes: 3 additions & 3 deletions src/popover/popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
replace: true,
scope: { title: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',
originScope: '&' },
templateUrl: 'template/popover/popover-template.html'
templateUrl: 'uib/template/popover/popover-template.html'
};
})

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

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

Expand Down
2 changes: 1 addition & 1 deletion src/popover/test/popover-html.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('popover', function() {
beforeEach(module('ui.bootstrap.popover'));

// load the template
beforeEach(module('template/popover/popover-html.html'));
beforeEach(module('uib/template/popover/popover-html.html'));

beforeEach(inject(function($rootScope, $compile, $sce) {
elmBody = angular.element(
Expand Down
Loading

0 comments on commit 342c576

Please sign in to comment.