aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--app/controllers/public_body_controller.rb12
-rw-r--r--app/controllers/request_controller.rb29
-rw-r--r--app/controllers/user_controller.rb18
-rw-r--r--app/helpers/config_helper.rb4
-rw-r--r--app/models/info_request.rb7
-rw-r--r--app/models/info_request_event.rb32
-rw-r--r--app/views/general/_orglink.rhtml2
-rw-r--r--app/views/general/frontpage.rhtml2
-rw-r--r--app/views/layouts/default.rhtml33
-rw-r--r--app/views/layouts/no_chrome.rhtml39
-rw-r--r--app/views/public_body/_search_ahead.rhtml18
-rw-r--r--app/views/public_body/show.rhtml4
-rw-r--r--app/views/request/_search_ahead.rhtml13
-rw-r--r--app/views/request/new.rhtml202
-rw-r--r--app/views/request/preview.rhtml10
-rw-r--r--app/views/request/select_authority.rhtml50
-rw-r--r--app/views/user/_signin.rhtml1
-rw-r--r--app/views/user/_signup.rhtml1
-rw-r--r--app/views/user/signin_successful.rhtml9
20 files changed, 336 insertions, 154 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 6d14d0d7a..9133f701b 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -199,7 +199,9 @@ class ApplicationController < ActionController::Base
post_redirect = PostRedirect.new(:uri => request.request_uri, :post_params => params,
:reason_params => reason_params)
post_redirect.save!
- redirect_to signin_url(:token => post_redirect.token)
+ # 'modal' controls whether the sign-in form will be displayed in the typical full-blown
+ # page or on its own, useful for pop-ups
+ redirect_to signin_url(:token => post_redirect.token, :modal => params[:modal])
return false
end
return true
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index 1a46cb62f..77cede36b 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -175,5 +175,17 @@ class PublicBodyController < ApplicationController
:filename => 'all-authorities.csv',
:disposition =>'attachment', :encoding => 'utf8')
end
+
+ # Type ahead search
+ def search_typeahead
+ # Since acts_as_xapian doesn't support the Partial match flag, we work around it
+ # by making the last work a wildcard, which is quite the same
+ query = params[:q] + '*'
+
+ query = query.split(' ').join(' OR ') # XXX: HACK for OR instead of default AND!
+ @xapian_requests = perform_search([PublicBody], query, 'relevant', 'request_collapse', 5)
+
+ render :partial => "public_body/search_ahead"
+ end
end
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 10c0917c8..e3f431cc7 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -22,6 +22,21 @@ class RequestController < ApplicationController
rescue MissingSourceFile, NameError
end
+ def select_authority
+ # Check whether we force the user to sign in right at the start, or we allow her
+ # to start filling the request anonymously
+ if force_registration_on_new_request && !authenticated?(
+ :web => _("To send your FOI request"),
+ :email => _("Then you'll be allowed to send FOI requests."),
+ :email_subject => _("Confirm your email address")
+ )
+ # do nothing - as "authenticated?" has done the redirect to signin page for us
+ return
+ end
+
+ medium_cache
+ end
+
def show
medium_cache
@locale = self.locale_from_params()
@@ -66,7 +81,7 @@ class RequestController < ApplicationController
@last_info_request_event_id = @info_request.last_event_id_needing_description
@new_responses_count = @info_request.events_needing_description.select {|i| i.event_type == 'response'}.size
-1
+
# Sidebar stuff
# ... requests that have similar imporant terms
behavior_cache :tag => ['similar', @info_request.id] do
@@ -727,5 +742,17 @@ class RequestController < ApplicationController
return
end
end
+
+ # Type ahead search
+ def search_typeahead
+ # Since acts_as_xapian doesn't support the Partial match flag, we work around it
+ # by making the last work a wildcard, which is quite the same
+ query = params[:q] + '*'
+
+ query = query.split(' ').join(' OR ') # XXX: HACK for OR instead of default AND!
+ @xapian_requests = perform_search([InfoRequestEvent], query, 'relevant', 'request_collapse', 5)
+
+ render :partial => "request/search_ahead.rhtml"
+ end
end
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 6916b4456..c53529bc3 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -8,6 +8,8 @@
class UserController < ApplicationController
+ layout :select_layout
+
protect_from_forgery :only => [ :contact,
:set_profile_photo,
:signchangeemail,
@@ -106,7 +108,12 @@ class UserController < ApplicationController
session[:user_id] = @user_signin.id
session[:user_circumstance] = nil
session[:remember_me] = params[:remember_me] ? true : false
- do_post_redirect @post_redirect
+
+ if is_modal_dialog
+ render :action => 'signin_successful'
+ else
+ do_post_redirect @post_redirect
+ end
else
send_confirmation_mail @user_signin
end
@@ -504,6 +511,15 @@ class UserController < ApplicationController
private
+ def is_modal_dialog
+ (params[:modal].to_i != 0)
+ end
+
+ # when logging in through a modal iframe, don't display chrome around the content
+ def select_layout
+ is_modal_dialog ? 'no_chrome' : 'default'
+ end
+
# Decide where we are going to redirect back to after signin/signup, and record that
def work_out_post_redirect
# Redirect to front page later if nothing else specified
diff --git a/app/helpers/config_helper.rb b/app/helpers/config_helper.rb
index 80f2deed2..b0381a2f5 100644
--- a/app/helpers/config_helper.rb
+++ b/app/helpers/config_helper.rb
@@ -2,4 +2,8 @@ module ConfigHelper
def site_name
MySociety::Config.get('SITE_NAME', 'Alaveteli')
end
+
+ def force_registration_on_new_request
+ MySociety::Config.get('FORCE_REGISTRATION_ON_NEW_REQUEST', false)
+ end
end \ No newline at end of file
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 9b0f1047b..978e2cd08 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -780,8 +780,7 @@ public
# Display version of status
- def display_status
- status = self.calculate_status
+ def InfoRequest.get_status_description(status)
if status == 'waiting_classification'
_("Awaiting classification.")
elsif status == 'waiting_response'
@@ -819,6 +818,10 @@ public
end
end
+ def display_status
+ InfoRequest.get_status_description(self.calculate_status)
+ end
+
# Completely delete this request and all objects depending on it
def fully_destroy
self.track_things.each do |track_thing|
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 4003217b0..4ea89bf81 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -303,37 +303,7 @@ class InfoRequestEvent < ActiveRecord::Base
def display_status
if is_incoming_message?
status = self.calculated_state
- if !status.nil?
- if status == 'waiting_response'
- return _("Acknowledgement")
- elsif status == 'waiting_clarification'
- return _("Clarification required")
- elsif status == 'gone_postal'
- return _("Handled by post")
- elsif status == 'deadline_extended'
- return _("Deadline Extended")
- elsif status == 'wrong_response'
- return _("Wrong Response")
- elsif status == 'not_held'
- return _("Information not held")
- elsif status == 'rejected'
- return _("Refused")
- elsif status == 'partially_successful'
- return _("Some information sent")
- elsif status == 'successful'
- return _("All information sent")
- elsif status == 'internal_review'
- return _("Internal review acknowledgement")
- elsif status == 'user_withdrawn'
- return _("Withdrawn by requester")
- elsif status == 'error_message'
- return _("Delivery error")
- elsif status == 'requires_admin'
- return _("Unusual response")
- end
- raise "unknown status " + status
- end
- return "Response"
+ return status.nil? ? _("Response") : InfoRequest.get_status_description(status)
end
if is_outgoing_message?
diff --git a/app/views/general/_orglink.rhtml b/app/views/general/_orglink.rhtml
index 20d0d6ce4..7d74dbaac 100644
--- a/app/views/general/_orglink.rhtml
+++ b/app/views/general/_orglink.rhtml
@@ -1,2 +1,2 @@
<%-# Put the link to your organisation here, or leave blank -%>
-<a href="http://www.alaveteli.org">an Alaveteli site</a>
+<%= link_to image_tag('logo.png'), frontpage_url, :id=>'logo' %>
diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml
index ee88d23a1..e1cdaa52e 100644
--- a/app/views/general/frontpage.rhtml
+++ b/app/views/general/frontpage.rhtml
@@ -9,7 +9,7 @@
<div id="bighand">
Make a new <strong>Freedom of Information</strong> request
<br />
- <a href="/en/new/tgq"><%= image_tag('start-button.png') %></a>
+ <a href="/select_authority"><img alt="Start-button" src="/images/start-button.png"></a>
</div>
</div>
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml
index 91980d9d7..6ff52a3a7 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.rhtml
@@ -1,8 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="<%= I18n.locale %>">
<head>
+ <script type="text/javascript" src="/javascripts/jquery.js"></script>
<% if @profile_photo_javascript %>
- <script type="text/javascript" src="/javascripts/jquery.js"></script>
<script type="text/javascript" src="/javascripts/jquery.Jcrop.js"></script>
<script type="text/javascript" src="/javascripts/profile_photo.js"></script>
<link rel="stylesheet" href="/stylesheets/jquery.Jcrop.css" type="text/css" >
@@ -32,6 +32,8 @@
<style type="text/css">@import url("/stylesheets/ie7.css");</style>
<![endif]-->
<%= stylesheet_link_tag 'custom', :title => "Main", :rel => "stylesheet" %>
+ <!-- XXX: add conditional include -->
+ <%= stylesheet_link_tag 'jquery.fancybox-1.3.4', :rel => "stylesheet" %>
<% if @feed_autodetect %>
<% for feed in @feed_autodetect %>
@@ -53,6 +55,28 @@
</head>
<body>
+ <!-- XXX: move to a separate file -->
+ <% if force_registration_on_new_request && !@user %>
+ <%= javascript_include_tag 'jquery.fancybox-1.3.4.pack' %>
+ <script>
+ $(document).ready(function() {
+ $("#make-request-link").fancybox({
+ 'modal': false,
+ 'width': 800,
+ 'height': 500,
+ 'type': 'iframe',
+ 'href': '/en/profile/sign_in?modal=1',
+ 'onClosed': function() {
+ // modal_signin_successful variable set by modal dialog box
+ if (typeof modal_signin_successful != 'undefined' ) {
+ window.location.href = '<%= select_authority_url %>';
+ }
+ }
+ });
+ });
+ </script>
+ <% end %>
+
<% # code for popup advert for a campaign etc.
=begin
<div id="everypage" class="jshide">
@@ -93,12 +117,13 @@
<% end %>
</div>
- <%= link_to image_tag('logo.png'), frontpage_url, :id=>'logo' %>
+ <%= render :partial => 'general/orglink' %>
<div id="topnav">
<ul id="navigation">
- <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] != 'blog' %>"><%= link_to _("Make a request"), frontpage_url %></li>
- <li class="<%= 'selected' if params[:controller] == 'request' %>"><%= link_to _("View requests"), request_list_successful_url %></li>
+ <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] != 'blog' %>"><%= link_to _("Home"), frontpage_url %></li>
+ <li class="<%= 'selected' if params[:controller] == 'request' and ['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("Make a request"), select_authority_url, :id => 'make-request-link' %></li>
+ <li class="<%= 'selected' if params[:controller] == 'request' and !['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("View requests"), request_list_successful_url %></li>
<li class="<%= 'selected' if params[:controller] == 'public_body' %>"><%= link_to _("View authorities"), list_public_bodies_default %></li>
<li class="<%= 'selected' if params[:controller] == 'general' and params[:action] == 'blog' %>"><%= link_to _("Read blog"), blog_url %></li>
<li class="<%= 'selected' if params[:controller] == 'help' %>"><%= link_to _("Help"), help_about_url %></li>
diff --git a/app/views/layouts/no_chrome.rhtml b/app/views/layouts/no_chrome.rhtml
new file mode 100644
index 000000000..c314dfbd3
--- /dev/null
+++ b/app/views/layouts/no_chrome.rhtml
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="<%= I18n.locale %>">
+ <head>
+ <title>
+ <% if @title %>
+ <%=@title%> - <%= site_name %>
+ <% else %>
+ <%= site_name %> - <%= _('Make and browse Freedom of Information (FOI) requests') %>
+ <% end %>
+ </title>
+
+ <script type="text/javascript" src="/javascripts/jquery.js"></script>
+
+ <%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet" %>
+ <!--[if LT IE 7]>
+ <style type="text/css">@import url("/stylesheets/ie6.css");</style>
+ <![endif]-->
+ <!--[if LT IE 7]>
+ <style type="text/css">@import url("/stylesheets/ie6-custom.css");</style>
+ <![endif]-->
+ <%= stylesheet_link_tag 'custom', :title => "Main", :rel => "stylesheet" %>
+ </head>
+ <body>
+ <div class="entirebody">
+ <div id="content">
+ <% if flash[:notice] %>
+ <div id="notice"><%= flash[:notice] %></div>
+ <% end %>
+ <% if flash[:error] %>
+ <div id="error"><%= flash[:error] %></div>
+ <% end %>
+
+ <div id="<%= controller.controller_name + "_" + controller.action_name %>" class="controller_<%= controller.controller_name %>">
+ <%= yield :layout %>
+ </div>
+ </div>
+ </div>
+ </body>
+</html> \ No newline at end of file
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 85506a1bd..32e96294a 100644
--- a/app/views/public_body/show.rhtml
+++ b/app/views/public_body/show.rhtml
@@ -1,4 +1,5 @@
<% @title = h(@public_body.name) + " - view and make Freedom of Information requests" %>
+<div id="main_content">
<div>
<div id="header_right">
<h2><%= _('Track this authority')%></h2>
@@ -106,4 +107,5 @@
<% 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>
+</div> \ No newline at end of file
diff --git a/app/views/request/_search_ahead.rhtml b/app/views/request/_search_ahead.rhtml
new file mode 100644
index 000000000..053b10146
--- /dev/null
+++ b/app/views/request/_search_ahead.rhtml
@@ -0,0 +1,13 @@
+<p>
+ <div id="request_search_ahead_results">
+ <% if @xapian_requests.results.size > 0 %>
+ <h3>Possibly related requests:</h3>
+ <% end %>
+ <% for result in @xapian_requests.results %>
+ <%= render :partial => 'request/request_listing_short_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
+ <% end %>
+ </div>
+</p>
+
+
+
diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml
index 9538065ed..cd748b6c2 100644
--- a/app/views/request/new.rhtml
+++ b/app/views/request/new.rhtml
@@ -1,3 +1,14 @@
+<script type="text/javascript" src="/javascripts/ba-throttle-debounce.js"></script>
+<script>
+ $(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));
+ }));
+ });
+</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)) %>
<% if @existing_request %>
@@ -10,108 +21,89 @@
</ul></div>
<% end %>
-<h1>Make a new request</h1>
+ <%= foi_error_messages_for :info_request, :outgoing_message %>
-<%= foi_error_messages_for :info_request, :outgoing_message %>
+ <h1><%= _('2. Ask for Information') %></h1>
-<div id="request_advice">
- <h2><%= _('Read this before writing your {{info_request_law_used_full}} request', :info_request_law_used_full=>h(@info_request.law_used_full)) %></h2>
- <ol>
- <li>
- <% form_tag("http://www.google.co.uk/search", {:id => "search_body_website_form", :method => "get"} ) do %>
- <p>
- <%= _('First,') %>
- <% if !@info_request.public_body.publication_scheme.empty? %>
- <%= _('<strong>browse</strong> the authority\'s <a href="%s">publication scheme</a> or <strong>search</strong> their web site ...') % [@info_request.public_body.publication_scheme] %>
+ <% form_for(:info_request, @info_request, :html => { :id => 'write_form' } ) do |f| %>
+
+ <div id="request_header">
+ <p>
+ <label class="form_label" for="info_request_public_body_id"><%= _('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_url(@info_request.public_body)) %>
<% else %>
- <%= _('<strong>search</strong> the authority\'s web site ...') %>
+ <%= _("Browse <a href='{{url}}'>other requests</a> for examples of how to word your request.", :url=>request_list_url) %>
<% end %>
- <% if !@info_request.public_body.calculated_home_page.nil? %>
- <br>
- <p>
- &nbsp; &nbsp; &nbsp; &nbsp; <%= text_field_tag 'q', params[:q], { :size => 20 } %>
- <%= hidden_field_tag 'as_sitesearch', @info_request.public_body.calculated_home_page %>
- <%= submit_tag _("Search") %>
- </p>
- <% end %>
- ... <%= _('to check that the info isn\'t already published.') %>
- </p>
- <% end %>
- </li>
+ </div>
+ </p>
- <li>
- <% 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_url(@info_request.public_body)) %>
- <% else %>
- <%= _('Browse <a href="%s">other requests</a> for examples of how to word your request.') % [request_list_url] %>
+ <div id="request_header_text">
+ <% if @info_request.public_body.has_notes? %>
+ <h3><%= _('Special note for this authority!') %></h3>
+ <p><%= @info_request.public_body.notes_as_html %></p>
<% end %>
- </li>
- <li><%= _('Write your request in <strong>simple, precise language</strong>.') %></li>
- <li><%= _('Ask for <strong>specific</strong> documents or information, this site is not suitable for general enquiries.') %></li>
- <li><%= _('Keep it <strong>focused</strong>, you\'ll be more likely to get what you want (<a href="%s">why?</a>).') % [help_requesting_path + '#focused'] %></li>
- <li><%= _('This site is <strong>public</strong>. Everything you type and any response will be published.') %></li>
- </ol>
-
- <% if @info_request.public_body.has_notes? %>
- <h1><%= _('Special note for this authority!') %></h1>
- <ul>
- <li><p><%= @info_request.public_body.notes_as_html %></p></li>
- </ul>
- <% end %>
- <% if @info_request.public_body.eir_only? %>
- <h1><%= _('Please ask for environmental information only') %></h1>
-
- <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
- the <strong>natural and built environment</strong>, such as:') %>
+ <% 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
+ information under a different law') %> (<a href="/help/requesting#eir">explanation</a>).
+ <%= _('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
+ human beings)') %></li>
+ <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
+ environmental factors listed above)') %></li>
+ <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
+ time</strong> or the time of the public authority by requesting unrelated information.') %></p>
+ <% end %>
+ </div>
+
+ <p>
+ <label class="form_label" for="info_request_title"><%= _('Summary:') %></label>
+ <%= f.text_field :title, :size => 50, :id =>"typeahead_search" %>
+ </p>
+ <div class="form_item_note">
+ (<%= _("a one line summary of the information you are requesting, \n\t\t\te.g.") %>
+ <% if @info_request.law_used == 'eir' %>
+ <%= _("'Pollution levels over time for the River Tyne'") %>
+ <% else %>
+ <%= _("'Crime statistics by ward level for Wales'") %>
+ <% end %>
+ )
+ </div>
+ <div id="typeahead_response">
+ </div>
+ </div>
+
+ <div id="request_advice">
<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,
- radiation, waste materials)') %></li>
- <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>
+ <li><%= _('Write your request in <strong>simple, precise language</strong>.') %></li>
+ <li><%= _('Ask for <strong>specific</strong> documents or information, this site is not suitable for general enquiries.') %></li>
+ <li><%= _('Keep it <strong>focused</strong>, you\'ll be more likely to get what you want (<a href="%s">why?</a>).') % [help_requesting_path + '#focused'] %></li>
</ul>
+ </div>
- <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 %>
-</div>
-
-<% form_for(:info_request, @info_request, :html => { :id => 'write_form' } ) do |f| %>
-
- <div id="request_form">
- <label class="form_label" for="info_request_public_body_id"><%= _('To:') %></label>
- <span id="to_public_body"><%=h(@info_request.public_body.name)%></span>
-
- <p>
- <label class="form_label" for="info_request_title"><%= _('Summary:') %></label>
- <%= f.text_field :title, :size => 50 %>
- </p>
- <div class="form_item_note">
- (<%= _('a one line summary of the information you are requesting,
- e.g.') %>
- <% if @info_request.law_used == 'eir' %>
- <%= _("'Pollution levels over time for the River Tyne'") %>
- <% else %>
- <%= _("'Crime statistics by ward level for Wales'") %>
- <% end %>
- )
- </div>
-
- <% fields_for :outgoing_message do |o| %>
- <p>
- <label class="form_label" for="outgoing_message_body"><%= _('Your request:') %></label>
- <%= o.text_area :body, :rows => 20, :cols => 60 %>
- </p>
- <% end %>
-
+ <div id="request_form">
+ <% fields_for :outgoing_message do |o| %>
+ <p>
+ <label class="form_label" for="outgoing_message_body"><%= _('Your request:') %></label>
+ <%= o.text_area :body, :rows => 20, :cols => 60 %>
+ </p>
+ <% end %>
+
<% if !@user %>
<p class="form_note">
<%= _('Everything that you enter on this page, including <strong>your name</strong>,
@@ -127,18 +119,18 @@
this website forever (<a href="%s">why?</a>).') % [help_privacy_path+"#public_request"] %>
</p>
<% end %>
-
- <p class="form_note">
- <%= _('<strong> Can I request information about myself?</strong>
- <a href="%s">No! (Click here for details)</a>') % [help_requesting_path+"#data_protection"] %>
- </p>
-
- <div class="form_button">
- <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %>
- <%= hidden_field_tag(:submitted_new_request, 1 ) %>
- <%= hidden_field_tag(:preview, 1 ) %>
- <%= submit_tag _("Preview your public request") %>
- </div>
+
+ <p class="form_note">
+ <%= _("<strong> Can I request information about myself?</strong>\n" +
+ "\t\t\t<a href=\"%s\">No! (Click here for details)</a>") % [help_requesting_path+"#data_protection"] %>
+ </p>
+
+ <div class="form_button">
+ <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %>
+ <%= hidden_field_tag(:submitted_new_request, 1 ) %>
+ <%= hidden_field_tag(:preview, 1 ) %>
+ <%= submit_tag _("Preview your public request") %>
+ </div>
<% if !@info_request.tag_string.empty? %>
<p class="form_note">
@@ -149,8 +141,8 @@
<strong>Tags:</strong> <%=h @info_request.tag_string %>
</p>
<% end %>
-
- </div>
+
+ </div>
<% end %>
diff --git a/app/views/request/preview.rhtml b/app/views/request/preview.rhtml
index 6f6ecb2f9..45b6a3dc1 100644
--- a/app/views/request/preview.rhtml
+++ b/app/views/request/preview.rhtml
@@ -2,7 +2,7 @@
<% form_for(:info_request, @info_request, :html => { :id => 'preview_form' } ) do |f| %>
- <h1><%= _('Now preview your request') %></h1>
+ <h1><%= _('3. Now check your request') %></h1>
<ul>
<li><%= _('Check you haven\'t included any <strong>personal information</strong>.') %></li>
<li><%= _('Your name, request and any responses will appear in <strong>search engines</strong>
@@ -37,14 +37,12 @@
<%= f.hidden_field(:tag_string) %>
<%= hidden_field_tag(:submitted_new_request, 1) %>
<%= hidden_field_tag(:preview, 0 ) %>
- <%= submit_tag _("Re-edit this request"), :name => 'reedit' %>
- <%= submit_tag _("Send public ") + h(@info_request.law_used_full) + " request", :name => 'submit' %>
+ <%= submit_tag _("Edit this request"), :name => 'reedit', :id => 'reedit_button' %>
+ <%= submit_tag _("Send request"), :name => 'submit', :id => 'submit_button' %>
</p>
<% if !@info_request.tag_string.empty? %>
<p><strong><%= _('Tags:') %></strong> <%=h @info_request.tag_string %></p>
<% end %>
-<% end %>
-
-
+<% end %> \ No newline at end of file
diff --git a/app/views/request/select_authority.rhtml b/app/views/request/select_authority.rhtml
new file mode 100644
index 000000000..802fefec6
--- /dev/null
+++ b/app/views/request/select_authority.rhtml
@@ -0,0 +1,50 @@
+<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();
+ $("#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 => "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="%s">why?</a>).') % 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
diff --git a/app/views/user/_signin.rhtml b/app/views/user/_signin.rhtml
index 6baed3c25..a7cfdf28a 100644
--- a/app/views/user/_signin.rhtml
+++ b/app/views/user/_signin.rhtml
@@ -28,6 +28,7 @@
<div class="form_button">
<%= hidden_field_tag 'token', params[:token], { :id => 'signin_token' } %>
+ <%= hidden_field_tag :modal, params[:modal] %>
<%= submit_tag _('Sign in') %>
</div>
<% end %>
diff --git a/app/views/user/_signup.rhtml b/app/views/user/_signup.rhtml
index f183ac1f1..791226586 100644
--- a/app/views/user/_signup.rhtml
+++ b/app/views/user/_signup.rhtml
@@ -42,6 +42,7 @@
<div class="form_button">
<%= hidden_field_tag 'token', params[:token], { :id => 'signup_token' } %>
+ <%= hidden_field_tag :modal, params[:modal] %>
<%= submit_tag _('Sign up') %>
</div>
diff --git a/app/views/user/signin_successful.rhtml b/app/views/user/signin_successful.rhtml
new file mode 100644
index 000000000..762bfa763
--- /dev/null
+++ b/app/views/user/signin_successful.rhtml
@@ -0,0 +1,9 @@
+<%= _("You're in. <a href=\"#\" id=\"send-request\">Continue sending your request</a>") %>
+
+<script>
+ parent.modal_signin_successful = true;
+
+ $("#send-request").click(function() {
+ parent.$.fancybox.close(); return false;
+ });
+</script> \ No newline at end of file