diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-08-22 17:34:51 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-08-22 17:34:51 +0100 |
commit | e98bfd6e9ed7e6bb151d0eb5c216cad0fed6a40c (patch) | |
tree | 222e151cf7ee87a06824553b2b53b2053c8f10a4 /app | |
parent | da70b7b4f58be9d78afba9ec6045d18094ea9581 (diff) | |
parent | bc73110b230e607d4d7e5acae467790845784704 (diff) |
Merge branch 'release/0.6.3'0.6.3
Diffstat (limited to 'app')
29 files changed, 414 insertions, 254 deletions
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb index 285523e11..7bd794d23 100644 --- a/app/controllers/admin_public_body_controller.rb +++ b/app/controllers/admin_public_body_controller.rb @@ -139,48 +139,86 @@ class AdminPublicBodyController < AdminController end def import_csv - if params['commit'] == 'Dry run' - dry_run_only = true - elsif params['commit'] == 'Upload' - dry_run_only = false - else - raise "internal error, unknown button label" - end - if params[:csv_file] - csv_contents = params[:csv_file].read - else - csv_contents = session.delete(:previous_csv) - end - if !csv_contents.nil? - # Try with dry run first - en = PublicBody.import_csv(csv_contents, params[:tag], params[:tag_behaviour], true, admin_http_auth_user(), I18n.available_locales) - errors = en[0] - notes = en[1] - - if errors.size == 0 - if dry_run_only - notes.push("Dry run was successful, real run would do as above.") - session[:previous_csv] = csv_contents - else - # And if OK, with real run - en = PublicBody.import_csv(csv_contents, params[:tag], params[:tag_behaviour], false, admin_http_auth_user(), I18n.available_locales) - errors = en[0] - notes = en[1] - if errors.size != 0 - raise "dry run mismatched real run" + @notes = "" + @errors = "" + if request.post? + if params['commit'] == 'Dry run' + dry_run_only = true + elsif params['commit'] == 'Upload' + dry_run_only = false + else + raise "internal error, unknown button label" + end + # Read file from params + if params[:csv_file] + csv_contents = params[:csv_file].read + @original_csv_file = params[:csv_file].original_filename + # or from previous dry-run temporary file + elsif params[:temporary_csv_file] && params[:original_csv_file] + csv_contents = retrieve_csv_data(params[:temporary_csv_file]) + @original_csv_file = params[:original_csv_file] + end + + if !csv_contents.nil? + # Try with dry run first + errors, notes = PublicBody.import_csv(csv_contents, + params[:tag], + params[:tag_behaviour], + true, + admin_http_auth_user(), + I18n.available_locales) + + if errors.size == 0 + if dry_run_only + notes.push("Dry run was successful, real run would do as above.") + # Store the csv file for ease of performing the real run + @temporary_csv_file = store_csv_data(csv_contents) + else + # And if OK, with real run + errors, notes = PublicBody.import_csv(csv_contents, + params[:tag], + params[:tag_behaviour], + false, + admin_http_auth_user(), + I18n.available_locales) + if errors.size != 0 + raise "dry run mismatched real run" + end + notes.push("Import was successful.") end - notes.push("Import was successful.") end + @errors = errors.join("\n") + @notes = notes.join("\n") end - @errors = errors.join("\n") - @notes = notes.join("\n") - else - @errors = "" - @notes = "" end - end private + # Save the contents to a temporary file - not using Tempfile as we need + # the file to persist between requests. Return the name of the file. + def store_csv_data(csv_contents) + tempfile_name = "csv_upload-#{Time.now.strftime("%Y%m%d")}-#{SecureRandom.random_number(10000)}" + tempfile = File.new(File.join(Dir::tmpdir, tempfile_name), 'w') + tempfile.write(csv_contents) + tempfile.close + return tempfile_name + end + + # Get csv contents from the file whose name is passed, as long as the + # name is of the expected form. + # Delete the file, return the contents. + def retrieve_csv_data(tempfile_name) + if not /csv_upload-\d{8}-\d{1,5}/.match(tempfile_name) + raise "Invalid filename in upload_csv: #{tempfile_name}" + end + tempfile_path = File.join(Dir::tmpdir, tempfile_name) + if ! File.exist?(tempfile_path) + raise "Missing file in upload_csv: #{tempfile_name}" + end + csv_contents = File.read(tempfile_path) + File.delete(tempfile_path) + return csv_contents + end + end diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index fd1405319..ae4bb511a 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -28,7 +28,7 @@ class AdminRequestController < AdminController @info_request = InfoRequest.find(params[:id]) # XXX is this *really* the only way to render a template to a # variable, rather than to the response? - vars = OpenStruct.new(:name_to => @info_request.user.name, + vars = OpenStruct.new(:name_to => @info_request.user_name, :name_from => MySociety::Config.get("CONTACT_NAME", 'Alaveteli'), :info_request => @info_request, :reason => params[:reason], :info_request_url => 'http://' + MySociety::Config.get('DOMAIN') + request_url(@info_request), diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 524aa44b7..718c31e6f 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -151,8 +151,61 @@ class ApiController < ApplicationController mail = RequestMailer.create_external_response(request, body, sent_at, attachment_hashes) request.receive(mail, mail.encoded, true) end - - head :no_content + render :json => { + 'url' => make_url("request", request.url_title), + } + end + + def body_request_events + feed_type = params[:feed_type] + raise PermissionDenied.new("#{@public_body.id} != #{params[:id]}") if @public_body.id != params[:id].to_i + + @events = InfoRequestEvent.find_by_sql([ + %(select info_request_events.* + from info_requests + join info_request_events on info_requests.id = info_request_events.info_request_id + where info_requests.public_body_id = ? + and info_request_events.event_type in ( + 'sent', 'followup_sent', 'resent', 'followup_resent' + ) + order by info_request_events.created_at desc + ), @public_body.id + ]) + if feed_type == "atom" + render :template => "api/request_events.atom", :layout => false + elsif feed_type == "json" + # For the JSON feed, we take a "since" parameter that allows the client + # to restrict to events more recent than a certain other event + if params[:since_event_id] + @since_event_id = params[:since_event_id].to_i + end + @event_data = [] + @events.each do |event| + break if event.id == @since_event_id + + request = event.info_request + this_event = { + :request_id => request.id, + :event_id => event.id, + :created_at => event.created_at.iso8601, + :event_type => event.event_type, + :request_url => main_url(request_url(request)), + :request_email => request.incoming_email, + :title => request.title, + :body => event.outgoing_message.body, + + :user_name => request.user_name, + } + if request.user + this_event[:user_url] = main_url(user_url(request.user)) + end + + @event_data.push(this_event) + end + render :json => @event_data + else + raise ActiveRecord::RecordNotFound.new("Unrecognised feed type: #{feed_type}") + end end protected diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 41adf1848..11f21025c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -27,6 +27,7 @@ class ApplicationController < ActionController::Base before_filter :check_in_post_redirect before_filter :session_remember_me before_filter :set_vary_header + before_filter :set_popup_banner # scrub sensitive parameters from the logs filter_parameter_logging :password @@ -553,6 +554,9 @@ class ApplicationController < ActionController::Base return country end + def set_popup_banner + @popup_banner = render_to_string(:partial => "general/popup_banner").strip + end # URL generating functions are needed by all controllers (for redirects), # views (for links) and mailers (for use in emails), so include them into # all of all. diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 1a86333b6..01332c5ab 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -93,6 +93,14 @@ module LinkToHelper def user_link(user, cls=nil) link_to h(user.name), user_url(user), :class => cls end + def user_link_for_request(request, cls=nil) + if request.is_external? + request.external_user_name || _("Anonymous user") + else + link_to h(request.user.name), user_url(request.user), :class => cls + end + end + def user_link_absolute(user) link_to h(user.name), main_url(user_url(user)) end diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb index a477d2568..da3f49760 100644 --- a/app/models/censor_rule.rb +++ b/app/models/censor_rule.rb @@ -9,6 +9,7 @@ # public_body_id :integer # text :text not null # replacement :text not null +# regexp :boolean # last_edit_editor :string(255) not null # last_edit_comment :text not null # created_at :datetime not null @@ -28,33 +29,59 @@ class CensorRule < ActiveRecord::Base belongs_to :user belongs_to :public_body - def binary_replacement - self.text.gsub(/./, 'x') + # a flag to allow the require_user_request_or_public_body validation to be skipped + attr_accessor :allow_global + validate :require_user_request_or_public_body, :unless => proc{ |rule| rule.allow_global == true } + validate :require_valid_regexp, :if => proc{ |rule| rule.regexp? == true } + validates_presence_of :text + + named_scope :global, {:conditions => {:info_request_id => nil, + :user_id => nil, + :public_body_id => nil}} + + def require_user_request_or_public_body + if self.info_request.nil? && self.user.nil? && self.public_body.nil? + errors.add("Censor must apply to an info request a user or a body; ") + end + end + + def require_valid_regexp + begin + self.make_regexp() + rescue RegexpError => e + errors.add(:text, e.message) + end + end + + def make_regexp + return Regexp.new(self.text, Regexp::MULTILINE) end def apply_to_text!(text) if text.nil? return nil end - text.gsub!(self.text, self.replacement) + to_replace = regexp? ? self.make_regexp() : self.text + text.gsub!(to_replace, self.replacement) end + def apply_to_binary!(binary) if binary.nil? return nil end - binary.gsub!(self.text, self.binary_replacement) + to_replace = regexp? ? self.make_regexp() : self.text + binary.gsub!(to_replace){ |match| match.gsub(/./, 'x') } end - - def validate - if self.info_request.nil? && self.user.nil? && self.public_body.nil? - errors.add("Censor must apply to an info request a user or a body; ") + def for_admin_column + self.class.content_columns.each do |column| + yield(column.human_name, self.send(column.name), column.type.to_s, column.name) end end - def for_admin_column - self.class.content_columns.each do |column| - yield(column.human_name, self.send(column.name), column.type.to_s, column.name) + def is_global? + return true if (info_request_id.nil? && user_id.nil? && public_body_id.nil?) + return false end - end + end diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 593590fb8..13fc316cd 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -375,25 +375,10 @@ class IncomingMessage < ActiveRecord::Base # http://www.whatdotheyknow.com/request/common_purpose_training_graduate#incoming-774 text.gsub!(/(Mobile|Mob)([\s\/]*(Fax|Tel))*\s*:?[\s\d]*\d/, "[mobile number]") - # Specific removals # XXX remove these and turn them into censor rules in database - # http://www.whatdotheyknow.com/request/total_number_of_objects_in_the_n_6 - text.gsub!(/\*\*\*+\nPolly Tucker.*/ms, "") - # http://www.whatdotheyknow.com/request/cctv_data_retention_and_use - text.gsub!(/Andy 079.*/, "Andy [mobile number]") - # http://www.whatdotheyknow.com/request/how_do_the_pct_deal_with_retirin_113 - text.gsub!(/(Complaints and Corporate Affairs Officer)\s+Westminster Primary Care Trust.+/ms, "\\1") - # Remove WhatDoTheyKnow signup links domain = MySociety::Config.get('DOMAIN') text.gsub!(/http:\/\/#{domain}\/c\/[^\s]+/, "[WDTK login link]") - # Remove Home Office survey links - # e.g. http://www.whatdotheyknow.com/request/serious_crime_act_2007_section_7#incoming-12650 - if self.info_request.public_body.url_name == 'home_office' - text.gsub!(/Your password:-\s+[^\s]+/, '[password]') - text.gsub!(/Password=[^\s]+/, '[password]') - end - # Remove things from censor rules self.info_request.apply_censor_rules_to_text!(text) end @@ -599,7 +584,6 @@ class IncomingMessage < ActiveRecord::Base # Remove existing quoted sections folded_quoted_text = self.remove_lotus_quoting(text, 'FOLDED_QUOTED_SECTION') folded_quoted_text = IncomingMessage.remove_quoted_sections(text, "FOLDED_QUOTED_SECTION") - self.cached_main_body_text_unfolded = text self.cached_main_body_text_folded = folded_quoted_text self.save! diff --git a/app/models/info_request.rb b/app/models/info_request.rb index d09acbcf6..dfaa524b2 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -1,11 +1,10 @@ # == Schema Information -# Schema version: 114 # # Table name: info_requests # # id :integer not null, primary key # title :text not null -# user_id :integer not null +# user_id :integer # public_body_id :integer not null # created_at :datetime not null # updated_at :datetime not null @@ -17,10 +16,11 @@ # allow_new_responses_from :string(255) default("anybody"), not null # handle_rejected_responses :string(255) default("bounce"), not null # idhash :string(255) not null +# external_user_name :string(255) +# external_url :string(255) # attention_requested :boolean default(FALSE) # - require 'digest/sha1' class InfoRequest < ActiveRecord::Base @@ -104,7 +104,7 @@ class InfoRequest < ActiveRecord::Base errors.add(:described_state, "is not a valid state") if !InfoRequest.enumerate_states.include? described_state end - + # The request must either be internal, in which case it has # a foreign key reference to a User object and no external_url or external_user_name, # or else be external in which case it has no user_id but does have an external_url, @@ -120,15 +120,15 @@ class InfoRequest < ActiveRecord::Base errors.add(:external_url, "must be null for an internal request") if !external_url.nil? end end - + def is_external? !external_url.nil? end - + def user_name is_external? ? external_user_name : user.name end - + def user_name_slug if is_external? if external_user_name.nil? @@ -136,7 +136,7 @@ class InfoRequest < ActiveRecord::Base else fake_slug = external_user_name.parameterize end - public_body.url_name + "_"+fake_slug + (public_body.url_name || "") + "_" + fake_slug else user.url_name end @@ -708,10 +708,10 @@ public return self.public_body.is_followupable? end def recipient_name_and_email - return TMail::Address.address_from_name_and_email( - _("{{law_used}} requests at {{public_body}}", - :law_used => self.law_used_short, - :public_body => self.public_body.short_or_long_name), + return TMail::Address.address_from_name_and_email( + _("{{law_used}} requests at {{public_body}}", + :law_used => self.law_used_short, + :public_body => self.public_body.short_or_long_name), self.recipient_email).to_s end @@ -995,27 +995,28 @@ public return ret.reverse end + # Get the list of censor rules that apply to this request + def applicable_censor_rules + applicable_rules = [self.censor_rules, self.public_body.censor_rules, CensorRule.global.all] + if self.user && !self.user.censor_rules.empty? + applicable_rules << self.user.censor_rules + end + return applicable_rules.flatten + end + # Call groups of censor rules def apply_censor_rules_to_text!(text) - for censor_rule in self.censor_rules + self.applicable_censor_rules.each do |censor_rule| censor_rule.apply_to_text!(text) end - if self.user # requests during construction have no user - for censor_rule in self.user.censor_rules - censor_rule.apply_to_text!(text) - end - end + return text end def apply_censor_rules_to_binary!(binary) - for censor_rule in self.censor_rules + self.applicable_censor_rules.each do |censor_rule| censor_rule.apply_to_binary!(binary) end - if self.user # requests during construction have no user - for censor_rule in self.user.censor_rules - censor_rule.apply_to_binary!(binary) - end - end + return binary end def is_owning_user?(user) diff --git a/app/models/public_body.rb b/app/models/public_body.rb index bc8f084bb..60ecb2781 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -1,5 +1,5 @@ +# -*- coding: utf-8 -*- # == Schema Information -# Schema version: 114 # # Table name: public_bodies # @@ -19,7 +19,6 @@ # publication_scheme :text default(""), not null # api_key :string(255) not null # - # models/public_body.rb: # A public body, from which information can be requested. # @@ -43,6 +42,7 @@ class PublicBody < ActiveRecord::Base has_many :info_requests, :order => 'created_at desc' has_many :track_things, :order => 'created_at desc' + has_many :censor_rules, :order => 'created_at desc' has_tag_string @@ -93,8 +93,9 @@ class PublicBody < ActiveRecord::Base # Make sure publication_scheme gets the correct default value. # (This would work automatically, were publication_scheme not a translated attribute) self.publication_scheme = "" if self.publication_scheme.nil? - - # Set an API key if there isn’t one + end + + def before_save self.api_key = SecureRandom.base64(33) if self.api_key.nil? end @@ -583,5 +584,3 @@ class PublicBody < ActiveRecord::Base end end - - diff --git a/app/models/user.rb b/app/models/user.rb index a21676f68..657ea2a4a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,5 +1,4 @@ # == Schema Information -# Schema version: 114 # # Table name: users # @@ -21,9 +20,7 @@ # email_bounce_message :text default(""), not null # no_limit :boolean default(FALSE), not null # receive_email_alerts :boolean default(TRUE), not null -# user_similarity_id :integer # - # models/user.rb: # Model of people who use the site to file requests, make comments etc. # diff --git a/app/views/admin_censor_rule/_form.rhtml b/app/views/admin_censor_rule/_form.rhtml index d077afd9a..ac43de704 100644 --- a/app/views/admin_censor_rule/_form.rhtml +++ b/app/views/admin_censor_rule/_form.rhtml @@ -11,6 +11,9 @@ <% end %> </p> +<p><label for="censor_rule_regexp">Is it regexp replacement?</label> (Leave unchecked if you are not sure about this)<br/> +<%= check_box 'censor_rule', 'regexp' %></p> + <p><label for="censor_rule_text">Text</label> (that you want to remove, case sensitive)<br/> <%= text_field 'censor_rule', 'text', :size => 60 %></p> @@ -21,9 +24,9 @@ <%= text_area 'censor_rule', 'last_edit_comment', :rows => 2, :cols => 60 %></p> <p><strong>Warning and notes:</strong> This does replace text in binary files, but for -most formats only in a naive way. It works well on surprisingly many Word documents. Notably -it doesn't even do UCS-2 (unicode sometimes used in Word). There is also special code -which works on some PDFs. Please <strong>carefully check</strong> all attachments have +most formats only in a naive way. It works well on surprisingly many Word documents. Notably +it doesn't even do UCS-2 (unicode sometimes used in Word). There is also special code +which works on some PDFs. Please <strong>carefully check</strong> all attachments have changed in the way you expect, and haven't become corrupted. </p> @@ -32,4 +35,6 @@ things by individual request or by user by adding the censor rule from the appropriate page. If you need to redact across a whole authority, it will be easy enough to make code changes to add it, so do ask. </p> +<p><strong>Regexp rules that are hard to process will really slow down request display.</strong> Please only use regexps if you really need to. +</p> diff --git a/app/views/admin_public_body/import_csv.rhtml b/app/views/admin_public_body/import_csv.rhtml index d5717de23..4eb83cc7e 100644 --- a/app/views/admin_public_body/import_csv.rhtml +++ b/app/views/admin_public_body/import_csv.rhtml @@ -9,48 +9,57 @@ <pre id="error"><%=@errors %></pre> <% end %> - <% form_tag 'import_csv', :multipart => true do %> <p> - <label for="csv_file">CSV file:</label> - <%= file_field_tag :csv_file, :size => 40 %> + <% if @original_csv_file && @temporary_csv_file %> + CSV file: + <%= @original_csv_file %> + <%= hidden_field_tag :original_csv_file, @original_csv_file %> + <%= hidden_field_tag :temporary_csv_file, @temporary_csv_file %> + <%= link_to 'Clear current file', 'import_csv', :class => "btn btn-warning" %> + <% else %> + <label for="csv_file">CSV file:</label> + <%= file_field_tag :csv_file, :size => 40 %> + <% end %> </p> - + <p> <label for="tag">Optional: Tag to add entries to / alter entries for:</label> <%= text_field_tag 'tag', params[:tag] %> </p> - + <p> <label for="tag_behaviour">What to do with existing tags?</label> - <%= select_tag 'tag_behaviour', + <%= select_tag 'tag_behaviour', "<option value='add' selected>Add new tags to existing ones</option> - <option value='replace'>Replace existing tags with new ones</option>" + <option value='replace'>Replace existing tags with new ones</option>" %> </p> - <p><strong>CSV file format:</strong> A first row with the list of fields, + <p><strong>CSV file format:</strong> A first row with the list of fields, starting with '#', is optional but highly recommended. The fields 'name' and 'request_email' are required; additionally, translated values are supported by adding the locale name to the field name, e.g. 'name.es', 'name.de'... Example: </p> - + <blockquote> - #id,name,request_email,name.es,tag_string<br/> - 1,An Authority,a@example.com,Un organismo,a_tag another_tag<br/> - 2,Another One,another@example.com,Otro organismo,a_tag<br/> + <p> + #id,name,request_email,name.es,tag_string<br/> + 1,An Authority,a@example.com,Un organismo,a_tag another_tag<br/> + 2,Another One,another@example.com,Otro organismo,a_tag<br/> + <p> </blockquote> - <p>Supported fields: name (i18n), short_name (i18n), request_email (i18n), notes (i18n), + <p>Supported fields: name (i18n), short_name (i18n), request_email (i18n), notes (i18n), publication_scheme (i18n), home_page, tag_string (tags separated by spaces).</p> - + <p><strong>Note:</strong> Choose <strong>dry run</strong> to test, without actually altering the database. Choose <strong>upload</strong> to actually make the changes. In either case, you will be shown any errors, or details of the changes. When uploading, any changes since last import will be overwritten - e.g. email addresses changed back. </p> - + <p><strong>Note:</strong> The import tag will also be added to the imported bodies if no tags are provided in the CSV file or if the import mode is set to "Add new tags to existing ones". @@ -61,7 +70,7 @@ <hr> -<p>Standard tags: +<p>Standard tags: <% for category, description in PublicBodyCategories::get().by_tag() %> <% if category != "other" %> <strong><%= category %></strong>=<%= description %>; diff --git a/app/views/api/request_events.atom.builder b/app/views/api/request_events.atom.builder new file mode 100644 index 000000000..4f0133051 --- /dev/null +++ b/app/views/api/request_events.atom.builder @@ -0,0 +1,25 @@ +atom_feed("xmlns:alaveteli" => "http://www.alaveteli.org/API/v2/RequestEvents/Atom") do |feed| + feed.title("Events relating to #{@public_body.name}") + feed.updated(@events.first.created_at) + + for event in @events + feed.entry(event) do |entry| + request = event.info_request + + entry.published(event.created_at) + entry.tag!("alaveteli:event_type", event.event_type) + entry.tag!("alaveteli:request_url", main_url(request_url(request))) + entry.title(request.title) + + entry.content(event.outgoing_message.body, :type => 'text') + + entry.author do |author| + author.name(request.user_name) + if !request.user.nil? + author.uri(main_url(user_url(request.user))) + end + author.email(request.incoming_email) + end + end + end +end diff --git a/app/views/comment/new.rhtml b/app/views/comment/new.rhtml index cf9367b88..55155c8a2 100644 --- a/app/views/comment/new.rhtml +++ b/app/views/comment/new.rhtml @@ -69,6 +69,9 @@ <p> <big><%= _('Annotations will be posted publicly here, and are <strong>not</strong> sent to {{public_body_name}}.',:public_body_name=>h(@info_request.public_body.name)) %></big> + <% if @info_request.is_external? %> + <big><%= _('Note that the requester will not be notified about your annotation, because the request was published by {{public_body_name}} on their behalf.', :public_body_name => @info_request.public_body.name) %></big> + <% end %> </p> <%= render :partial => 'comment/comment_form', :locals => { :track_thing => @track_thing } %> diff --git a/app/views/general/_popup_banner.rhtml b/app/views/general/_popup_banner.rhtml new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/app/views/general/_popup_banner.rhtml @@ -0,0 +1 @@ + diff --git a/app/views/general/_stylesheet_includes.rhtml b/app/views/general/_stylesheet_includes.rhtml new file mode 100644 index 000000000..2ffa5dadf --- /dev/null +++ b/app/views/general/_stylesheet_includes.rhtml @@ -0,0 +1,21 @@ + <%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet", :media => "all" %> + <%= stylesheet_link_tag 'fonts', :rel => "stylesheet", :media => "all" %> + <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "print" %> + <% if !params[:print_stylesheet].nil? %> + <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "all" %> + <% end %> + <%= stylesheet_link_tag 'admin-theme/jquery-ui-1.8.15.custom.css', :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]--> + <!--[if LT IE 8]> + <style type="text/css">@import url("/stylesheets/ie7.css");</style> + <![endif]--> + <!-- the following method for customising CSS is deprecated; see `doc/THEMES.md` for detail --> + <%= stylesheet_link_tag 'custom', :title => "Main", :rel => "stylesheet" %> + <% if force_registration_on_new_request %> + <%= stylesheet_link_tag 'jquery.fancybox-1.3.4', :rel => "stylesheet" %> + <% end %> diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 5c3499c93..e4022661f 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -10,40 +10,19 @@ </title> <link rel="shortcut icon" href="/favicon.ico"> - <%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet", :media => "all" %> - <%= stylesheet_link_tag 'fonts', :rel => "stylesheet", :media => "all" %> - <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "print" %> - <% if !params[:print_stylesheet].nil? %> - <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "all" %> - <% end %> - <% if is_admin? %> + <%= render :partial => 'general/stylesheet_includes' %> + <% if is_admin? %> <%= stylesheet_link_tag "/adminbootstraptheme/stylesheets/admin", :title => "Main", :rel => "stylesheet" %> - <% end %> - <%= javascript_include_tag 'jquery.js', 'jquery-ui.min','jquery.cookie.js', 'general.js' %> + <% end %> + <%= javascript_include_tag 'jquery.js', 'jquery-ui.min','jquery.cookie.js', 'general.js' %> <% if @profile_photo_javascript %> <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" > <% end %> - <%= stylesheet_link_tag 'admin-theme/jquery-ui-1.8.15.custom.css', :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]--> - <!--[if LT IE 8]> - <style type="text/css">@import url("/stylesheets/ie7.css");</style> - <![endif]--> - <!-- the following method for customising CSS is deprecated; see `doc/THEMES.md` for detail --> - <%= stylesheet_link_tag 'custom', :title => "Main", :rel => "stylesheet" %> - <% if force_registration_on_new_request %> - <%= stylesheet_link_tag 'jquery.fancybox-1.3.4', :rel => "stylesheet" %> - <% end %> - <% if @feed_autodetect %> <% for feed in @feed_autodetect %> <link rel="alternate" type="application/atom+xml" title="<%=h feed[:title] %>" href="<%=h feed[:url]%>"> @@ -63,7 +42,6 @@ <%= render :partial => 'general/before_head_end' %> </head> <body class="<%= 'admin' if is_admin? %> <%= 'front' if params[:action] == 'frontpage' %>"> - <!-- XXX: move to a separate file --> <% if force_registration_on_new_request && !@user %> <%= javascript_include_tag 'jquery.fancybox-1.3.4.pack' %> <script type="text/javascript"> @@ -79,7 +57,7 @@ if (typeof modal_signin_successful != 'undefined' ) { window.location.href = '<%= select_authority_url %>'; } - } + } }); }); </script> @@ -89,20 +67,19 @@ <%= render :partial => 'admin_general/admin_navbar' %> <% end %> -<% # code for popup advert for a campaign etc. -=begin - <div id="everypage" class="jshide"> - <p style="float:right"><a href="#top" onclick="$.cookie('seen_foi2', 1, { expires: 7, path: '/' }); $('#everypage').hide('slow'); return false;">Close</a></p> - [ message goes here ] - <p style="text-align: right"><a href="#top" onclick="$.cookie('seen_foi2', 1, { expires: 7, path: '/' }); $('#everypage').hide('slow'); return false;">Close</a></p> - </div> -=end -%> +<% if !@popup_banner.blank? %> +<div id="everypage" class="jshide"> + <p style="float:right"><a href="#top" onclick="$.cookie('seen_foi2', 1, { expires: 7, path: '/' }); $('#everypage').hide('slow'); return false;"><%= _('Close') %></a></p> + <%= @popup_banner %> + <p style="text-align: right"><a href="#top" onclick="$.cookie('seen_foi2', 1, { expires: 7, path: '/' }); $('#everypage').hide('slow'); return false;"><%= _('Close') %></a></p> +</div> +<% end %> + <div class="entirebody"> <div id="banner"> <div id="banner_inner"> <div class="lang"><%= render :partial => 'general/locale_switcher' %></div> - + <% if not (controller.action_name == 'signin' or controller.action_name == 'signup') %> <div id="logged_in_bar"> <% if @user %> @@ -120,19 +97,19 @@ <%= link_to _("Sign in or sign up"), signin_url(:r => request.request_uri) %> <% end %> </div> - <% end %> + <% end %> <div id="navigation_search"> <% form_tag({:controller => "general", :action => "search_redirect"}, {:id => "navigation_search_form"}) do %> <p> <%= text_field_tag 'query', params[:query], { :size => 40, :id => "navigation_search_query" } %> - <%= image_submit_tag('search-button.png') %> + <%= submit_tag 'search', :id => "navigation_search_button" %> </p> <% end %> </div> - + <%= render :partial => 'general/orglink' %> - + <%= render :partial => 'general/topnav' %> </div> </div> @@ -163,7 +140,7 @@ </div> <% ga_code = MySociety::Config.get('GA_CODE', '') - + unless ga_code.empty? %> <script> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); @@ -173,10 +150,9 @@ var pageTracker = _gat._getTracker("<%=ga_code%>"); pageTracker._trackPageview(); </script> - + <% end %> <%= render :partial => 'general/before_body_end' %> </body> </html> - diff --git a/app/views/request/_after_actions.rhtml b/app/views/request/_after_actions.rhtml index 205b738de..02ed7c849 100644 --- a/app/views/request/_after_actions.rhtml +++ b/app/views/request/_after_actions.rhtml @@ -20,7 +20,7 @@ </div> <div id="owner_actions"> - <strong><%= _('{{info_request_user_name}} only:',:info_request_user_name=>h(@info_request.user.name)) %></strong> + <strong><%= _('{{info_request_user_name}} only:',:info_request_user_name=>h(@info_request.user_name)) %></strong> <ul> <li> diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml index 9a198ad7d..36257991b 100644 --- a/app/views/request/_correspondence.rhtml +++ b/app/views/request/_correspondence.rhtml @@ -33,7 +33,7 @@ elsif [ 'sent', 'followup_sent' ].include?(info_request_event.event_type) <div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>"> <h2> - <%= _("From:") %> <%=h @info_request.user.name %><br> + <%= _("From:") %> <%=h @info_request.user_name %><br> <br><%= simple_date(info_request_event.created_at) %> </h2> diff --git a/app/views/request/_describe_state.rhtml b/app/views/request/_describe_state.rhtml index 71699835c..5b6004e81 100644 --- a/app/views/request/_describe_state.rhtml +++ b/app/views/request/_describe_state.rhtml @@ -104,9 +104,11 @@ <% elsif @old_unclassified %> <%= render :partial => 'other_describe_state', :locals => {:id_suffix => id_suffix } %> <% else %> -<%= _('We don\'t know whether the most recent response to this request contains + <% if !@info_request.is_external? %> + <%= _('We don\'t know whether the most recent response to this request contains information or not – if you are {{user_link}} please <a href="{{url}}">sign in</a> and let everyone know.',:user_link=>user_link(@info_request.user), :url=>signin_url(:r => request.request_uri)) %> + <% end %> <% end %> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index 27ad0700e..a7760ab19 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -27,7 +27,7 @@ <div id="left_column"> <h1><%=h(@info_request.title)%></h1> - <% if @info_request.user.profile_photo %> + <% if !@info_request.is_external? && @info_request.user.profile_photo %> <p class="user_photo_on_request"> <img src="<%= get_profile_photo_url(:url_name => @info_request.user.url_name) %>" alt=""> </p> @@ -43,7 +43,7 @@ :public_body_link => public_body_link(@info_request.public_body), :public_body_admin_url => public_body_admin_url(@info_request.public_body)) %> <% else %> - <%= _('{{user}} made this {{law_used_full}} request',:user=>user_link(@info_request.user), :law_used_full=>h(@info_request.law_used_full)) %> + <%= _('{{user}} made this {{law_used_full}} request',:user=>@info_request.user.nil? ? @info_request.user_name : user_link(@info_request.user), :law_used_full=>h(@info_request.law_used_full)) %> <%= _('to {{public_body}}',:public_body=>public_body_link(@info_request.public_body)) %> <% end %> </p> @@ -61,7 +61,7 @@ <%= _('and update the status accordingly. Perhaps <strong>you</strong> might like to help out by doing that?') %> <% else %> <%= _('We\'re waiting for') %> - <%= user_link(@info_request.user) %> <%= _('to read') %> + <%= user_link_for_request(@info_request) %> <%= _('to read') %> <%= MySociety::Format.fancy_pluralize(@new_responses_count, 'a recent response', 'recent responses') %> <%= _('and update the status.') %> <% end %> @@ -104,7 +104,7 @@ <%= link_to _("send a follow up message"), respond_to_last_url(@info_request) + '#followup' %>. <% else %> <%= _('The request is <strong>waiting for clarification</strong>.') %> - <%= _('If you are {{user_link}}, please',:user_link=>user_link(@info_request.user)) %> + <%= _('If you are {{user_link}}, please',:user_link=>user_link_for_request(@info_request)) %> <%= link_to _("sign in"), signin_url(:r => request.request_uri) %> <%= _('to send a follow up message.') %> <% end %> <% elsif @status == 'gone_postal' %> diff --git a/app/views/request/show_response.rhtml b/app/views/request/show_response.rhtml index d8647d1ec..c40b37c3b 100644 --- a/app/views/request/show_response.rhtml +++ b/app/views/request/show_response.rhtml @@ -1,9 +1,9 @@ <% if @incoming_message.nil? %> - <% @title = "Send follow up to '" + h(@info_request.title) + "'" %> + <% @title = _("Send follow up to '{{title}}'", :title => h(@info_request.title)) %> <% elsif @incoming_message.recently_arrived %> - <% @title = "New response to '" + h(@info_request.title) + "'" %> + <% @title = _("New response to '{{title}}'", :title => h(@info_request.title)) %> <% else %> - <% @title = "Response to '" + h(@info_request.title) + "'" %> + <% @title = _("Response to '{{title}}'", :title => h(@info_request.title)) %> <% end %> <%= foi_error_messages_for :incoming_message, :outgoing_message %> @@ -34,11 +34,11 @@ <%= _('You want to <strong>give your postal address</strong> to the authority in private.') %> </dt> <dd> - <%= _('To do that please send a private email to ') %><%=h(@postal_email_name)%> + <%= _('To do that please send a private email to ') %><%=h(@postal_email_name)%> <<%=link_to h(@postal_email), "mailto:" + @postal_email%>> <%= _('containing your postal address, and asking them to reply to this request. Or you could phone them.') %> - + <%= _('When you receive the paper response, please help others find out what it says:') %> <ul> @@ -68,7 +68,7 @@ <h2>Response to <%=h(@info_request.law_used_short)%> request '<%= request_link @info_request %>'</h2> <% end %> <% end %> - + <% if @incoming_message.nil? %> <%= render :partial => 'correspondence', :locals => { :info_request_event => @info_request.get_last_outgoing_event, :incoming_message => nil } %> <% else %> diff --git a/app/views/request/upload_response.rhtml b/app/views/request/upload_response.rhtml index 38c3db268..0de96c5f3 100644 --- a/app/views/request/upload_response.rhtml +++ b/app/views/request/upload_response.rhtml @@ -1,45 +1,52 @@ -<% @title = "Respond to the FOI request '" + h(@info_request.title) + "' made by " + h(@info_request.user.name) %> +<% @title = "Respond to the FOI request '" + h(@info_request.title) + "' made by " + h(@info_request.user_name) %> -<%= foi_error_messages_for :comment %> +<% if @info_request.is_external? %> -<h1><%= _('Respond to the FOI request')%> '<%=request_link(@info_request)%>'<% _(' made by ')%><%=user_link(@info_request.user) %></h1> + <h1><%= _('This request was not made via {{site_name}}', :site_name => site_name) %></h1> + <p><%= _('Sorry - you cannot respond to this request via {{site_name}}, because this is a copy of the request originally at {{link_to_original_request}}.', :site_name => site_name, :link_to_original_request => link_to(@info_request.external_url, @info_request.external_url)) %></p> -<p> - <%= _('Your response will <strong>appear on the Internet</strong>, <a href="%s">read why</a> and answers to other questions.')% [help_officers_path] %> -</p> +<% else %> -<h2><%= _('Respond by email')%></h2> + <%= foi_error_messages_for :comment %> -<p><%= _('You should have received a copy of the request by email, and you can respond -by <strong>simply replying</strong> to that email. For your convenience, here is the address:')%> -<a href="mailto:<%=h @info_request.incoming_email%>"><%=h @info_request.incoming_email%></a>. -<%= _('You may <strong>include attachments</strong>. If you would like to attach a -file too large for email, use the form below.')%> -</p> + <h1><%= _('Respond to the FOI request')%> '<%=request_link(@info_request)%>'<% _(' made by ')%><%=user_link(@info_request.user) %></h1> + <p> + <%= _('Your response will <strong>appear on the Internet</strong>, <a href="%s">read why</a> and answers to other questions.')% [help_officers_path] %> + </p> -<h2><%= _('Respond using the web')%></h2> + <h2><%= _('Respond by email')%></h2> -<p><%= _('Enter your response below. You may attach one file (use email, or -<a href="%s">contact us</a> if you need more).')% [help_contact_path] %></p> + <p><%= _('You should have received a copy of the request by email, and you can respond + by <strong>simply replying</strong> to that email. For your convenience, here is the address:')%> + <a href="mailto:<%=h @info_request.incoming_email%>"><%=h @info_request.incoming_email%></a>. + <%= _('You may <strong>include attachments</strong>. If you would like to attach a + file too large for email, use the form below.')%> + </p> -<% form_tag '', :id => 'upload_response_form', :multipart => true do %> - <p> - <label class="form_label" for="body"><% _('Response:')%></label> - <%= text_area_tag :body, "", :rows => 10, :cols => 55 %> - </p> - <p> - <label class="form_label" for="file_1"><% _('Attachment (optional):')%></label> - <%= file_field_tag :file_1, :size => 35 %> - </p> + <h2><%= _('Respond using the web')%></h2> - <p> - <%= hidden_field_tag 'submitted_upload_response', 1 %> - <%= submit_tag "Upload FOI response" %> - <%= _(' (<strong>patience</strong>, especially for large files, it may take a while!)')%> - </p> + <p><%= _('Enter your response below. You may attach one file (use email, or + <a href="%s">contact us</a> if you need more).')% [help_contact_path] %></p> + <% form_tag '', :id => 'upload_response_form', :multipart => true do %> + <p> + <label class="form_label" for="body"><% _('Response:')%></label> + <%= text_area_tag :body, "", :rows => 10, :cols => 55 %> + </p> + + <p> + <label class="form_label" for="file_1"><% _('Attachment (optional):')%></label> + <%= file_field_tag :file_1, :size => 35 %> + </p> + + <p> + <%= hidden_field_tag 'submitted_upload_response', 1 %> + <%= submit_tag "Upload FOI response" %> + <%= _(' (<strong>patience</strong>, especially for large files, it may take a while!)')%> + </p> + <% end %> <% end %> diff --git a/app/views/track_mailer/event_digest.rhtml b/app/views/track_mailer/event_digest.rhtml index 089b778f8..2c2e3c957 100644 --- a/app/views/track_mailer/event_digest.rhtml +++ b/app/views/track_mailer/event_digest.rhtml @@ -18,14 +18,14 @@ # e.g. Julian Burgess sent a request to Royal Mail Group (15 May 2008) if event.event_type == 'response' url = main_url(incoming_message_url(event.incoming_message)) - main_text += _("{{public_body}} sent a response to {{user_name}}", :public_body => event.info_request.public_body.name, :user_name => event.info_request.user.name) + main_text += _("{{public_body}} sent a response to {{user_name}}", :public_body => event.info_request.public_body.name, :user_name => event.info_request.user_name) elsif event.event_type == 'followup_sent' url = main_url(outgoing_message_url(event.outgoing_message)) - main_text += _("{{user_name}} sent a follow up message to {{public_body}}", :user_name => event.info_request.user.name, :public_body => event.info_request.public_body.name) + main_text += _("{{user_name}} sent a follow up message to {{public_body}}", :user_name => event.info_request.user_name, :public_body => event.info_request.public_body.name) elsif event.event_type == 'sent' # this is unlikely to happen in real life, but happens in the test code url = main_url(outgoing_message_url(event.outgoing_message)) - main_text += _("{{user_name}} sent a request to {{public_body}}", :user_name => event.info_request.user.name, :public_body => event.info_request.public_body.name) + main_text += _("{{user_name}} sent a request to {{public_body}}", :user_name => event.info_request.user_name, :public_body => event.info_request.public_body.name) elsif event.event_type == 'comment' url = main_url(comment_url(event.comment)) main_text += _("{{user_name}} added an annotation", :user_name => event.comment.user.name) diff --git a/app/views/user/_show_user_info.rhtml b/app/views/user/_show_user_info.rhtml new file mode 100644 index 000000000..5dfecee1e --- /dev/null +++ b/app/views/user/_show_user_info.rhtml @@ -0,0 +1,20 @@ + + <% if !@display_user.get_about_me_for_html_display.empty? || @is_you %> + <div class="user_about_me"> + <img class="comment_quote" src="/images/quote.png" alt=""> + <%= @display_user.get_about_me_for_html_display %> + <% if @is_you %> + (<%= link_to _("edit text about you"), set_profile_about_me_url() %>) + <% end %> + </div> + <% end %> + + <% if @is_you %> + <p id="user_change_password_email"> + <% if @display_user.profile_photo %> + <%= link_to _('Change profile photo'), set_profile_photo_url() %> | + <% end %> + <%= link_to _('Change your password'), signchangepassword_url() %> | + <%= link_to _('Change your email'), signchangeemail_url() %> + </p> + <% end %> diff --git a/app/views/user/contact.rhtml b/app/views/user/contact.rhtml index 4bbb15789..333b72334 100644 --- a/app/views/user/contact.rhtml +++ b/app/views/user/contact.rhtml @@ -9,21 +9,21 @@ <% form_for :contact do |f| %> <div class="form_note"> - <h1>Contact <%=h @recipient_user.name%></h1> + <h1><%= _("Contact {{recipient}}", :recipient => h(@recipient_user.name)) %></h1> </div> <p> - <label class="form_label">From:</label> + <label class="form_label"><%= _("From") %>:</label> <%= h(@user.name_and_email) %> </p> <p> - <label class="form_label" for="contact_subject">Subject:</label> + <label class="form_label" for="contact_subject"><%= _("Subject") %>:</label> <%= f.text_field :subject, :size => 50 %> </p> <p> - <label class="form_label" for="contact_message">Message:</label> + <label class="form_label" for="contact_message"><%= _("Message") %>:</label> <%= f.text_area :message, :rows => 10, :cols => 50 %> </p> @@ -39,9 +39,7 @@ <div class="form_button"> <%= hidden_field_tag(:submitted_contact_form, { :value => 1 } ) %> - <%= submit_tag "Send message" %> + <%= submit_tag _("Send message") %> </div> <% end %> - - diff --git a/app/views/user/set_crop_profile_photo.rhtml b/app/views/user/set_crop_profile_photo.rhtml index db18d10a1..eed0304d2 100644 --- a/app/views/user/set_crop_profile_photo.rhtml +++ b/app/views/user/set_crop_profile_photo.rhtml @@ -20,7 +20,7 @@ <div style="width:96px;height:96px;overflow:hidden;"> <img src="<%= get_draft_profile_photo_url(:id => @draft_profile_photo.id) %>" id="profile_photo_preview" /> </div> - + </td> </tr> </table> @@ -32,12 +32,12 @@ <%= hidden_field_tag 'draft_profile_photo_id', @draft_profile_photo.id %> - <p><%= _('<strong>Privacy note:</strong> Your photo will be shown in public on the Internet, + <p><%= _('<strong>Privacy note:</strong> Your photo will be shown in public on the Internet, wherever you do something on {{site_name}}.', :site_name=>site_name)%> <p> <%= hidden_field_tag 'submitted_crop_profile_photo', 1 %> - <%= submit_tag "Done >>" %> + <%= submit_tag _("Done") + " >>" %> </p> <% end %> diff --git a/app/views/user/set_draft_profile_photo.rhtml b/app/views/user/set_draft_profile_photo.rhtml index 90be49600..b3faba7fc 100644 --- a/app/views/user/set_draft_profile_photo.rhtml +++ b/app/views/user/set_draft_profile_photo.rhtml @@ -10,12 +10,12 @@ <% form_tag 'set_photo', :id => 'set_draft_profile_photo_form', :multipart => true do %> <p> - <label class="form_label" for="file_1"><%= _('Photo of you:')%></label> + <label class="form_label" for="file_1"><%= _('Photo of you:')%></label> <%= file_field_tag :file, :size => 35, :id => 'file_1' %> </p> <ul> - <li><%= _('Your photo will be shown in public <strong>on the Internet</strong>, + <li><%= _('Your photo will be shown in public <strong>on the Internet</strong>, wherever you do something on {{site_name}}.', :site_name=>site_name)%> </li> @@ -36,7 +36,7 @@ <noscript> <div> <%= hidden_field_tag 'automatically_crop', 1 %> - <%= submit_tag "Done >>" %> + <%= submit_tag _("Done >>") %> </div> </noscript> <% end %> @@ -46,7 +46,7 @@ <h2><%= _('OR remove the existing photo')%></h2> <% form_tag 'clear_photo', :id => 'clear_profile_photo_form', :multipart => true do %> - <%= submit_tag "Clear photo" %> + <%= submit_tag _("Clear photo") %> <% end %> <% end %> diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index d723196d3..12a9d3f74 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -1,14 +1,14 @@ <% if @show_requests %> - <% @title = h(@display_user.name) + _(" - Freedom of Information requests") %> + <% @title = _("{{user_name}} - Freedom of Information requests", :user_name => h(@display_user.name)) %> <% else %> - <% @title = h(@display_user.name) + _(" - user profile") %> + <% @title = _("{{user_name}} - user profile", :user_name => h(@display_user.name)) %> <% end %> <% if (@same_name_users.size >= 1) %> - <p><%= _('There is <strong>more than one person</strong> who uses this site and has this name. + <p><%= _('There is <strong>more than one person</strong> who uses this site and has this name. One of them is shown below, you may mean a different one:')%> <% for @same_name_user in @same_name_users %> <%= user_link(@same_name_user) %> - <% end %> + <% end %> <% end%> <% if @show_profile && @is_you && @undescribed_requests.size > 0 %> @@ -40,11 +40,11 @@ <a href="#foi_requests"><%= _('FOI requests')%></a> <br><a href="#annotations"><%= _('Annotations')%></a> <% end %> - </div> + </div> <div class="header_left"> <p id="user_photo_on_profile"> - <% if @display_user.profile_photo %> + <% if @display_user.profile_photo %> <% if @is_you %> <a href="<%= set_profile_photo_url() %>"> <% end %> @@ -93,25 +93,7 @@ </div> <% end %> - <% if !@display_user.get_about_me_for_html_display.empty? || @is_you %> - <div class="user_about_me"> - <img class="comment_quote" src="/images/quote.png" alt=""> - <%= @display_user.get_about_me_for_html_display %> - <% if @is_you %> - (<%= link_to _("edit text about you"), set_profile_about_me_url() %>) - <% end %> - </div> - <% end %> - - <% if @is_you %> - <p id="user_change_password_email"> - <% if @display_user.profile_photo %> - <%= link_to _('Change profile photo'), set_profile_photo_url() %> | - <% end %> - <%= link_to _('Change your password'), signchangepassword_url() %> | - <%= link_to _('Change your email'), signchangeemail_url() %> - </p> - <% end %> + <%= render :partial => 'user/show_user_info' %> <% if not @is_you %> <p id="user_not_logged_in"> @@ -127,7 +109,7 @@ <div id="user_profile_search"> <% form_tag(show_user_url, :method => "get", :id=>"search_form") do %> <div> - <%= text_field_tag(:user_query, params[:user_query]) %> + <%= text_field_tag(:user_query, params[:user_query]) %> <% if @is_you %> <%= submit_tag(_("Search your contributions")) %> <% else %> @@ -146,7 +128,7 @@ <% end %> <% else %> <h2 class="foi_results" id="foi_requests"> - <%= @is_you ? n_('Your %d Freedom of Information request', 'Your %d Freedom of Information requests', @xapian_requests.matches_estimated.to_s) % @xapian_requests.matches_estimated.to_s : n_('This person\'s %d Freedom of Information request', 'This person\'s %d Freedom of Information requests', @xapian_requests.matches_estimated.to_s) % @xapian_requests.matches_estimated %> + <%= @is_you ? n_('Your %d Freedom of Information request', 'Your %d Freedom of Information requests', @xapian_requests.matches_estimated) % @xapian_requests.matches_estimated.to_s : n_('This person\'s %d Freedom of Information request', 'This person\'s %d Freedom of Information requests', @xapian_requests.matches_estimated) % @xapian_requests.matches_estimated %> <!-- matches_estimated <%=@xapian_requests.matches_estimated%> --> <%= @match_phrase %> <%= @page_desc %> @@ -159,12 +141,12 @@ <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @display_user.info_requests.size) %> <% end %> - <% else %> + <% else %> <% if @show_requests %> <h2 class="foi_results" id="foi_requests"><%= @is_you ? _('Freedom of Information requests made by you') : _('Freedom of Information requests made by this person') %> </h2> <p><%= _('The search index is currently offline, so we can\'t show the Freedom of Information requests this person has made.')%></p> <% end %> - <% end %> + <% end %> <% if !@xapian_comments.nil? %> <% if @xapian_comments.results.empty? %> @@ -221,7 +203,7 @@ <%= hidden_field_tag 'r', request.request_uri %> <% if track_things.size > 1 %> <%= submit_tag _('unsubscribe all')%> - <% end %> + <% end %> </h3> <% end %> <% end %> @@ -231,7 +213,7 @@ <li> <% form_tag({:controller => 'track', :action => 'update', :track_id => track_thing.id}, :class => "feed_form") do %> <div> - <%= track_thing.params[:list_description] %> + <%= track_thing.params[:list_description] %> <%= hidden_field_tag 'track_medium', "delete", { :id => 'track_medium_' + track_thing.id.to_s } %> <%= hidden_field_tag 'r', request.request_uri, { :id => 'r_' + track_thing.id.to_s } %> <%= submit_tag _('unsubscribe') %> |