Skip to content

Commit

Permalink
Replace autocomplete with Ace theme bundled typeahead
Browse files Browse the repository at this point in the history
Fixes: #21881
  • Loading branch information
syncguru authored and vboctor committed Jan 3, 2017
1 parent 14e3d50 commit 6875f99
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
6 changes: 3 additions & 3 deletions bug_report_page.php
Expand Up @@ -389,7 +389,7 @@ class="dropzone-form"
</select>
<?php
} else {
echo '<input type="text" id="platform" name="platform" class="autocomplete input-sm" size="32" maxlength="32" tabindex="' . helper_get_tab_index_value() . '" value="' . string_attribute( $f_platform ) . '" />';
echo '<input type="text" id="platform" name="platform" class="typeahead input-sm" autocomplete = "off" size="32" maxlength="32" tabindex="' . helper_get_tab_index_value() . '" value="' . string_attribute( $f_platform ) . '" />';
}
?>
</td>
Expand All @@ -406,7 +406,7 @@ class="dropzone-form"
</select>
<?php
} else {
echo '<input type="text" id="os" name="os" class="autocomplete input-sm" size="32" maxlength="32" tabindex="' . helper_get_tab_index_value() . '" value="' . string_attribute( $f_os ) . '" />';
echo '<input type="text" id="os" name="os" class="typeahead input-sm" autocomplete = "off" size="32" maxlength="32" tabindex="' . helper_get_tab_index_value() . '" value="' . string_attribute( $f_os ) . '" />';
}
?>
</td>
Expand All @@ -425,7 +425,7 @@ class="dropzone-form"
</select>
<?php
} else {
echo '<input type="text" id="os_build" name="os_build" class="autocomplete input-sm" size="16" maxlength="16" tabindex="' . helper_get_tab_index_value() . '" value="' . string_attribute( $f_os_build ) . '" />';
echo '<input type="text" id="os_build" name="os_build" class="typeahead input-sm" autocomplete = "off" size="16" maxlength="16" tabindex="' . helper_get_tab_index_value() . '" value="' . string_attribute( $f_os_build ) . '" />';
}
?>
</td>
Expand Down
6 changes: 3 additions & 3 deletions bug_update_page.php
Expand Up @@ -519,7 +519,7 @@
print_platform_option_list( $t_bug->platform );
echo '</select>';
} else {
echo '<input type="text" id="platform" name="platform" class="autocomplete input-sm" size="16" maxlength="32" tabindex="' . helper_get_tab_index_value() . '" value="' . string_attribute( $t_bug->platform ) . '" />';
echo '<input type="text" id="platform" name="platform" class="typeahead input-sm" autocomplete = "off" size="16" maxlength="32" tabindex="' . helper_get_tab_index_value() . '" value="' . string_attribute( $t_bug->platform ) . '" />';
}

echo '</td>';
Expand All @@ -537,7 +537,7 @@
print_os_option_list( $t_bug->os );
echo '</select>';
} else {
echo '<input type="text" id="os" name="os" class="autocomplete input-sm" size="16" maxlength="32" tabindex="' . helper_get_tab_index_value() . '" value="' . string_attribute( $t_bug->os ) . '" />';
echo '<input type="text" id="os" name="os" class="typeahead input-sm" autocomplete = "off" size="16" maxlength="32" tabindex="' . helper_get_tab_index_value() . '" value="' . string_attribute( $t_bug->os ) . '" />';
}

echo '</td>';
Expand All @@ -555,7 +555,7 @@
print_os_build_option_list( $t_bug->os_build );
echo '</select>';
} else {
echo '<input type="text" id="os_build" name="os_build" class="autocomplete input-sm" size="16" maxlength="16" tabindex="' . helper_get_tab_index_value() . '" value="' . string_attribute( $t_bug->os_build ) . '" />';
echo '<input type="text" id="os_build" name="os_build" class="typeahead input-sm" autocomplete = "off" size="16" maxlength="16" tabindex="' . helper_get_tab_index_value() . '" value="' . string_attribute( $t_bug->os_build ) . '" />';
}

echo '</td>';
Expand Down
17 changes: 17 additions & 0 deletions js/common.js
Expand Up @@ -89,6 +89,23 @@ $(document).ready( function() {
SetCookie("collapse_settings", t_cookie);
});

$('input[type=text].typeahead').bs_typeahead({
source: function(query, callback) {
var fieldName = this.$element.attr('id');
var postData = {};
postData['entrypoint']= fieldName + '_get_with_prefix';
postData[fieldName] = query;
$.getJSON('xmlhttprequest.php', postData, function(data) {
var results = [];
$.each(data, function(i, value) {
results.push(value);
});
callback(results);
});
}
});


$('a.dynamic-filter-expander').click(function(event) {
event.preventDefault();
var fieldID = $(this).attr('id');
Expand Down

0 comments on commit 6875f99

Please sign in to comment.