File tree 1 file changed +21
-0
lines changed
grails-app/assets/javascripts
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,27 @@ function ProjectViewModel(project) {
248
248
}
249
249
} ) ;
250
250
251
+ /**
252
+ * Automatically exclude an electorate's state if it is not already in the included states list.
253
+ */
254
+ self . geographicInfo . otherExcludedElectorates . subscribe ( function ( newValue ) {
255
+ // check if excluded electorates' states can also be added to exclude state
256
+ if ( newValue ) {
257
+ var states = findStatesElectoratesBelong ( newValue ) ;
258
+ if ( ! states )
259
+ return ;
260
+
261
+ for ( var i = 0 ; i < states . length ; i ++ ) {
262
+ var state = states [ i ] ,
263
+ excludeAbleStates = self . transients . states . statesToExclude ( ) ;
264
+ // exclude-able states are those that are not already selected as primary or in included states lists.
265
+ if ( ( excludeAbleStates . indexOf ( state ) >= 0 ) && ( self . geographicInfo . otherExcludedStates . indexOf ( state ) === - 1 ) ) {
266
+ self . geographicInfo . otherExcludedStates . push ( state ) ;
267
+ }
268
+ }
269
+ }
270
+ } ) ;
271
+
251
272
self . transients . programs = [ ] ;
252
273
self . transients . subprograms = { } ;
253
274
self . transients . subprogramsToDisplay = ko . computed ( function ( ) {
You can’t perform that action at this time.
0 commit comments