@@ -116,9 +116,8 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
116
116
// You must provide the property on the accordion-group controller that will hold the transcluded element
117
117
. directive ( 'uibAccordionTransclude' , function ( ) {
118
118
return {
119
- require : [ '? ^uibAccordionGroup', '?^accordionGroup' ] ,
119
+ require : ' ^uibAccordionGroup',
120
120
link : function ( scope , element , attrs , controller ) {
121
- controller = controller [ 0 ] ? controller [ 0 ] : controller [ 1 ] ; // Delete after we remove deprecation
122
121
scope . $watch ( function ( ) { return controller [ attrs . uibAccordionTransclude ] ; } , function ( heading ) {
123
122
if ( heading ) {
124
123
element . find ( 'span' ) . html ( '' ) ;
@@ -128,122 +127,3 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
128
127
}
129
128
} ;
130
129
} ) ;
131
-
132
- /* Deprecated accordion below */
133
-
134
- angular . module ( 'ui.bootstrap.accordion' )
135
-
136
- . value ( '$accordionSuppressWarning' , false )
137
-
138
- . controller ( 'AccordionController' , [ '$scope' , '$attrs' , '$controller' , '$log' , '$accordionSuppressWarning' , function ( $scope , $attrs , $controller , $log , $accordionSuppressWarning ) {
139
- if ( ! $accordionSuppressWarning ) {
140
- $log . warn ( 'AccordionController is now deprecated. Use UibAccordionController instead.' ) ;
141
- }
142
-
143
- angular . extend ( this , $controller ( 'UibAccordionController' , {
144
- $scope : $scope ,
145
- $attrs : $attrs
146
- } ) ) ;
147
- } ] )
148
-
149
- . directive ( 'accordion' , [ '$log' , '$accordionSuppressWarning' , function ( $log , $accordionSuppressWarning ) {
150
- return {
151
- restrict : 'EA' ,
152
- controller : 'AccordionController' ,
153
- controllerAs : 'accordion' ,
154
- transclude : true ,
155
- replace : false ,
156
- templateUrl : function ( element , attrs ) {
157
- return attrs . templateUrl || 'template/accordion/accordion.html' ;
158
- } ,
159
- link : function ( ) {
160
- if ( ! $accordionSuppressWarning ) {
161
- $log . warn ( 'accordion is now deprecated. Use uib-accordion instead.' ) ;
162
- }
163
- }
164
- } ;
165
- } ] )
166
-
167
- . directive ( 'accordionGroup' , [ '$log' , '$accordionSuppressWarning' , function ( $log , $accordionSuppressWarning ) {
168
- return {
169
- require : '^accordion' , // We need this directive to be inside an accordion
170
- restrict : 'EA' ,
171
- transclude : true , // It transcludes the contents of the directive into the template
172
- replace : true , // The element containing the directive will be replaced with the template
173
- templateUrl : function ( element , attrs ) {
174
- return attrs . templateUrl || 'template/accordion/accordion-group.html' ;
175
- } ,
176
- scope : {
177
- heading : '@' , // Interpolate the heading attribute onto this scope
178
- isOpen : '=?' ,
179
- isDisabled : '=?'
180
- } ,
181
- controller : function ( ) {
182
- this . setHeading = function ( element ) {
183
- this . heading = element ;
184
- } ;
185
- } ,
186
- link : function ( scope , element , attrs , accordionCtrl ) {
187
- if ( ! $accordionSuppressWarning ) {
188
- $log . warn ( 'accordion-group is now deprecated. Use uib-accordion-group instead.' ) ;
189
- }
190
-
191
- accordionCtrl . addGroup ( scope ) ;
192
-
193
- scope . openClass = attrs . openClass || 'panel-open' ;
194
- scope . panelClass = attrs . panelClass ;
195
- scope . $watch ( 'isOpen' , function ( value ) {
196
- element . toggleClass ( scope . openClass , ! ! value ) ;
197
- if ( value ) {
198
- accordionCtrl . closeOthers ( scope ) ;
199
- }
200
- } ) ;
201
-
202
- scope . toggleOpen = function ( $event ) {
203
- if ( ! scope . isDisabled ) {
204
- if ( ! $event || $event . which === 32 ) {
205
- scope . isOpen = ! scope . isOpen ;
206
- }
207
- }
208
- } ;
209
- }
210
- } ;
211
- } ] )
212
-
213
- . directive ( 'accordionHeading' , [ '$log' , '$accordionSuppressWarning' , function ( $log , $accordionSuppressWarning ) {
214
- return {
215
- restrict : 'EA' ,
216
- transclude : true , // Grab the contents to be used as the heading
217
- template : '' , // In effect remove this element!
218
- replace : true ,
219
- require : '^accordionGroup' ,
220
- link : function ( scope , element , attr , accordionGroupCtrl , transclude ) {
221
- if ( ! $accordionSuppressWarning ) {
222
- $log . warn ( 'accordion-heading is now deprecated. Use uib-accordion-heading instead.' ) ;
223
- }
224
- // Pass the heading to the accordion-group controller
225
- // so that it can be transcluded into the right place in the template
226
- // [The second parameter to transclude causes the elements to be cloned so that they work in ng-repeat]
227
- accordionGroupCtrl . setHeading ( transclude ( scope , angular . noop ) ) ;
228
- }
229
- } ;
230
- } ] )
231
-
232
- . directive ( 'accordionTransclude' , [ '$log' , '$accordionSuppressWarning' , function ( $log , $accordionSuppressWarning ) {
233
- return {
234
- require : '^accordionGroup' ,
235
- link : function ( scope , element , attr , controller ) {
236
- if ( ! $accordionSuppressWarning ) {
237
- $log . warn ( 'accordion-transclude is now deprecated. Use uib-accordion-transclude instead.' ) ;
238
- }
239
-
240
- scope . $watch ( function ( ) { return controller [ attr . accordionTransclude ] ; } , function ( heading ) {
241
- if ( heading ) {
242
- element . find ( 'span' ) . html ( '' ) ;
243
- element . find ( 'span' ) . append ( heading ) ;
244
- }
245
- } ) ;
246
- }
247
- } ;
248
- } ] ) ;
249
-
0 commit comments