diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/layouts/default.rhtml | 5 | ||||
-rw-r--r-- | app/views/public_body/_search_ahead.rhtml | 18 | ||||
-rw-r--r-- | app/views/public_body/show.rhtml | 3 | ||||
-rw-r--r-- | app/views/request/select_authority.rhtml | 49 |
4 files changed, 72 insertions, 3 deletions
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index a14dfcf8e..97462fc91 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -80,11 +80,12 @@ <%= submit_tag _("Search") %> </p> <% end %> - </div> + <div id="topnav"> <ul id="navigation"> - <li><%= link_to _("Make request"), frontpage_url %></li> + <li><%= link_to _("Home"), frontpage_url %></li> + <li><%= link_to _("Make request"), select_authority_url %></li> <li><%= link_to _("View requests"), request_list_successful_url %></li> <li><%= link_to _("View authorities"), list_public_bodies_default %></li> <% if @user %> diff --git a/app/views/public_body/_search_ahead.rhtml b/app/views/public_body/_search_ahead.rhtml new file mode 100644 index 000000000..19c7eb4e8 --- /dev/null +++ b/app/views/public_body/_search_ahead.rhtml @@ -0,0 +1,18 @@ +<p> + <% if @xapian_requests.results.size > 0 %> + <h3><%= _('Top search results:') %></h3> + <p> + <%= _('Select one to see more information about the authority.')%> + </p> + <% else %> + <h3><%= _('No results found.') %></h3> + <% end %> + <div id="authority_search_ahead_results"> + <% for result in @xapian_requests.results %> + <%= render :partial => 'body_listing_single', :locals => { :public_body => result[:model] } %> + <% end %> + </div> +</p> + + + diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index 3d325e2b8..78a326d72 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -21,6 +21,7 @@ <%= link_to _('View FOI email address'), view_public_body_email_url(@public_body.url_name) %><br> </div> +<div id="main_content"> <h1><%=h(@public_body.name)%></h1> <p class="subtitle"> @@ -99,4 +100,4 @@ <% end %> <p> <%= _('The search index is currently offline, so we can\'t show the Freedom of Information requests that have been made to this authority.')%></p> <% end %> - +</div> diff --git a/app/views/request/select_authority.rhtml b/app/views/request/select_authority.rhtml new file mode 100644 index 000000000..024cc162f --- /dev/null +++ b/app/views/request/select_authority.rhtml @@ -0,0 +1,49 @@ +<script type="text/javascript" src="/javascripts/ba-throttle-debounce.js"></script> +<script> + $(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%>?q="+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 a").click(function() { + $("#authority_preview").load(this.href+" #main_content", function() { + $("#authority_preview").show(); + }); + return false; + }); + }); + })); + }); +</script> + +<% @title = _("Select the authority to write to") %> + + <h1 style="clear: left"><%= _('1. Select an authority') %></h1> + + <div> + <% form_tag({:controller => "general", :action => "search_redirect"}, {:id => "search_form"}) do %> + <p> + <p> + <%= _('First, type in the <strong>name of the UK public authority</strong> you\'d + <br>like information from. <strong>By law, they have to respond</strong> + (<a href="{{url}}">why?</a>).', :url=>help_about_url) %> + </p> + <%= text_field_tag 'query', params[:query], { :size => 30 } %> + <%= hidden_field_tag 'bodies', 1 %> + <%= submit_tag _('Search') %> + </p> + <% end %> + <div id="typeahead_response"> + </div> + </div> + + <div id="authority_preview"> + </div> +
\ No newline at end of file |