diff options
Diffstat (limited to 'app')
22 files changed, 487 insertions, 17 deletions
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb index 196616ed6..753208c9a 100644 --- a/app/controllers/admin_general_controller.rb +++ b/app/controllers/admin_general_controller.rb @@ -27,13 +27,16 @@ class AdminGeneralController < AdminController @comment_count = Comment.count # Tasks to do - @requires_admin_requests = InfoRequest.find(:all, :select => '*, ' + InfoRequest.last_event_time_clause + ' as last_event_time', :conditions => ["described_state = 'requires_admin'"], :order => "last_event_time") - @error_message_requests = InfoRequest.find(:all, :select => '*, ' + InfoRequest.last_event_time_clause + ' as last_event_time', :conditions => ["described_state = 'error_message'"], :order => "last_event_time") - @attention_requests = InfoRequest.find(:all, :select => '*, ' + InfoRequest.last_event_time_clause + ' as last_event_time', :conditions => ["described_state = 'attention_requested'"], :order => "last_event_time") - @blank_contacts = PublicBody.find(:all, :conditions => ["request_email = ''"], :order => "updated_at") + @requires_admin_requests = InfoRequest.find_in_state('requires_admin') + @error_message_requests = InfoRequest.find_in_state('error_message') + @attention_requests = InfoRequest.find_in_state('attention_requested') + @blank_contacts = PublicBody.find(:all, :conditions => ["request_email = ''"], + :order => "updated_at") @old_unclassified = InfoRequest.find_old_unclassified(:limit => 20, - :conditions => ["prominence = 'normal'"]) + :conditions => ["prominence = 'normal'"]) @holding_pen_messages = InfoRequest.holding_pen_request.incoming_messages + @new_body_requests = PublicBodyChangeRequest.new_body_requests.open + @body_update_requests = PublicBodyChangeRequest.body_update_requests.open end def timeline diff --git a/app/controllers/admin_public_body_change_requests_controller.rb b/app/controllers/admin_public_body_change_requests_controller.rb new file mode 100644 index 000000000..d76cdc0e5 --- /dev/null +++ b/app/controllers/admin_public_body_change_requests_controller.rb @@ -0,0 +1,15 @@ +class AdminPublicBodyChangeRequestsController < AdminController + + def edit + @change_request = PublicBodyChangeRequest.find(params[:id]) + end + + def update + @change_request = PublicBodyChangeRequest.find(params[:id]) + @change_request.close! + @change_request.send_response(params[:subject], params[:response]) + flash[:notice] = 'The change request has been closed and the user has been notified' + redirect_to admin_general_index_path + end + +end diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb index 88e275960..120419a27 100644 --- a/app/controllers/admin_public_body_controller.rb +++ b/app/controllers/admin_public_body_controller.rb @@ -85,14 +85,33 @@ class AdminPublicBodyController < AdminController def new @public_body = PublicBody.new - render + if params[:change_request_id] + @change_request = PublicBodyChangeRequest.find(params[:change_request_id]) + end + if @change_request + @change_request_user_response = render_to_string(:template => "admin_public_body_change_requests/add_accepted", + :formats => [:txt]) + @public_body.name = @change_request.public_body_name + @public_body.request_email = @change_request.public_body_email + @public_body.last_edit_comment = @change_request.comment_for_public_body + end + render :formats => [:html] end def create I18n.with_locale(I18n.default_locale) do + if params[:change_request_id] + @change_request = PublicBodyChangeRequest.find(params[:change_request_id]) + end params[:public_body][:last_edit_editor] = admin_current_user() @public_body = PublicBody.new(params[:public_body]) if @public_body.save + if @change_request + response_text = params[:response].gsub(_("[Authority URL will be inserted here]"), + public_body_url(@public_body, :only_path => false)) + @change_request.close! + @change_request.send_response(params[:subject], response_text) + end flash[:notice] = 'PublicBody was successfully created.' redirect_to admin_body_show_url(@public_body) else @@ -103,15 +122,32 @@ class AdminPublicBodyController < AdminController def edit @public_body = PublicBody.find(params[:id]) - @public_body.last_edit_comment = "" - render + if params[:change_request_id] + @change_request = PublicBodyChangeRequest.find(params[:change_request_id]) + end + if @change_request + @change_request_user_response = render_to_string(:template => "admin_public_body_change_requests/update_accepted", + :formats => [:txt]) + @public_body.request_email = @change_request.public_body_email + @public_body.last_edit_comment = @change_request.comment_for_public_body + else + @public_body.last_edit_comment = "" + end + render :formats => [:html] end def update + if params[:change_request_id] + @change_request = PublicBodyChangeRequest.find(params[:change_request_id]) + end I18n.with_locale(I18n.default_locale) do params[:public_body][:last_edit_editor] = admin_current_user() @public_body = PublicBody.find(params[:id]) if @public_body.update_attributes(params[:public_body]) + if @change_request + @change_request.close! + @change_request.send_response(params[:subject], params[:response]) + end flash[:notice] = 'PublicBody was successfully updated.' redirect_to admin_body_show_url(@public_body) else diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 2f5f51c0f..fc291d998 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -279,7 +279,8 @@ class AdminRequestController < AdminController if ! info_request.is_external? ContactMailer.from_admin_message( - info_request.user, + info_request.user.name, + info_request.user.email, subject, params[:explanation].strip.html_safe ).deliver diff --git a/app/controllers/public_body_change_requests_controller.rb b/app/controllers/public_body_change_requests_controller.rb new file mode 100644 index 000000000..4a6c5f5cb --- /dev/null +++ b/app/controllers/public_body_change_requests_controller.rb @@ -0,0 +1,28 @@ +class PublicBodyChangeRequestsController < ApplicationController + + def create + @change_request = PublicBodyChangeRequest.from_params(params[:public_body_change_request], @user) + if @change_request.save + @change_request.send_message + flash[:notice] = @change_request.thanks_notice + redirect_to frontpage_url + return + else + render :action => 'new' + end + end + + def new + @change_request = PublicBodyChangeRequest.new + if params[:body] + @change_request.public_body = PublicBody.find_by_url_name_with_historic(params[:body]) + end + if @change_request.public_body + @title = _('Ask us to update the email address for {{public_body_name}}', + :public_body_name => @change_request.public_body.name) + else + @title = _('Ask us to add an authority') + end + + end +end diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb index 4dc49bf8b..27e04ca4b 100644 --- a/app/mailers/contact_mailer.rb +++ b/app/mailers/contact_mailer.rb @@ -34,12 +34,31 @@ class ContactMailer < ApplicationMailer end # Send message to a user from the administrator - def from_admin_message(recipient_user, subject, message) - @message, @from_user, @recipient_user = message, contact_from_name_and_email, recipient_user - + def from_admin_message(recipient_name, recipient_email, subject, message) + @message, @from_user = message, contact_from_name_and_email + @recipient_name, @recipient_email = recipient_name, recipient_email mail(:from => contact_from_name_and_email, - :to => recipient_user.name_and_email, + :to => MailHandler.address_from_name_and_email(@recipient_name, @recipient_email), :bcc => AlaveteliConfiguration::contact_email, :subject => subject) end + + # Send a request to the administrator to add an authority + def add_public_body(change_request) + @change_request = change_request + mail(:from => MailHandler.address_from_name_and_email(@change_request.get_user_name, @change_request.get_user_email), + :to => contact_from_name_and_email, + :subject => _('Add authority - {{public_body_name}}', + :public_body_name => @change_request.get_public_body_name)) + end + + # Send a request to the administrator to update an authority email address + def update_public_body_email(change_request) + @change_request = change_request + mail(:from => MailHandler.address_from_name_and_email(@change_request.get_user_name, @change_request.get_user_email), + :to => contact_from_name_and_email, + :subject => _('Update email address - {{public_body_name}}', + :public_body_name => @change_request.get_public_body_name)) + end + end diff --git a/app/models/info_request.rb b/app/models/info_request.rb index eadb66d54..def319ad4 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -1296,6 +1296,12 @@ public return [request_events, request_events_all_successful] end + def InfoRequest.find_in_state(state) + find(:all, :select => '*, ' + last_event_time_clause + ' as last_event_time', + :conditions => ["described_state = ?", state], + :order => "last_event_time") + end + private def set_defaults diff --git a/app/models/public_body_change_request.rb b/app/models/public_body_change_request.rb new file mode 100644 index 000000000..c1f395c0c --- /dev/null +++ b/app/models/public_body_change_request.rb @@ -0,0 +1,130 @@ +# == Schema Information +# +# Table name: public_body_change_requests +# +# id :integer not null, primary key +# user_email :string(255) +# user_name :string(255) +# user_id :integer +# public_body_name :text +# public_body_id :integer +# public_body_email :string(255) +# source_url :text +# notes :text +# is_open :boolean default(TRUE), not null +# created_at :datetime not null +# updated_at :datetime not null +# + +class PublicBodyChangeRequest < ActiveRecord::Base + + belongs_to :user + belongs_to :public_body + validates_presence_of :public_body_name, :message => N_("Please enter the name of the authority"), + :unless => proc{ |change_request| change_request.public_body } + validates_presence_of :user_name, :message => N_("Please enter your name"), + :unless => proc{ |change_request| change_request.user } + validates_presence_of :user_email, :message => N_("Please enter your email address"), + :unless => proc{ |change_request| change_request.user } + validate :user_email_format, :unless => proc{ |change_request| change_request.user_email.blank? } + validate :body_email_format, :unless => proc{ |change_request| change_request.public_body_email.blank? } + + scope :new_body_requests, :conditions => ['public_body_id IS NULL'], :order => 'created_at' + scope :body_update_requests, :conditions => ['public_body_id IS NOT NULL'], :order => 'created_at' + scope :open, :conditions => ['is_open = ?', true] + + def self.from_params(params, user) + change_request = new + change_request.update_from_params(params, user) + end + + def update_from_params(params, user) + if user + self.user_id = user.id + else + self.user_name = params[:user_name] + self.user_email = params[:user_email] + end + self.public_body_name = params[:public_body_name] + self.public_body_id = params[:public_body_id] + self.public_body_email = params[:public_body_email] + self.source_url = params[:source_url] + self.notes = params[:notes] + self + end + + def get_user_name + user ? user.name : user_name + end + + def get_user_email + user ? user.email : user_email + end + + def get_public_body_name + public_body ? public_body.name : public_body_name + end + + def send_message + if public_body + ContactMailer.update_public_body_email(self).deliver + else + ContactMailer.add_public_body(self).deliver + end + end + + def thanks_notice + if self.public_body + _("Your request to update the address for #{get_public_body_name} has been sent. Thank you for getting in touch! We'll get back to you soon.") + else + _("Your request to add an authority has been sent. Thank you for getting in touch! We'll get back to you soon.") + end + end + + def send_response(subject, response) + ContactMailer.from_admin_message(get_user_name, + get_user_email, + subject, + response.strip.html_safe).deliver + end + + def comment_for_public_body + comments = [_("Requested by: #{get_user_name} (#{get_user_email})")] + if !source_url.blank? + comments << _("Source URL: #{source_url}") + end + if !notes.blank? + comments << _("Notes: #{notes}") + end + comments.join("\n") + end + + def default_response_subject + if self.public_body + _("Your request to update {{public_body_name}} on {{site_name}}", :site_name => AlaveteliConfiguration::site_name, + :public_body_name => public_body.name) + else + _("Your request to add {{public_body_name}} to {{site_name}}", :site_name => AlaveteliConfiguration::site_name, + :public_body_name => public_body_name) + end + end + + def close! + self.is_open = false + self.save! + end + + private + + def body_email_format + unless MySociety::Validate.is_valid_email(self.public_body_email) + errors.add(:public_body_email, _("The authority email doesn't look like a valid address")) + end + end + + def user_email_format + unless MySociety::Validate.is_valid_email(self.user_email) + errors.add(:user_email, _("Your email doesn't look like a valid address")) + end + end +end diff --git a/app/views/admin_general/_change_request_summary.html.erb b/app/views/admin_general/_change_request_summary.html.erb new file mode 100644 index 000000000..bec49c12c --- /dev/null +++ b/app/views/admin_general/_change_request_summary.html.erb @@ -0,0 +1,60 @@ +<table class="table table-striped table-condensed"> + <tbody> + <tr> + <td> + <b>Authority</b> + </td> + <td> + <%= @change_request.get_public_body_name %> + </td> + </tr> + + <% if @change_request.public_body %> + <tr> + <td> + <b>Current address</b> + </td> + <td> + <%= @change_request.public_body.request_email %> + </td> + </tr> + <% end %> + + <tr> + <td> + <b>Suggested address</b> + </td> + <td> + <%= @change_request.public_body_email %> + </td> + </tr> + + <tr> + <td> + <b>Source</b> + </td> + <td> + <%= @change_request.source_url %> + </td> + </tr> + + <tr> + <td> + <b>Requested by</b> + </td> + <td> + <%= @change_request.get_user_name %> (<%= @change_request.get_user_email %>) + </td> + </tr> + + <tr> + <td> + <b>Requested on</b> + </td> + <td> + <%= I18n.l(@change_request.created_at, :format => "%e %B %Y %H:%M:%S") %> + (<%= "#{time_ago_in_words(@change_request.created_at)} ago" %>) + </td> + </tr> + </tbody> +</table> diff --git a/app/views/admin_general/index.html.erb b/app/views/admin_general/index.html.erb index 976860fa7..2202663be 100644 --- a/app/views/admin_general/index.html.erb +++ b/app/views/admin_general/index.html.erb @@ -174,9 +174,39 @@ </div> </div> <% end %> + + <% if @new_body_requests.size > 0 %> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle" href="#new-authorities" data-toggle="collapse" data-parent="things-to-do"><span class="label label-important"><%= @new_body_requests.size %></span><%= chevron_right %> Add new authorities</a> + </div> + <div id="new-authorities" class="accordion-body collapse"> + <% for @change_request in @new_body_requests %> + <%= render :partial => 'change_request_summary'%> + <%= link_to("Close and respond", admin_change_request_edit_path(@change_request), :class => 'btn') %> + <%= link_to("Add authority", admin_body_new_path(:change_request_id => @change_request.id), :class => 'btn btn-primary') %> + <% end %> + </div> + </div> + <% end %> + + <% if @body_update_requests.size > 0 %> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle" href="#update-authorities" data-toggle="collapse" data-parent="things-to-do"><span class="label label-important"><%= @body_update_requests.size %></span><%= chevron_right %> Update authorities</a> + </div> + <div id="update-authorities" class="accordion-body collapse"> + <% for @change_request in @body_update_requests %> + <%= render :partial => 'change_request_summary' %> + <%= link_to("Close and respond", admin_change_request_edit_path(@change_request), :class => 'btn') %> + <%= link_to("Make update", admin_body_edit_path(@change_request.public_body, :change_request_id => @change_request.id), :class => 'btn btn-primary') %> + <% end %> + </div> + </div> + <% end %> </div> -<% if @holding_pen_messages.size == 0 && @old_unclassified.size == 0 && @requires_admin_requests.size == 0 && @blank_contacts.size == 0 && @attention_requests.size == 0 %> +<% if @holding_pen_messages.size == 0 && @old_unclassified.size == 0 && @requires_admin_requests.size == 0 && @blank_contacts.size == 0 && @attention_requests.size == 0 && @new_body_requests.size == 0 && @body_update_requests.size == 0 %> <div class="row"> <div class="span12 alert alert-success"> No pending administration required. diff --git a/app/views/admin_public_body/_form.html.erb b/app/views/admin_public_body/_form.html.erb index 5a80386ec..2da13ab01 100644 --- a/app/views/admin_public_body/_form.html.erb +++ b/app/views/admin_public_body/_form.html.erb @@ -95,4 +95,8 @@ <p class="help-block">put URL or other source of new info</p> </div> </div> +<% if @change_request %> + <%= render :partial => 'admin_public_body_change_requests/response' %> + +<% end %> <!--[eoform:public_body]--> diff --git a/app/views/admin_public_body/new.html.erb b/app/views/admin_public_body/new.html.erb index 13e8238d6..24b27d7af 100644 --- a/app/views/admin_public_body/new.html.erb +++ b/app/views/admin_public_body/new.html.erb @@ -6,13 +6,15 @@ <div id="public_body_form"> <%= form_for @public_body, :as => :public_body, :url => admin_body_create_path, :html => {:class => "form form-horizontal"} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> + + <div class="form-actions"> <%= f.submit "Create", :class => "btn btn-primary" %> </div> <% end %> <div class="row"> <div class="span8 well"> - <%= link_to _('List all'), 'list' %> + <%= link_to 'List all', admin_body_list_path, :class => "btn" %> </div> </div> </div> diff --git a/app/views/admin_public_body_change_requests/_response.html.erb b/app/views/admin_public_body_change_requests/_response.html.erb new file mode 100644 index 000000000..7fda8b7f8 --- /dev/null +++ b/app/views/admin_public_body_change_requests/_response.html.erb @@ -0,0 +1,15 @@ +<h3>Response to change request (will be emailed to user):</h3> +<%= hidden_field_tag 'change_request_id', @change_request.id %> +<div class="control-group" id="change_request_user_subject"> + <label for="change_request_user_subject_field" class="control-label">Subject of email:</label> + <div class="controls"> + <%= text_field_tag "subject", (params[:subject] || @change_request.default_response_subject), {:id => "change_request_user_subject_field", :class => "span6"} %> + </div> +</div> + +<div class="control-group" id="change_request_user_response"> + <label for="change_request_user_response_field" class="control-label">Response</label> + <div class="controls"> + <%= text_area_tag "response", (params[:response] || h(@change_request_user_response)), {:id => "change_request_user_response_field", :rows => 10, :class => 'span6'} %> + </div> +</div> diff --git a/app/views/admin_public_body_change_requests/add_accepted.txt.erb b/app/views/admin_public_body_change_requests/add_accepted.txt.erb new file mode 100644 index 000000000..fb22466b0 --- /dev/null +++ b/app/views/admin_public_body_change_requests/add_accepted.txt.erb @@ -0,0 +1,9 @@ +<%= _("Dear {{user_name}},", :user_name => @change_request.get_user_name) %> + +<%= _("Thanks for your suggestion to add {{public_body_name}}. It's been added to the site here:", :public_body_name => @change_request.public_body_name) %> + +<%= _("[Authority URL will be inserted here]")%> + +<%= _("Yours,") %> + +<%= _("The {{site_name}} team.", :site_name => site_name) %> diff --git a/app/views/admin_public_body_change_requests/edit.html.erb b/app/views/admin_public_body_change_requests/edit.html.erb new file mode 100644 index 000000000..cc9c5b5d9 --- /dev/null +++ b/app/views/admin_public_body_change_requests/edit.html.erb @@ -0,0 +1,8 @@ +<h1><%=@title%></h1> + +<%= form_tag admin_change_request_update_path(@change_request), :class => "form form-horizontal" do %> + <%= render :partial => 'admin_public_body_change_requests/response'%> + <div class="form-actions"> + <%= submit_tag 'Close', :accesskey => 'c', :class => "btn btn-primary" %> + </div> +<% end %> diff --git a/app/views/admin_public_body_change_requests/update_accepted.txt.erb b/app/views/admin_public_body_change_requests/update_accepted.txt.erb new file mode 100644 index 000000000..9c29c959b --- /dev/null +++ b/app/views/admin_public_body_change_requests/update_accepted.txt.erb @@ -0,0 +1,7 @@ +<%= _("Dear {{user_name}},", :user_name => @change_request.get_user_name) %> + +<%= _("Thanks for your suggestion to update the email address for {{public_body_name}} to {{public_body_email}}. This has now been done and any new requests will be sent to the new address.", :public_body_name => @change_request.public_body.name, :public_body_email => @change_request.public_body_email) %> + +<%= _("Yours,") %> + +<%= _("The {{site_name}} team.", :site_name => site_name) %> diff --git a/app/views/contact_mailer/add_public_body.text.erb b/app/views/contact_mailer/add_public_body.text.erb new file mode 100644 index 000000000..5baa1fa1a --- /dev/null +++ b/app/views/contact_mailer/add_public_body.text.erb @@ -0,0 +1,19 @@ +<%= _("{{user_name}} would like a new authority added to {{site_name}}", :user_name => @change_request.get_user_name, :site_name => site_name) %> + +<%= _("Authority:") %> +<%= @change_request.get_public_body_name %> + +<%= _("Email:") %> +<%= @change_request.public_body_email %> + +<%= _("Source:") %> +<%= @change_request.source_url %> + +<%= _("Notes:") %> +<%= @change_request.notes %> + +<%= _('Add the authority:') %> +<%= admin_body_new_url(:change_request_id => @change_request.id, :only_path => false ) %> + +<%= _('Close the request and respond:') %> +<%= admin_change_request_edit_url(:id => @change_request.id, :only_path => false ) %> diff --git a/app/views/contact_mailer/update_public_body_email.text.erb b/app/views/contact_mailer/update_public_body_email.text.erb new file mode 100644 index 000000000..7d5a3dae0 --- /dev/null +++ b/app/views/contact_mailer/update_public_body_email.text.erb @@ -0,0 +1,16 @@ +<%= _("{{user_name}} would like the email address for {{public_body_name}} to be updated", :user_name => @change_request.get_user_name, :public_body_name => @change_request.get_public_body_name) %> + +<%= _("Email:") %> +<%= @change_request.public_body_email %> + +<%= _("Source:") %> +<%= @change_request.source_url %> + +<%= _("Notes:") %> +<%= @change_request.notes %> + +<%= _('Update the address:') %> +<%= admin_body_edit_path(@change_request.public_body, :change_request_id => @change_request.id, :only_path => false) %> + +<%= _('Close the request and respond:') %> +<%= admin_change_request_edit_url(:id => @change_request.id, :only_path => false ) %> diff --git a/app/views/help/requesting.html.erb b/app/views/help/requesting.html.erb index e7cfdd199..9de995435 100644 --- a/app/views/help/requesting.html.erb +++ b/app/views/help/requesting.html.erb @@ -30,7 +30,7 @@ <dt id="missing_body">You're missing the public authority that I want to request from! <a href="#missing_body">#</a> </dt> <dd> - <p>Please <a href="<%= help_contact_path %>">contact us</a> with the name of the public authority and, + <p>Please <a href="<%= new_change_request_path %>">contact us</a> with the name of the public authority and, if you can find it, their contact email address for Freedom of Information requests. </p> <p>If you'd like to help add a whole category of public authority to the site, we'd love diff --git a/app/views/outgoing_mailer/initial_request.text.erb b/app/views/outgoing_mailer/initial_request.text.erb index 5c418ecc7..b0f1dc9e8 100644 --- a/app/views/outgoing_mailer/initial_request.text.erb +++ b/app/views/outgoing_mailer/initial_request.text.erb @@ -6,7 +6,7 @@ <%= @info_request.incoming_email %> <%= _('Is {{email_address}} the wrong address for {{type_of_request}} requests to {{public_body_name}}? If so, please contact us using this form:', :email_address => @info_request.public_body.request_email, :type_of_request => @info_request.law_used_full, :public_body_name => @info_request.public_body.name)%> -<%= help_contact_url %> +<%= new_change_request_url(:body => @info_request.public_body.url_name) %> <%= render :partial => 'followup_footer' %> diff --git a/app/views/public_body/show.html.erb b/app/views/public_body/show.html.erb index b35e29eea..c36396149 100644 --- a/app/views/public_body/show.html.erb +++ b/app/views/public_body/show.html.erb @@ -32,6 +32,7 @@ <% end %> <% end %> <%= link_to _('View FOI email address'), view_public_body_email_path(@public_body.url_name) %><br> + <%= link_to _("Ask us to update FOI email"), new_change_request_path(:body => @public_body.url_name) %><br> </div> <div id="header_left"> diff --git a/app/views/public_body_change_requests/new.html.erb b/app/views/public_body_change_requests/new.html.erb new file mode 100644 index 000000000..7079cd868 --- /dev/null +++ b/app/views/public_body_change_requests/new.html.erb @@ -0,0 +1,61 @@ +<h1><%= @title %></h1> +<%= foi_error_messages_for :change_request %> + <%= form_for(@change_request, :url => change_request_path) do |f| %> +<% if not @user %> + <p> + <label class="form_label" for="user_name"> + <%= _("Your name:") %> + </label> + <%= f.text_field :user_name %> + <%= _('(or <a href="{{url}}">sign in</a>)', :url => signin_path(:r => request.fullpath)) %> + </p> + + <p> + <label class="form_label" for="user_email"> + <%= ("Your email:") %> + </label> + <%= f.text_field :user_email %> + </p> +<% end %> +<% if @change_request.public_body %> + <%= f.hidden_field :public_body_id %> +<% else %> + <p> + <label class="form_label" for="public_body_name"> + <%= _("Authority:") %> + </label> + <%= f.text_field :public_body_name %> + </p> +<% end %> + <p> + <label class="form_label" for="public_body_email"> + <%= _("Authority email:") %> + </label> + <%= f.text_field :public_body_email %> + <div class="form_item_note"> + <%= _("The contact email address for FOI requests to the authority.") %> + </div> + </p> + + <p> + <label class="form_label" for="source_url"> + <%= _("Source URL:") %> + </label> + <%= f.text_field :source_url %> + <div class="form_item_note"> + <%= _("The URL where you found the email address. This field is optional, but it would help us a lot if you can provide a link to a specific page on the authority's website that gives this address, as it will make it much easier for us to check.") %> + </div> + </p> + + <p> + <label class="form_label" for="notes"> + <%= _("Notes:") %> + </label> + <%= f.text_area :notes, :rows => 10, :cols => 60 %> + </p> + + <div class="form_button"> + <%= submit_tag _("Submit request") %> + </div> + +<% end %> |