aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2010-10-04 01:42:47 +0100
committerFrancis Irving <francis@mysociety.org>2010-10-04 01:42:47 +0100
commite86c8fbc7a3f18e31ef751236b5ba439b33eafb6 (patch)
tree33436dff766a19e80709ae3d3e0773bcd8d18ed1
parent9870707e24a4dd5d1c931256d6e85ee042e540fc (diff)
Option to set body without setting salutation.
-rw-r--r--app/controllers/request_controller.rb1
-rw-r--r--app/models/outgoing_message.rb7
-rw-r--r--app/views/help/api.rhtml5
3 files changed, 11 insertions, 2 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 49b19ba37..67fcf41ba 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -196,6 +196,7 @@ class RequestController < ApplicationController
params[:info_request_id] = @info_request.id
params[:outgoing_message] = {} if !params[:outgoing_message]
params[:outgoing_message][:body] = params[:body] if params[:body]
+ params[:outgoing_message][:default_letter] = params[:default_letter] if params[:default_letter]
params[:outgoing_message][:info_request] = @info_request
@outgoing_message = OutgoingMessage.new(params[:outgoing_message])
@outgoing_message.set_signature_name(@user.name) if !@user.nil?
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index aff4f5a76..6f6ce811e 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -39,6 +39,9 @@ class OutgoingMessage < ActiveRecord::Base
# contact address changed
has_many :info_request_events
+ # To override the default letter
+ attr_accessor :default_letter
+
# reindex if body text is edited (e.g. by admin interface)
after_update :xapian_reindex_after_update
def xapian_reindex_after_update
@@ -70,6 +73,10 @@ class OutgoingMessage < ActiveRecord::Base
return "GIVE DETAILS ABOUT YOUR COMPLAINT HERE"
end
def get_default_letter
+ if self.default_letter
+ return self.default_letter
+ end
+
if self.what_doing == 'internal_review'
"Please pass this on to the person who conducts Freedom of Information reviews." +
"\n\n" +
diff --git a/app/views/help/api.rhtml b/app/views/help/api.rhtml
index e0fa25151..af4740d65 100644
--- a/app/views/help/api.rhtml
+++ b/app/views/help/api.rhtml
@@ -15,8 +15,9 @@ adding lots of things that are similar in use to an API as they are requested.
These are the parameters you can add to those URLs, either in the URL or from a form.
<ul>
- <li> <strong>title</strong> - default summary </li>
- <li> <strong>body</strong> - default text of request </li>
+ <li> <strong>title</strong> - default summary of the new request.</li>
+ <li> <strong>default_letter</strong> - default text of the body of the letter. The salutation (Dear...) and signoff (Yours...) are wrapped round this. </li>
+ <li> <strong>body</strong> - as an alternative to default_letter, this sets the default entire text of the request, so you can customise the salutation and signoff. </li>
<li> <strong>tags</strong> - space separated list of tags, so you can find and link up any requests made later, e.g. <em>openlylocal spending_id:12345</em>. The : indicates it is a machine tag. The values of machine tags may also include colons, useful for URIs.
</ul>