|
@@ -79,76 +79,7 @@ angular.module('$strap.directives').factory('$modal', [
|
|
|
return ModalFactory;
|
|
return ModalFactory;
|
|
|
}
|
|
}
|
|
|
])
|
|
])
|
|
|
-'use strict';
|
|
|
|
|
-angular.module('$strap.directives').directive('bsTabs', [
|
|
|
|
|
- '$parse',
|
|
|
|
|
- '$compile',
|
|
|
|
|
- '$timeout',
|
|
|
|
|
- function ($parse, $compile, $timeout) {
|
|
|
|
|
- var template = '<div class="tabs">' + '<ul class="nav nav-tabs">' + '<li ng-repeat="pane in panes" ng-class="{active:pane.active}">' + '<a data-target="#{{pane.id}}" data-index="{{$index}}" data-toggle="tab">{{pane.title}}</a>' + '</li>' + '</ul>' + '<div class="tab-content" ng-transclude>' + '</div>';
|
|
|
|
|
- return {
|
|
|
|
|
- restrict: 'A',
|
|
|
|
|
- require: '?ngModel',
|
|
|
|
|
- priority: 0,
|
|
|
|
|
- scope: true,
|
|
|
|
|
- template: template,
|
|
|
|
|
- replace: true,
|
|
|
|
|
- transclude: true,
|
|
|
|
|
- compile: function compile(tElement, tAttrs, transclude) {
|
|
|
|
|
- return function postLink(scope, iElement, iAttrs, controller) {
|
|
|
|
|
- var getter = $parse(iAttrs.bsTabs), setter = getter.assign, value = getter(scope);
|
|
|
|
|
- scope.panes = [];
|
|
|
|
|
- var $tabs = iElement.find('ul.nav-tabs');
|
|
|
|
|
- var $panes = iElement.find('div.tab-content');
|
|
|
|
|
- var activeTab = 0, id, title, active;
|
|
|
|
|
- $timeout(function () {
|
|
|
|
|
- $panes.find('[data-title], [data-tab]').each(function (index) {
|
|
|
|
|
- var $this = angular.element(this);
|
|
|
|
|
- id = 'tab-' + scope.$id + '-' + index;
|
|
|
|
|
- title = $this.data('title') || $this.data('tab');
|
|
|
|
|
- active = !active && $this.hasClass('active');
|
|
|
|
|
- $this.attr('id', id).addClass('tab-pane');
|
|
|
|
|
- if (iAttrs.fade)
|
|
|
|
|
- $this.addClass('fade');
|
|
|
|
|
- scope.panes.push({
|
|
|
|
|
- id: id,
|
|
|
|
|
- title: title,
|
|
|
|
|
- content: this.innerHTML,
|
|
|
|
|
- active: active
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- if (scope.panes.length && !active) {
|
|
|
|
|
- $panes.find('.tab-pane:first-child').addClass('active' + (iAttrs.fade ? ' in' : ''));
|
|
|
|
|
- scope.panes[0].active = true;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- if (controller) {
|
|
|
|
|
- iElement.on('show', function (ev) {
|
|
|
|
|
- var $target = $(ev.target);
|
|
|
|
|
- scope.$apply(function () {
|
|
|
|
|
- controller.$setViewValue($target.data('index'));
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- scope.$watch(iAttrs.ngModel, function (newValue, oldValue) {
|
|
|
|
|
- if (angular.isUndefined(newValue))
|
|
|
|
|
- return;
|
|
|
|
|
- activeTab = newValue;
|
|
|
|
|
- setTimeout(function () {
|
|
|
|
|
- // Check if we're still on the same tab before making the switch
|
|
|
|
|
- if(activeTab === newValue) {
|
|
|
|
|
- var $next = $($tabs[0].querySelectorAll('li')[newValue * 1]);
|
|
|
|
|
- if (!$next.hasClass('active')) {
|
|
|
|
|
- $next.children('a').tab('show');
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
-]);
|
|
|
|
|
|
|
+
|
|
|
'use strict';
|
|
'use strict';
|
|
|
angular.module('$strap.directives').directive('bsTooltip', [
|
|
angular.module('$strap.directives').directive('bsTooltip', [
|
|
|
'$parse',
|
|
'$parse',
|
|
@@ -202,6 +133,7 @@ angular.module('$strap.directives').directive('bsTooltip', [
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
]);
|
|
]);
|
|
|
|
|
+
|
|
|
'use strict';
|
|
'use strict';
|
|
|
angular.module('$strap.directives').directive('bsTypeahead', [
|
|
angular.module('$strap.directives').directive('bsTypeahead', [
|
|
|
'$parse',
|
|
'$parse',
|