1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<script type="text/javascript" src="/javascripts/ba-throttle-debounce.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#authority_preview").hide();
// Avoid triggering too often (on each keystroke) by using the debounce jQuery plugin:
// http://benalman.com/projects/jquery-throttle-debounce-plugin/
$("#query").keypress($.debounce( 300, function() {
// Do a type ahead search and display results
$("#typeahead_response").load("<%=search_ahead_bodies_url%>?query="+encodeURI(this.value), function() {
$("#authority_preview").hide(); // Hide the preview, since results have changed
});
}));
// We're using the existing body list: we intercept the clicks on the titles to
// display a preview on the right hand side of the screen
$("#typeahead_response .head a").live('click', function() {
$("#authority_preview").load(this.href+" #public_body_show", function() {
$("#authority_preview").show();
$(window).scrollTop($("#banner").height());
$("#authority_preview #header_right").hide();
});
return false;
});
});
</script>
<% @title = _("Select the authority to write to") %>
<h1 style="clear: left"><%= _('1. Select an authority') %></h1>
<div id="authority_selection">
<%= form_tag({:controller => "request", :action => "select_authority"}, {:id => "search_form", :method => "get"}) do %>
<div>
<p>
<%= _('First, type in the <strong>name of the UK public authority</strong> you\'d
like information from. <strong>By law, they have to respond</strong>
(<a href="{{url}}">why?</a>).', :url => (help_about_path + "#whybother_them").html_safe) %>
</p>
<%= text_field_tag 'query', params[:query], { :size => 30, :title => "type your search term here" } %>
<%= hidden_field_tag 'bodies', 1 %>
<%= submit_tag _('Search') %>
</div>
<% end %>
<div id="typeahead_response">
<%= render :partial => 'public_body/search_ahead' %>
</div>
</div>
<div id="authority_preview">
</div>
|