diff options
Diffstat (limited to 'app/views/general/frontpage.rhtml')
-rw-r--r-- | app/views/general/frontpage.rhtml | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml new file mode 100644 index 000000000..e3fb54ca8 --- /dev/null +++ b/app/views/general/frontpage.rhtml @@ -0,0 +1,69 @@ +<%= render :partial => 'help/alpha_notice' %> + +<div id="make_requests"> + <h1>Make requests for information from the UK Government</h1> + + <% if @public_bodies.size == 0 and @query_made %> + <div id="error"> + Sorry! We couldn't find any public bodies with that in their names. + Either <a href="/body">browse them all</a> or + <a href="/help/contact">ask us to add the one you want</a>. + </div> + <% end %> + + <% form_tag({:action => :frontpage}, :method => 'get', :id => 'public_body_form', :class => 'plaque' ) do %> + <p> + <label for="public_body_query">Find the public body you would like information from:</label> + </p> + + <!-- Autocomplete field, which submits form when user picks entry --> + <div> + <%= text_field_with_auto_complete 'public_body', 'query', {}, { :skip_style => true, :frequency => 0.1, + :after_update_element => + "function(element,value) { + parent.window.location = '/?public_body[query]=' + element.value + }" + } %> + </div> + <div class="public_body_search_note"> + Type to search e.g. Health, Business, Scotland + </div> + + <!-- Show search button if javascript isn't there --> + <p id="public_body_query_button"> + <%= submit_tag "Search" %> + </p> + <script type="text/javascript"> + Element.toggle('public_body_query_button') + </script> + + <% if @public_bodies.size > 0 %> + <div id="public_body_search"> + <ul> + <strong>Public bodies found</strong> + <% for public_body in @public_bodies %> + <li> + <%= link_to h(public_body.name), new_request_to_body_url(:public_body_id => public_body.id.to_s) %> + </li> + <% end %> + </ul> + </div> + <% end %> + + <p> + Can't find it? <a href="/body">Browse all</a> or <a href="/help/contact">ask us to add it</a>. + </p> + <% end %> +</div> + +<div id="find_information"> + <h1>Explore information that others requested</h1> + <% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %> + <p> + <%= text_field_tag 'query', params[:query], { :size => 20 } %> + <%= submit_tag "Search" %> + </p> + <% end %> + <%= render :partial => 'request/request_listing', :locals => { :info_requests => @info_requests } %> + <p><a href="/list">View all information</a></p> +</div> |