Commit 7b2206ed2a8767361832802d1081a5a5d4d9493b

Authored by Fabio Teixeira
1 parent 5c1eb238

Fix institution city autocomplete bug

Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Showing 1 changed file with 9 additions and 12 deletions   Show diff stats
public/views/create-institution.js
... ... @@ -55,8 +55,8 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
55 55 name : $("#community_name").val(),
56 56 country : $("#community_country").val(),
57 57 state : $("#community_state").val(),
58   - city : $("#city_field").val()
59   - }
  58 + city : $("#community_city").val()
  59 + };
60 60 }
61 61  
62 62  
... ... @@ -69,7 +69,7 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
69 69 governmental_sphere: $("#institutions_governmental_sphere").selected().val(),
70 70 juridical_nature: $("#institutions_juridical_nature").selected().val(),
71 71 corporate_name: $("#institutions_corporate_name").val()
72   - }
  72 + };
73 73 }
74 74  
75 75  
... ... @@ -274,7 +274,7 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
274 274 var city = $("#community_city").parent().parent();
275 275 var state = $("#community_state").parent().parent();
276 276 var inst_type = $("input[name='institutions[type]']:checked").val();
277   - institution_type_actions(inst_type)
  277 + institution_type_actions(inst_type);
278 278  
279 279 if( country === "-1" ) $("#community_country").val("BR");
280 280  
... ... @@ -323,10 +323,9 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
323 323 }
324 324  
325 325 function autoCompleteCity() {
326   - var country_selected = $('#community_country').val()
  326 + var country_selected = $('#community_country').val();
327 327  
328   - if(country_selected == "BR")
329   - {
  328 + if(country_selected == "BR") {
330 329 $('#community_city').autocomplete({
331 330 source : function(request, response){
332 331 $.ajax({
... ... @@ -348,9 +347,7 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
348 347  
349 348 minLength: 3
350 349 });
351   - }
352   - else
353   - {
  350 + } else {
354 351 if ($('#community_city').data('autocomplete')) {
355 352 $('#community_city').autocomplete("destroy");
356 353 $('#community_city').removeData('autocomplete');
... ... @@ -385,7 +382,7 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
385 382 autoCompleteCity();
386 383 $('#community_country').change(function(){
387 384 autoCompleteCity();
388   - })
  385 + });
389 386 }
390 387  
391 388  
... ... @@ -399,5 +396,5 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
399 396 set_form_count_custom_data();
400 397 set_events();
401 398 }
402   - }
  399 + };
403 400 });
... ...