aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/request/new.rhtml
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/request/new.rhtml')
-rw-r--r--app/views/request/new.rhtml11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml
index 8dae8467a..355641b63 100644
--- a/app/views/request/new.rhtml
+++ b/app/views/request/new.rhtml
@@ -4,8 +4,16 @@
// Avoid triggering too often (on each keystroke) by using the debounce jQuery plugin:
// http://benalman.com/projects/jquery-throttle-debounce-plugin/
$("#typeahead_search").keypress($.debounce( 300, function() {
- $("#typeahead_response").load("<%=search_ahead_url%>?q="+encodeURI(this.value));
+ $("#typeahead_response").load("<%=search_ahead_url%>?q="+encodeURI(this.value), function() {
+ // When following links in typeahead results, open new tab/window
+ $("#typeahead_response a").attr("target","_blank");
+
+ // Update the public body site search link
+ $("#body-site-search-link").attr("href", "http://www.google.com/#q="+encodeURI($("#typeahead_search").val())+
+ "+site:<%= @info_request.public_body.calculated_home_page %>");
+ });
}));
+
});
</script>
@@ -84,6 +92,7 @@
<% end %>
)
</div>
+
<div id="typeahead_response">
</div>
</div>