@@ -141,31 +141,27 @@ module.exports = [
141
141
$scope . translations [ key ] = $translate . instant ( value ) ;
142
142
} ) ;
143
143
144
- const initTypes = ( ) => {
145
- $scope . types . map ( function ( el ) {
146
- el . id . value = $translate . instant ( el . id . value ) ;
147
- if ( el . operators ) {
148
- el . operators = el . operators . map ( function ( op ) {
149
- op . value = $translate . instant ( op . value ) ;
150
- return op ;
151
- } ) ;
152
- }
153
-
154
- if ( el . options && typeof el . options [ 0 ] === 'object' ) {
155
- el . mappedOptions = el . options . map ( ( { key, value} ) => {
156
- return {
157
- key : key ,
158
- value : $translate . instant ( value )
159
- } ;
160
- } ) ;
144
+ $scope . types . map ( function ( el ) {
145
+ el . id . value = $translate . instant ( el . id . value ) ;
146
+ if ( el . operators ) {
147
+ el . operators = el . operators . map ( function ( op ) {
148
+ op . value = $translate . instant ( op . value ) ;
149
+ return op ;
150
+ } ) ;
151
+ }
161
152
162
- el . options = el . mappedOptions . map ( ( { value} ) => value ) ;
163
- }
164
- return el ;
165
- } ) ;
166
- } ;
153
+ if ( el . options && typeof el . options [ 0 ] === 'object' ) {
154
+ el . mappedOptions = el . options . map ( ( { key, value} ) => {
155
+ return {
156
+ key : key ,
157
+ value : $translate . instant ( value )
158
+ } ;
159
+ } ) ;
167
160
168
- if ( $scope . types ) initTypes ( ) ;
161
+ el . options = el . mappedOptions . map ( ( { value} ) => value ) ;
162
+ }
163
+ return el ;
164
+ } ) ;
169
165
170
166
angular . forEach ( $scope . operators , function ( operatorGroupedByType ) {
171
167
angular . forEach ( operatorGroupedByType , function ( operator ) {
@@ -735,7 +731,7 @@ module.exports = [
735
731
736
732
if (
737
733
$scope . matchAny &&
738
- ! $location . search ( ) . hasOwnProperty ( searchId + 'OrQuery' ) // eslint-disable-line
734
+ ! $location . search ( ) . hasOwnProperty ( searchId + 'OrQuery' ) // eslint-disable-line
739
735
) {
740
736
newLocation = $location . url ( ) + '&' + searchId + 'OrQuery' ;
741
737
} else if ( ! $scope . matchAny ) {
@@ -775,11 +771,11 @@ module.exports = [
775
771
$scope . $on ( '$locationChangeSuccess' , function ( ) {
776
772
$scope . matchAny = $location
777
773
. search ( )
778
- . hasOwnProperty ( searchId + 'OrQuery' ) ; // eslint-disable-line
774
+ . hasOwnProperty ( searchId + 'OrQuery' ) ; // eslint-disable-line
779
775
780
776
if (
781
777
! IGNORE_URL_UPDATE &&
782
- $location . search ( ) . hasOwnProperty ( searchId + 'Query' ) // eslint-disable-line
778
+ $location . search ( ) . hasOwnProperty ( searchId + 'Query' ) // eslint-disable-line
783
779
) {
784
780
// make new array of searches from the url
785
781
var searches = getSearchesFromURL ( ) ;
@@ -825,11 +821,9 @@ module.exports = [
825
821
$scope . searches [ i ] . type . values = types ;
826
822
}
827
823
} ;
828
-
829
824
$scope . $watch (
830
825
'types' ,
831
826
function ( ) {
832
- initTypes ( ) ;
833
827
//in case if array of types changed - update dropdown values
834
828
$scope . searchTypes = $scope . types . map ( function ( el ) {
835
829
return el . id ;
0 commit comments