aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/general/frontpage.rhtml
blob: 0ddb14a459f226409e653a79fd165f8f776f9076 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<%= 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/list/department">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 authority 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 authorities 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/list/department">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>
    <%= render :partial => 'request/request_listing', :locals => { :info_requests => @info_requests } %>
    <p><%=link_to "View more successful requests", search_url(:query => 'status:successful OR status:partially_successful', :sortby => 'newest') %></p>
    <% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %>
       <p>
           <%= text_field_tag 'query', params[:query], { :size => 20 } %>
           <%= submit_tag "Search" %>
       </p>
    <% end %>
</div>