diff options
Diffstat (limited to 'app/views/request/new.html.erb')
-rw-r--r-- | app/views/request/new.html.erb | 142 |
1 files changed, 91 insertions, 51 deletions
diff --git a/app/views/request/new.html.erb b/app/views/request/new.html.erb index 849a94216..7f1332464 100644 --- a/app/views/request/new.html.erb +++ b/app/views/request/new.html.erb @@ -1,23 +1,27 @@ -<script type="text/javascript"> - $(document).ready(function(){ - // 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), 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> - -<% @title = _("Make an {{law_used_short}} request to '{{public_body_name}}'",:law_used_short=>h(@info_request.law_used_short),:public_body_name=>h(@info_request.public_body.name)) %> - +<% unless @batch %> + <script type="text/javascript"> + $(document).ready(function(){ + // 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), 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> +<% end %> +<% if @batch %> + <% @title = _("Make an {{law_used_short}} request", :law_used_short=>h(@info_request.law_used_short)) %> +<% else %> + <% @title = _("Make an {{law_used_short}} request to '{{public_body_name}}'",:law_used_short=>h(@info_request.law_used_short),:public_body_name=>h(@info_request.public_body.name)) %> +<% end %> <h1><%= _('2. Ask for Information') %></h1> <% if @existing_request %> @@ -29,53 +33,82 @@ </li> </ul></div> <% end %> + <% if @existing_batch %> + <div class="errorExplanation" id="errorExplanation"><ul> + <li> + <%= _('You already created the same batch of requests on {{date}}. You can either view the <a href="{{existing_batch}}">existing batch</a>, or edit the details below to make a new but similar batch of requests.', :date=>simple_date(@existing_batch.created_at), :existing_batch=>info_request_batch_path(@existing_batch)) %> + </li> + </ul></div> + <% end %> <%= foi_error_messages_for :info_request, :outgoing_message %> - <%= form_for(@info_request, :url => new_request_path, :html => { :id => 'write_form' } ) do |f| %> + <%= form_for(@info_request, :url => (@batch ? new_batch_path : new_request_path), :html => { :id => 'write_form' } ) do |f| %> <div id="request_header"> <div id="request_header_body"> <label class="form_label"><%= _('To:') %></label> - <span id="to_public_body"><%=h(@info_request.public_body.name)%></span> - <div class="form_item_note"> - <% if @info_request.public_body.info_requests.size > 0 %> - <%= _("Browse <a href='{{url}}'>other requests</a> to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_path(@info_request.public_body)) %> - <% else %> - <%= _("Browse <a href='{{url}}'>other requests</a> for examples of how to word your request.", :url=>request_list_url) %> - <% end %> - </div> - <% if @info_request.public_body.has_notes? %> - <div id="request_header_text"> - <h3><%= _('Special note for this authority!') %></h3> - <p><%= @info_request.public_body.notes_as_html.html_safe %></p> - </div> + <% if @batch %> + <span id="to_public_body"> + <%= _("Your selected authorities") %> + <span class="batch_public_body_toggle" data-hidetext="<%= _("(hide)") %>" data-showtext="<%= _("(show)") %>"><a class="toggle-message"></a></span> + </span> + + <div class="batch_public_body_list"> + <ul> + <% @public_bodies.each do |public_body| %> + <li><%= public_body.name %></li> + <% end %> + </ul> + </div> + + <% else %> + <span id="to_public_body"> + <%=h(@info_request.public_body.name)%> + </span> <% end %> - <% if @info_request.public_body.eir_only? %> - <h3><%= _('Please ask for environmental information only') %></h3> + <% unless @batch %> + <div class="form_item_note"> + <% if @info_request.public_body.info_requests.size > 0 %> + <%= _("Browse <a href='{{url}}'>other requests</a> to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_path(@info_request.public_body)) %> + <% else %> + <%= _("Browse <a href='{{url}}'>other requests</a> for examples of how to word your request.", :url=>request_list_url) %> + <% end %> + </div> + + <% if @info_request.public_body.has_notes? %> + <div id="request_header_text"> + <h3><%= _('Special note for this authority!') %></h3> + <p><%= @info_request.public_body.notes_as_html.html_safe %></p> + </div> + <% end %> + + <% if @info_request.public_body.eir_only? %> + <h3><%= _('Please ask for environmental information only') %></h3> - <p><%= _('The Freedom of Information Act <strong>does not apply</strong> to') %> <%=h(@info_request.public_body.name)%>. - <%= _('However, you have the right to request environmental + <p><%= _('The Freedom of Information Act <strong>does not apply</strong> to') %> <%=h(@info_request.public_body.name)%>. + <%= _('However, you have the right to request environmental information under a different law') %> (<a href="/help/requesting#eir">explanation</a>). - <%= _('This covers a very wide spectrum of information about the state of + <%= _('This covers a very wide spectrum of information about the state of the <strong>natural and built environment</strong>, such as:') %> - <ul> - <li><%= _('Air, water, soil, land, flora and fauna (including how these effect + <ul> + <li><%= _('Air, water, soil, land, flora and fauna (including how these effect human beings)') %></li> - <li><%= _('Information on emissions and discharges (e.g. noise, energy, + <li><%= _('Information on emissions and discharges (e.g. noise, energy, radiation, waste materials)') %></li> - <li><%= _('Human health and safety') %></li> - <li><%= _('Cultural sites and built structures (as they may be affected by the + <li><%= _('Human health and safety') %></li> + <li><%= _('Cultural sites and built structures (as they may be affected by the environmental factors listed above)') %></li> - <li><%= _('Plans and administrative measures that affect these matters') %></li> - </ul> + <li><%= _('Plans and administrative measures that affect these matters') %></li> + </ul> - <p><%= _('Please only request information that comes under those categories, <strong>do not waste your + <p><%= _('Please only request information that comes under those categories, <strong>do not waste your time</strong> or the time of the public authority by requesting unrelated information.') %></p> - <% end %> + <% end %> + <% end %> </div> <div id="request_header_subject"> @@ -132,7 +165,13 @@ </p> <div class="form_button"> - <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> + <% if @batch %> + <% params[:public_body_ids].each do |public_body_id| %> + <%= hidden_field_tag("public_body_ids[]", public_body_id)%> + <% end %> + <% else %> + <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> + <% end %> <%= hidden_field_tag(:submitted_new_request, 1 ) %> <%= hidden_field_tag(:preview, 1 ) %> <%= submit_tag _("Preview your public request") %> @@ -150,5 +189,6 @@ </div> <% end %> - - +<% if @batch %> + <%= javascript_include_tag 'new-request.js' %> +<% end %> |