@@ -158,7 +158,7 @@ $(function() {
158
158
if ( searchInput . length == 1 ) {
159
159
// Dynamically update forms and faq items while the user types in the search bar
160
160
var timer = getTimer ( searchInput ) ;
161
- if ( $ ( '#plugin_formcreator_kb_categories .category_active ' ) . length > 0 ) {
161
+ if ( $ ( '#plugin_formcreator_kb_categories' ) . length > 0 ) {
162
162
var callback = function ( ) {
163
163
updateKbitemsView ( currentCategory ) ;
164
164
}
@@ -174,13 +174,25 @@ $(function() {
174
174
$ ( '#plugin_formcreator_searchBar input' ) . focus ( function ( event ) {
175
175
if ( searchInput . val ( ) . length > 0 ) {
176
176
searchInput . val ( '' ) ;
177
- updateWizardFormsView ( currentCategory ) ;
178
- $ . when ( getFormAndFaqItems ( 0 ) ) . then (
179
- function ( response ) {
180
- tiles = response ;
181
- showTiles ( tiles . forms ) ;
182
- }
183
- ) ;
177
+ if ( $ ( '#plugin_formcreator_kb_categories' ) . length > 0 ) {
178
+ updateKbitemsView ( null ) ;
179
+ $ . when ( getFaqItems ( 0 ) )
180
+ . then (
181
+ function ( response ) {
182
+ tiles = response ;
183
+ showTiles ( tiles . forms ) ;
184
+ }
185
+ ) ;
186
+ } else {
187
+ updateWizardFormsView ( null ) ;
188
+ $ . when ( getFormAndFaqItems ( 0 ) )
189
+ . then (
190
+ function ( response ) {
191
+ tiles = response ;
192
+ showTiles ( tiles . forms ) ;
193
+ }
194
+ ) ;
195
+ }
184
196
}
185
197
} ) ;
186
198
}
@@ -285,7 +297,8 @@ function getFaqItems(categoryId) {
285
297
data : {
286
298
categoriesId : categoryId ,
287
299
keywords : keywords ,
288
- helpdeskHome : 0 } ,
300
+ helpdeskHome : 0
301
+ } ,
289
302
dataType : "json"
290
303
} ) . done ( function ( response ) {
291
304
deferred . resolve ( response ) ;
@@ -304,7 +317,12 @@ function getFormAndFaqItems(categoryId) {
304
317
var deferred = jQuery . Deferred ( ) ;
305
318
$ . post ( {
306
319
url : formcreatorRootDoc + '/ajax/homepage_wizard.php' ,
307
- data : { wizard : 'forms' , categoriesId : categoryId , keywords : keywords , helpdeskHome : 0 } ,
320
+ data : {
321
+ wizard : 'forms' ,
322
+ categoriesId : categoryId ,
323
+ keywords : keywords ,
324
+ helpdeskHome : 0
325
+ } ,
308
326
dataType : "json"
309
327
} ) . done ( function ( response ) {
310
328
deferred . resolve ( response ) ;
0 commit comments