Remove angular-bootstrap accordion.
This commit is contained in:
parent
08f5061247
commit
90ed8249be
154
src/ui/public/angular-bootstrap/ui-bootstrap-tpls.js
vendored
154
src/ui/public/angular-bootstrap/ui-bootstrap-tpls.js
vendored
|
@ -15,7 +15,6 @@ angular.module("ui.bootstrap", [
|
|||
"ui.bootstrap.tpls",
|
||||
"ui.bootstrap.transition",
|
||||
"ui.bootstrap.collapse",
|
||||
"ui.bootstrap.accordion",
|
||||
"ui.bootstrap.alert",
|
||||
"ui.bootstrap.bindHtml",
|
||||
"ui.bootstrap.buttons",
|
||||
|
@ -36,8 +35,6 @@ angular.module("ui.bootstrap", [
|
|||
]);
|
||||
|
||||
angular.module("ui.bootstrap.tpls", [
|
||||
"template/accordion/accordion-group.html",
|
||||
"template/accordion/accordion.html",
|
||||
"template/alert/alert.html",
|
||||
"template/carousel/carousel.html",
|
||||
"template/carousel/slide.html",
|
||||
|
@ -223,137 +220,6 @@ angular.module('ui.bootstrap.collapse', ['ui.bootstrap.transition'])
|
|||
};
|
||||
}]);
|
||||
|
||||
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(index, 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', function() {
|
||||
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: '@', // Interpolate the heading attribute onto this scope
|
||||
isOpen: '=?',
|
||||
isDisabled: '=?'
|
||||
},
|
||||
controller: function() {
|
||||
this.setHeading = function(element) {
|
||||
this.heading = element;
|
||||
};
|
||||
},
|
||||
link: function(scope, element, attrs, accordionCtrl) {
|
||||
accordionCtrl.addGroup(scope);
|
||||
|
||||
scope.$watch('isOpen', function(value) {
|
||||
if ( value ) {
|
||||
accordionCtrl.closeOthers(scope);
|
||||
}
|
||||
});
|
||||
|
||||
scope.toggleOpen = function() {
|
||||
if ( !scope.isDisabled ) {
|
||||
scope.isOpen = !scope.isOpen;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
// Use accordion-heading below an accordion-group to provide a heading containing HTML
|
||||
// <accordion-group>
|
||||
// <accordion-heading>Heading containing HTML - <img src="..."></accordion-heading>
|
||||
// </accordion-group>
|
||||
.directive('accordionHeading', function() {
|
||||
return {
|
||||
restrict: 'EA',
|
||||
transclude: true, // Grab the contents to be used as the heading
|
||||
template: '', // In effect remove this element!
|
||||
replace: true,
|
||||
require: '^accordionGroup',
|
||||
link: function(scope, element, attr, accordionGroupCtrl, transclude) {
|
||||
// Pass the heading to the accordion-group controller
|
||||
// so that it can be transcluded into the right place in the template
|
||||
// [The second parameter to transclude causes the elements to be cloned so that they work in ng-repeat]
|
||||
accordionGroupCtrl.setHeading(transclude(scope, function() {}));
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
// Use in the accordion-group template to indicate where you want the heading to be transcluded
|
||||
// You must provide the property on the accordion-group controller that will hold the transcluded element
|
||||
// <div class="accordion-group">
|
||||
// <div class="accordion-heading" ><a ... accordion-transclude="heading">...</a></div>
|
||||
// ...
|
||||
// </div>
|
||||
.directive('accordionTransclude', function() {
|
||||
return {
|
||||
require: '^accordionGroup',
|
||||
link: function(scope, element, attr, controller) {
|
||||
scope.$watch(function() { return controller[attr.accordionTransclude]; }, function(heading) {
|
||||
if ( heading ) {
|
||||
element.html('');
|
||||
element.append(heading);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
angular.module('ui.bootstrap.alert', [])
|
||||
|
||||
.controller('AlertController', ['$scope', '$attrs', function ($scope, $attrs) {
|
||||
|
@ -3957,26 +3823,6 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
|
|||
};
|
||||
});
|
||||
|
||||
angular.module("template/accordion/accordion-group.html", []).run(["$templateCache", function($templateCache) {
|
||||
$templateCache.put("template/accordion/accordion-group.html",
|
||||
"<div class=\"panel panel-default\">\n" +
|
||||
" <div class=\"panel-heading\">\n" +
|
||||
" <h4 class=\"panel-title\">\n" +
|
||||
" <a href class=\"accordion-toggle\" ng-click=\"toggleOpen()\" accordion-transclude=\"heading\"><span ng-class=\"{'text-muted': isDisabled}\">{{heading}}</span></a>\n" +
|
||||
" </h4>\n" +
|
||||
" </div>\n" +
|
||||
" <div class=\"panel-collapse\" collapse=\"!isOpen\">\n" +
|
||||
" <div class=\"panel-body\" ng-transclude></div>\n" +
|
||||
" </div>\n" +
|
||||
"</div>\n" +
|
||||
"");
|
||||
}]);
|
||||
|
||||
angular.module("template/accordion/accordion.html", []).run(["$templateCache", function($templateCache) {
|
||||
$templateCache.put("template/accordion/accordion.html",
|
||||
"<div class=\"panel-group\" ng-transclude></div>");
|
||||
}]);
|
||||
|
||||
angular.module("template/alert/alert.html", []).run(["$templateCache", function($templateCache) {
|
||||
$templateCache.put("template/alert/alert.html",
|
||||
"<div class=\"alert\" ng-class=\"['alert-' + (type || 'warning'), closeable ? 'alert-dismissable' : null]\" role=\"alert\">\n" +
|
||||
|
|
Loading…
Reference in a new issue