@@ -85,115 +85,3 @@ angular.module('ui.bootstrap.buttons', [])
85
85
}
86
86
} ;
87
87
} ) ;
88
-
89
- /* Deprecated buttons below */
90
-
91
- angular . module ( 'ui.bootstrap.buttons' )
92
-
93
- . value ( '$buttonsSuppressWarning' , false )
94
-
95
- . controller ( 'ButtonsController' , [ '$controller' , '$log' , '$buttonsSuppressWarning' , function ( $controller , $log , $buttonsSuppressWarning ) {
96
- if ( ! $buttonsSuppressWarning ) {
97
- $log . warn ( 'ButtonsController is now deprecated. Use UibButtonsController instead.' ) ;
98
- }
99
-
100
- angular . extend ( this , $controller ( 'UibButtonsController' ) ) ;
101
- } ] )
102
-
103
- . directive ( 'btnRadio' , [ '$log' , '$buttonsSuppressWarning' , function ( $log , $buttonsSuppressWarning ) {
104
- return {
105
- require : [ 'btnRadio' , 'ngModel' ] ,
106
- controller : 'ButtonsController' ,
107
- controllerAs : 'buttons' ,
108
- link : function ( scope , element , attrs , ctrls ) {
109
- if ( ! $buttonsSuppressWarning ) {
110
- $log . warn ( 'btn-radio is now deprecated. Use uib-btn-radio instead.' ) ;
111
- }
112
-
113
- var buttonsCtrl = ctrls [ 0 ] , ngModelCtrl = ctrls [ 1 ] ;
114
-
115
- element . find ( 'input' ) . css ( { display : 'none' } ) ;
116
-
117
- //model -> UI
118
- ngModelCtrl . $render = function ( ) {
119
- element . toggleClass ( buttonsCtrl . activeClass , angular . equals ( ngModelCtrl . $modelValue , scope . $eval ( attrs . btnRadio ) ) ) ;
120
- } ;
121
-
122
- //ui->model
123
- element . bind ( buttonsCtrl . toggleEvent , function ( ) {
124
- if ( attrs . disabled ) {
125
- return ;
126
- }
127
-
128
- var isActive = element . hasClass ( buttonsCtrl . activeClass ) ;
129
-
130
- if ( ! isActive || angular . isDefined ( attrs . uncheckable ) ) {
131
- scope . $apply ( function ( ) {
132
- ngModelCtrl . $setViewValue ( isActive ? null : scope . $eval ( attrs . btnRadio ) ) ;
133
- ngModelCtrl . $render ( ) ;
134
- } ) ;
135
- }
136
- } ) ;
137
- }
138
- } ;
139
- } ] )
140
-
141
- . directive ( 'btnCheckbox' , [ '$document' , '$log' , '$buttonsSuppressWarning' , function ( $document , $log , $buttonsSuppressWarning ) {
142
- return {
143
- require : [ 'btnCheckbox' , 'ngModel' ] ,
144
- controller : 'ButtonsController' ,
145
- controllerAs : 'button' ,
146
- link : function ( scope , element , attrs , ctrls ) {
147
- if ( ! $buttonsSuppressWarning ) {
148
- $log . warn ( 'btn-checkbox is now deprecated. Use uib-btn-checkbox instead.' ) ;
149
- }
150
-
151
- var buttonsCtrl = ctrls [ 0 ] , ngModelCtrl = ctrls [ 1 ] ;
152
-
153
- element . find ( 'input' ) . css ( { display : 'none' } ) ;
154
-
155
- function getTrueValue ( ) {
156
- return getCheckboxValue ( attrs . btnCheckboxTrue , true ) ;
157
- }
158
-
159
- function getFalseValue ( ) {
160
- return getCheckboxValue ( attrs . btnCheckboxFalse , false ) ;
161
- }
162
-
163
- function getCheckboxValue ( attributeValue , defaultValue ) {
164
- var val = scope . $eval ( attributeValue ) ;
165
- return angular . isDefined ( val ) ? val : defaultValue ;
166
- }
167
-
168
- //model -> UI
169
- ngModelCtrl . $render = function ( ) {
170
- element . toggleClass ( buttonsCtrl . activeClass , angular . equals ( ngModelCtrl . $modelValue , getTrueValue ( ) ) ) ;
171
- } ;
172
-
173
- //ui->model
174
- element . bind ( buttonsCtrl . toggleEvent , function ( ) {
175
- if ( attrs . disabled ) {
176
- return ;
177
- }
178
-
179
- scope . $apply ( function ( ) {
180
- ngModelCtrl . $setViewValue ( element . hasClass ( buttonsCtrl . activeClass ) ? getFalseValue ( ) : getTrueValue ( ) ) ;
181
- ngModelCtrl . $render ( ) ;
182
- } ) ;
183
- } ) ;
184
-
185
- //accessibility
186
- element . on ( 'keypress' , function ( e ) {
187
- if ( attrs . disabled || e . which !== 32 || $document [ 0 ] . activeElement !== element [ 0 ] ) {
188
- return ;
189
- }
190
-
191
- scope . $apply ( function ( ) {
192
- ngModelCtrl . $setViewValue ( element . hasClass ( buttonsCtrl . activeClass ) ? getFalseValue ( ) : getTrueValue ( ) ) ;
193
- ngModelCtrl . $render ( ) ;
194
- } ) ;
195
- } ) ;
196
- }
197
- } ;
198
- } ] ) ;
199
-
0 commit comments