aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_controller.rb6
-rw-r--r--app/controllers/admin_public_body_controller.rb16
-rw-r--r--app/controllers/admin_request_controller.rb35
-rw-r--r--app/controllers/admin_track_controller.rb10
-rw-r--r--app/controllers/admin_user_controller.rb10
-rw-r--r--app/controllers/api_controller.rb13
-rw-r--r--app/controllers/application_controller.rb55
-rw-r--r--app/controllers/general_controller.rb10
-rw-r--r--app/controllers/help_controller.rb6
-rw-r--r--app/controllers/holiday_controller.rb2
-rw-r--r--app/controllers/public_body_controller.rb12
-rw-r--r--app/controllers/request_controller.rb57
-rw-r--r--app/controllers/services_controller.rb6
-rw-r--r--app/controllers/track_controller.rb9
-rw-r--r--app/controllers/user_controller.rb26
-rw-r--r--app/helpers/config_helper.rb4
-rwxr-xr-xapp/helpers/link_to_helper.rb13
-rw-r--r--app/helpers/mailer_helper.rb2
-rw-r--r--app/mailers/application_mailer.rb62
-rw-r--r--app/mailers/contact_mailer.rb (renamed from app/models/contact_mailer.rb)47
-rw-r--r--app/mailers/outgoing_mailer.rb (renamed from app/models/outgoing_mailer.rb)30
-rw-r--r--app/mailers/request_mailer.rb (renamed from app/models/request_mailer.rb)227
-rw-r--r--app/mailers/track_mailer.rb (renamed from app/models/track_mailer.rb)24
-rw-r--r--app/mailers/user_mailer.rb44
-rw-r--r--app/models/about_me_validator.rb20
-rw-r--r--app/models/application_mailer.rb164
-rw-r--r--app/models/censor_rule.rb10
-rw-r--r--app/models/change_email_validator.rb36
-rw-r--r--app/models/contact_validator.rb32
-rw-r--r--app/models/foi_attachment.rb20
-rw-r--r--app/models/incoming_message.rb20
-rw-r--r--app/models/info_request.rb77
-rw-r--r--app/models/info_request_event.rb2
-rw-r--r--app/models/mail_server_log.rb8
-rw-r--r--app/models/outgoing_message.rb21
-rw-r--r--app/models/post_redirect.rb26
-rw-r--r--app/models/profile_photo.rb37
-rw-r--r--app/models/public_body.rb65
-rw-r--r--app/models/raw_email.rb4
-rw-r--r--app/models/track_thing.rb2
-rw-r--r--app/models/user.rb48
-rw-r--r--app/models/user_mailer.rb48
-rw-r--r--app/views/admin_censor_rule/_form.html.erb (renamed from app/views/admin_censor_rule/_form.rhtml)0
-rw-r--r--app/views/admin_censor_rule/_show.html.erb (renamed from app/views/admin_censor_rule/_show.rhtml)0
-rw-r--r--app/views/admin_censor_rule/edit.html.erb (renamed from app/views/admin_censor_rule/edit.rhtml)4
-rw-r--r--app/views/admin_censor_rule/new.html.erb (renamed from app/views/admin_censor_rule/new.rhtml)4
-rw-r--r--app/views/admin_general/_admin_navbar.html.erb (renamed from app/views/admin_general/_admin_navbar.rhtml)0
-rw-r--r--app/views/admin_general/debug.html.erb (renamed from app/views/admin_general/debug.rhtml)7
-rw-r--r--app/views/admin_general/index.html.erb (renamed from app/views/admin_general/index.rhtml)0
-rw-r--r--app/views/admin_general/stats.html.erb (renamed from app/views/admin_general/stats.rhtml)0
-rw-r--r--app/views/admin_general/timeline.html.erb (renamed from app/views/admin_general/timeline.rhtml)0
-rw-r--r--app/views/admin_public_body/_form.html.erb (renamed from app/views/admin_public_body/_form.rhtml)2
-rw-r--r--app/views/admin_public_body/_one_list.html.erb (renamed from app/views/admin_public_body/_one_list.rhtml)2
-rw-r--r--app/views/admin_public_body/_tag_help.html.erb (renamed from app/views/admin_public_body/_tag_help.rhtml)0
-rw-r--r--app/views/admin_public_body/_tags.html.erb (renamed from app/views/admin_public_body/_tags.rhtml)0
-rw-r--r--app/views/admin_public_body/edit.html.erb (renamed from app/views/admin_public_body/edit.rhtml)2
-rw-r--r--app/views/admin_public_body/import_csv.html.erb (renamed from app/views/admin_public_body/import_csv.rhtml)2
-rw-r--r--app/views/admin_public_body/list.html.erb (renamed from app/views/admin_public_body/list.rhtml)3
-rw-r--r--app/views/admin_public_body/missing_scheme.html.erb (renamed from app/views/admin_public_body/missing_scheme.rhtml)0
-rw-r--r--app/views/admin_public_body/new.html.erb (renamed from app/views/admin_public_body/new.rhtml)2
-rw-r--r--app/views/admin_public_body/show.html.erb (renamed from app/views/admin_public_body/show.rhtml)0
-rw-r--r--app/views/admin_request/_incoming_message_actions.html.erb (renamed from app/views/admin_request/_incoming_message_actions.rhtml)4
-rw-r--r--app/views/admin_request/_some_requests.html.erb (renamed from app/views/admin_request/_some_requests.rhtml)0
-rw-r--r--app/views/admin_request/_tags.html.erb (renamed from app/views/admin_request/_tags.rhtml)0
-rw-r--r--app/views/admin_request/edit.html.erb (renamed from app/views/admin_request/edit.rhtml)4
-rw-r--r--app/views/admin_request/edit_comment.html.erb (renamed from app/views/admin_request/edit_comment.rhtml)2
-rw-r--r--app/views/admin_request/edit_outgoing.html.erb (renamed from app/views/admin_request/edit_outgoing.rhtml)4
-rw-r--r--app/views/admin_request/hidden_user_explanation.html.erb (renamed from app/views/admin_request/hidden_user_explanation.rhtml)0
-rw-r--r--app/views/admin_request/list.html.erb (renamed from app/views/admin_request/list.rhtml)2
-rw-r--r--app/views/admin_request/show.html.erb (renamed from app/views/admin_request/show.rhtml)19
-rw-r--r--app/views/admin_request/show_raw_email.html.erb (renamed from app/views/admin_request/show_raw_email.rhtml)0
-rw-r--r--app/views/admin_track/_some_tracks.html.erb (renamed from app/views/admin_track/_some_tracks.rhtml)4
-rw-r--r--app/views/admin_track/list.html.erb (renamed from app/views/admin_track/list.rhtml)2
-rw-r--r--app/views/admin_user/_form.html.erb (renamed from app/views/admin_user/_form.rhtml)0
-rw-r--r--app/views/admin_user/_user_table.html.erb (renamed from app/views/admin_user/_user_table.rhtml)0
-rw-r--r--app/views/admin_user/edit.html.erb (renamed from app/views/admin_user/edit.rhtml)2
-rw-r--r--app/views/admin_user/list.html.erb (renamed from app/views/admin_user/list.rhtml)2
-rw-r--r--app/views/admin_user/list_banned.html.erb (renamed from app/views/admin_user/list_banned.rhtml)0
-rw-r--r--app/views/admin_user/show.html.erb (renamed from app/views/admin_user/show.rhtml)2
-rw-r--r--app/views/admin_user/show_bounce_message.html.erb (renamed from app/views/admin_user/show_bounce_message.rhtml)0
-rw-r--r--app/views/comment/_comment_form.html.erb (renamed from app/views/comment/_comment_form.rhtml)2
-rw-r--r--app/views/comment/_single_comment.html.erb (renamed from app/views/comment/_single_comment.rhtml)0
-rw-r--r--app/views/comment/new.html.erb (renamed from app/views/comment/new.rhtml)0
-rw-r--r--app/views/comment/preview.html.erb (renamed from app/views/comment/preview.rhtml)2
-rw-r--r--app/views/contact_mailer/from_admin_message.text.erb (renamed from app/views/contact_mailer/from_admin_message.rhtml)0
-rw-r--r--app/views/contact_mailer/to_admin_message.text.erb (renamed from app/views/contact_mailer/to_admin_message.rhtml)0
-rw-r--r--app/views/contact_mailer/user_message.text.erb (renamed from app/views/contact_mailer/user_message.rhtml)0
-rw-r--r--app/views/general/_advanced_search_tips.html.erb (renamed from app/views/general/_advanced_search_tips.rhtml)0
-rw-r--r--app/views/general/_before_body_end.html.erb (renamed from app/views/general/_before_body_end.rhtml)0
-rw-r--r--app/views/general/_before_head_end.html.erb (renamed from app/views/general/_before_head_end.rhtml)0
-rw-r--r--app/views/general/_credits.html.erb (renamed from app/views/general/_credits.rhtml)0
-rw-r--r--app/views/general/_custom_state_descriptions.html.erb (renamed from app/views/general/_custom_state_descriptions.rhtml)0
-rw-r--r--app/views/general/_custom_state_transitions_complete.html.erb (renamed from app/views/general/_custom_state_transitions_complete.rhtml)0
-rw-r--r--app/views/general/_custom_state_transitions_pending.html.erb (renamed from app/views/general/_custom_state_transitions_pending.rhtml)0
-rw-r--r--app/views/general/_footer.html.erb (renamed from app/views/general/_footer.rhtml)2
-rw-r--r--app/views/general/_frontpage_bodies_list.html.erb (renamed from app/views/general/_frontpage_bodies_list.rhtml)0
-rw-r--r--app/views/general/_frontpage_intro_sentence.html.erb (renamed from app/views/general/_frontpage_intro_sentence.rhtml)0
-rw-r--r--app/views/general/_frontpage_new_request.html.erb (renamed from app/views/general/_frontpage_new_request.rhtml)0
-rw-r--r--app/views/general/_frontpage_requests_list.html.erb (renamed from app/views/general/_frontpage_requests_list.rhtml)0
-rw-r--r--app/views/general/_frontpage_search_box.html.erb (renamed from app/views/general/_frontpage_search_box.rhtml)0
-rw-r--r--app/views/general/_locale_switcher.html.erb (renamed from app/views/general/_locale_switcher.rhtml)0
-rw-r--r--app/views/general/_localised_datepicker.html.erb (renamed from app/views/general/_localised_datepicker.rhtml)0
-rw-r--r--app/views/general/_orglink.html.erb (renamed from app/views/general/_orglink.rhtml)0
-rw-r--r--app/views/general/_popup_banner.html.erb (renamed from app/views/general/_popup_banner.rhtml)0
-rw-r--r--app/views/general/_stylesheet_includes.html.erb (renamed from app/views/general/_stylesheet_includes.rhtml)2
-rw-r--r--app/views/general/_topnav.html.erb (renamed from app/views/general/_topnav.rhtml)0
-rw-r--r--app/views/general/blog.html.erb (renamed from app/views/general/blog.rhtml)14
-rw-r--r--app/views/general/custom_css.html.erb (renamed from app/views/general/custom_css.rhtml)0
-rw-r--r--app/views/general/exception_caught.html.erb (renamed from app/views/general/exception_caught.rhtml)2
-rw-r--r--app/views/general/frontpage.html.erb (renamed from app/views/general/frontpage.rhtml)2
-rw-r--r--app/views/general/search.html.erb (renamed from app/views/general/search.rhtml)4
-rw-r--r--app/views/help/_sidebar.html.erb (renamed from app/views/help/_sidebar.rhtml)0
-rw-r--r--app/views/help/_why_they_should_reply_by_email.html.erb (renamed from app/views/help/_why_they_should_reply_by_email.rhtml)0
-rw-r--r--app/views/help/about.html.erb (renamed from app/views/help/about.rhtml)0
-rw-r--r--app/views/help/alaveteli.html.erb (renamed from app/views/help/alaveteli.rhtml)0
-rw-r--r--app/views/help/api.html.erb (renamed from app/views/help/api.rhtml)0
-rw-r--r--app/views/help/contact.html.erb (renamed from app/views/help/contact.rhtml)4
-rw-r--r--app/views/help/credits.html.erb (renamed from app/views/help/credits.rhtml)0
-rw-r--r--app/views/help/officers.html.erb (renamed from app/views/help/officers.rhtml)0
-rw-r--r--app/views/help/privacy.html.erb (renamed from app/views/help/privacy.rhtml)0
-rw-r--r--app/views/help/requesting.html.erb (renamed from app/views/help/requesting.rhtml)0
-rw-r--r--app/views/help/unhappy.html.erb (renamed from app/views/help/unhappy.rhtml)0
-rw-r--r--app/views/holiday/due_date.html.erb (renamed from app/views/holiday/due_date.rhtml)0
-rw-r--r--app/views/layouts/admin.html.erb (renamed from app/views/layouts/admin.rhtml)0
-rw-r--r--app/views/layouts/contact_mailer.html.erb (renamed from app/views/layouts/contact_mailer.rhtml)0
-rw-r--r--app/views/layouts/default.html.erb (renamed from app/views/layouts/default.rhtml)10
-rw-r--r--app/views/layouts/no_chrome.html.erb (renamed from app/views/layouts/no_chrome.rhtml)0
-rw-r--r--app/views/layouts/outgoing_mailer.html.erb (renamed from app/views/layouts/outgoing_mailer.rhtml)0
-rw-r--r--app/views/layouts/request_mailer.html.erb (renamed from app/views/layouts/request_mailer.rhtml)0
-rw-r--r--app/views/layouts/user_mailer.html.erb (renamed from app/views/layouts/user_mailer.rhtml)0
-rw-r--r--app/views/outgoing_mailer/_followup_footer.text.erb (renamed from app/views/outgoing_mailer/_followup_footer.rhtml)0
-rw-r--r--app/views/outgoing_mailer/followup.text.erb (renamed from app/views/outgoing_mailer/followup.rhtml)0
-rw-r--r--app/views/outgoing_mailer/initial_request.text.erb (renamed from app/views/outgoing_mailer/initial_request.rhtml)0
-rw-r--r--app/views/public_body/_alphabet.html.erb (renamed from app/views/public_body/_alphabet.rhtml)2
-rw-r--r--app/views/public_body/_body_listing.html.erb (renamed from app/views/public_body/_body_listing.rhtml)0
-rw-r--r--app/views/public_body/_body_listing_single.html.erb (renamed from app/views/public_body/_body_listing_single.rhtml)0
-rw-r--r--app/views/public_body/_list_sidebar_extra.html.erb (renamed from app/views/public_body/_list_sidebar_extra.rhtml)0
-rw-r--r--app/views/public_body/_search_ahead.html.erb (renamed from app/views/public_body/_search_ahead.rhtml)0
-rw-r--r--app/views/public_body/list.html.erb (renamed from app/views/public_body/list.rhtml)2
-rw-r--r--app/views/public_body/show.html.erb (renamed from app/views/public_body/show.rhtml)0
-rw-r--r--app/views/public_body/view_email.html.erb (renamed from app/views/public_body/view_email.rhtml)0
-rw-r--r--app/views/public_body/view_email_captcha.html.erb (renamed from app/views/public_body/view_email_captcha.rhtml)2
-rw-r--r--app/views/request/_after_actions.html.erb (renamed from app/views/request/_after_actions.rhtml)0
-rw-r--r--app/views/request/_bubble.html.erb (renamed from app/views/request/_bubble.rhtml)0
-rw-r--r--app/views/request/_correspondence.html.erb (renamed from app/views/request/_correspondence.rhtml)0
-rw-r--r--app/views/request/_describe_state.html.erb (renamed from app/views/request/_describe_state.rhtml)6
-rw-r--r--app/views/request/_followup.html.erb (renamed from app/views/request/_followup.rhtml)2
-rw-r--r--app/views/request/_hidden_correspondence.html.erb (renamed from app/views/request/_hidden_correspondence.rhtml)6
-rw-r--r--app/views/request/_next_actions.html.erb (renamed from app/views/request/_next_actions.rhtml)0
-rw-r--r--app/views/request/_other_describe_state.html.erb (renamed from app/views/request/_other_describe_state.rhtml)2
-rw-r--r--app/views/request/_request_filter_form.html.erb (renamed from app/views/request/_request_filter_form.rhtml)2
-rw-r--r--app/views/request/_request_listing.html.erb (renamed from app/views/request/_request_listing.rhtml)0
-rw-r--r--app/views/request/_request_listing_short_via_event.html.erb (renamed from app/views/request/_request_listing_short_via_event.rhtml)0
-rw-r--r--app/views/request/_request_listing_single.html.erb (renamed from app/views/request/_request_listing_single.rhtml)2
-rw-r--r--app/views/request/_request_listing_via_event.html.erb (renamed from app/views/request/_request_listing_via_event.rhtml)0
-rw-r--r--app/views/request/_search_ahead.html.erb (renamed from app/views/request/_search_ahead.rhtml)0
-rw-r--r--app/views/request/_sidebar.html.erb (renamed from app/views/request/_sidebar.rhtml)19
-rw-r--r--app/views/request/_sidebar_request_listing.html.erb (renamed from app/views/request/_sidebar_request_listing.rhtml)0
-rw-r--r--app/views/request/_summary_suggestion.html.erb (renamed from app/views/request/_summary_suggestion.rhtml)0
-rw-r--r--app/views/request/_view_html_prefix.html.erb (renamed from app/views/request/_view_html_prefix.rhtml)0
-rw-r--r--app/views/request/_view_html_stylesheet.html.erb (renamed from app/views/request/_view_html_stylesheet.rhtml)0
-rw-r--r--app/views/request/_wall_listing.html.erb (renamed from app/views/request/_wall_listing.rhtml)0
-rw-r--r--app/views/request/details.html.erb (renamed from app/views/request/details.rhtml)0
-rw-r--r--app/views/request/followup_bad.html.erb (renamed from app/views/request/followup_bad.rhtml)0
-rw-r--r--app/views/request/followup_preview.html.erb (renamed from app/views/request/followup_preview.rhtml)4
-rw-r--r--app/views/request/hidden.html.erb (renamed from app/views/request/hidden.rhtml)2
-rw-r--r--app/views/request/list.html.erb (renamed from app/views/request/list.rhtml)0
-rw-r--r--app/views/request/new.html.erb (renamed from app/views/request/new.rhtml)4
-rw-r--r--app/views/request/new_bad_contact.html.erb (renamed from app/views/request/new_bad_contact.rhtml)0
-rw-r--r--app/views/request/new_please_describe.html.erb (renamed from app/views/request/new_please_describe.rhtml)2
-rw-r--r--app/views/request/preview.html.erb (renamed from app/views/request/preview.rhtml)8
-rw-r--r--app/views/request/select_authority.html.erb (renamed from app/views/request/select_authority.rhtml)2
-rw-r--r--app/views/request/show.html.erb (renamed from app/views/request/show.rhtml)2
-rw-r--r--app/views/request/show_response.html.erb (renamed from app/views/request/show_response.rhtml)0
-rw-r--r--app/views/request/similar.html.erb (renamed from app/views/request/similar.rhtml)0
-rw-r--r--app/views/request/simple_correspondence.html.erb (renamed from app/views/request/simple_correspondence.rhtml)2
-rw-r--r--app/views/request/upload_response.html.erb (renamed from app/views/request/upload_response.rhtml)2
-rw-r--r--app/views/request_game/play.html.erb (renamed from app/views/request_game/play.rhtml)0
-rw-r--r--app/views/request_mailer/comment_on_alert.text.erb (renamed from app/views/request_mailer/comment_on_alert.rhtml)0
-rw-r--r--app/views/request_mailer/comment_on_alert_plural.text.erb (renamed from app/views/request_mailer/comment_on_alert_plural.rhtml)0
-rw-r--r--app/views/request_mailer/external_response.rhtml1
-rw-r--r--app/views/request_mailer/external_response.text.erb1
-rw-r--r--app/views/request_mailer/fake_response.rhtml1
-rw-r--r--app/views/request_mailer/fake_response.text.erb1
-rw-r--r--app/views/request_mailer/new_response.text.erb (renamed from app/views/request_mailer/new_response.rhtml)0
-rw-r--r--app/views/request_mailer/new_response_reminder_alert.text.erb (renamed from app/views/request_mailer/new_response_reminder_alert.rhtml)0
-rw-r--r--app/views/request_mailer/not_clarified_alert.text.erb (renamed from app/views/request_mailer/not_clarified_alert.rhtml)0
-rw-r--r--app/views/request_mailer/old_unclassified_updated.text.erb (renamed from app/views/request_mailer/old_unclassified_updated.rhtml)0
-rw-r--r--app/views/request_mailer/overdue_alert.text.erb (renamed from app/views/request_mailer/overdue_alert.rhtml)0
-rw-r--r--app/views/request_mailer/requires_admin.text.erb (renamed from app/views/request_mailer/requires_admin.rhtml)0
-rw-r--r--app/views/request_mailer/stopped_responses.text.erb (renamed from app/views/request_mailer/stopped_responses.rhtml)0
-rw-r--r--app/views/request_mailer/very_overdue_alert.text.erb (renamed from app/views/request_mailer/very_overdue_alert.rhtml)0
-rw-r--r--app/views/track/_tracking_links.html.erb (renamed from app/views/track/_tracking_links.rhtml)2
-rw-r--r--app/views/track/atom_feed.atom.erb2
-rw-r--r--app/views/track_mailer/event_digest.text.erb (renamed from app/views/track_mailer/event_digest.rhtml)0
-rw-r--r--app/views/user/_change_receive_email.html.erb (renamed from app/views/user/_change_receive_email.rhtml)2
-rw-r--r--app/views/user/_show_user_info.html.erb (renamed from app/views/user/_show_user_info.rhtml)0
-rw-r--r--app/views/user/_signin.html.erb (renamed from app/views/user/_signin.rhtml)2
-rw-r--r--app/views/user/_signup.html.erb (renamed from app/views/user/_signup.rhtml)2
-rw-r--r--app/views/user/_user_listing_single.html.erb (renamed from app/views/user/_user_listing_single.rhtml)0
-rw-r--r--app/views/user/bad_token.html.erb (renamed from app/views/user/bad_token.rhtml)0
-rw-r--r--app/views/user/banned.html.erb (renamed from app/views/user/banned.rhtml)0
-rw-r--r--app/views/user/confirm.html.erb (renamed from app/views/user/confirm.rhtml)0
-rw-r--r--app/views/user/contact.html.erb (renamed from app/views/user/contact.rhtml)2
-rw-r--r--app/views/user/no_cookies.html.erb (renamed from app/views/user/no_cookies.rhtml)0
-rw-r--r--app/views/user/rate_limited.html.erb (renamed from app/views/user/rate_limited.rhtml)2
-rw-r--r--app/views/user/river.html.erb (renamed from app/views/user/river.rhtml)0
-rw-r--r--app/views/user/set_crop_profile_photo.html.erb (renamed from app/views/user/set_crop_profile_photo.rhtml)2
-rw-r--r--app/views/user/set_draft_profile_photo.html.erb (renamed from app/views/user/set_draft_profile_photo.rhtml)4
-rw-r--r--app/views/user/set_profile_about_me.html.erb (renamed from app/views/user/set_profile_about_me.rhtml)4
-rw-r--r--app/views/user/show.html.erb (renamed from app/views/user/show.rhtml)16
-rw-r--r--app/views/user/sign.html.erb (renamed from app/views/user/sign.rhtml)0
-rw-r--r--app/views/user/signchangeemail.html.erb (renamed from app/views/user/signchangeemail.rhtml)2
-rw-r--r--app/views/user/signchangeemail_confirm.html.erb (renamed from app/views/user/signchangeemail_confirm.rhtml)0
-rw-r--r--app/views/user/signchangepassword.html.erb (renamed from app/views/user/signchangepassword.rhtml)2
-rw-r--r--app/views/user/signchangepassword_confirm.html.erb (renamed from app/views/user/signchangepassword_confirm.rhtml)0
-rw-r--r--app/views/user/signchangepassword_send_confirm.html.erb (renamed from app/views/user/signchangepassword_send_confirm.rhtml)2
-rw-r--r--app/views/user/signin_successful.html.erb (renamed from app/views/user/signin_successful.rhtml)0
-rw-r--r--app/views/user/wall.html.erb (renamed from app/views/user/wall.rhtml)0
-rw-r--r--app/views/user/wrong_user.html.erb (renamed from app/views/user/wrong_user.rhtml)0
-rw-r--r--app/views/user/wrong_user_unknown_email.html.erb (renamed from app/views/user/wrong_user_unknown_email.rhtml)0
-rw-r--r--app/views/user_mailer/already_registered.text.erb (renamed from app/views/user_mailer/already_registered.rhtml)0
-rw-r--r--app/views/user_mailer/changeemail_already_used.text.erb (renamed from app/views/user_mailer/changeemail_already_used.rhtml)0
-rw-r--r--app/views/user_mailer/changeemail_confirm.text.erb (renamed from app/views/user_mailer/changeemail_confirm.rhtml)0
-rw-r--r--app/views/user_mailer/confirm_login.text.erb (renamed from app/views/user_mailer/confirm_login.rhtml)0
225 files changed, 777 insertions, 831 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index d93e68dab..5a8b1fe55 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -51,7 +51,7 @@ class AdminController < ApplicationController
# For administration interface, return display name of authenticated user
def admin_current_user
- if Configuration::skip_admin_auth
+ if AlaveteliConfiguration::skip_admin_auth
admin_http_auth_user
else
session[:admin_name]
@@ -74,7 +74,7 @@ class AdminController < ApplicationController
end
def authenticate
- if Configuration::skip_admin_auth
+ if AlaveteliConfiguration::skip_admin_auth
session[:using_admin] = 1
return
else
@@ -98,7 +98,7 @@ class AdminController < ApplicationController
end
else
authenticate_or_request_with_http_basic do |user_name, password|
- if user_name == Configuration::admin_username && password == Configuration::admin_password
+ if user_name == AlaveteliConfiguration::admin_username && password == AlaveteliConfiguration::admin_password
session[:using_admin] = 1
session[:admin_name] = user_name
else
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index bb5e98852..ec1848fd3 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_body_controller.rb
@@ -14,7 +14,7 @@ class AdminPublicBodyController < AdminController
def _lookup_query_internal
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
@query = params[:query]
if @query == ""
@query = nil
@@ -23,12 +23,10 @@ class AdminPublicBodyController < AdminController
if @page == ""
@page = nil
end
- @public_bodies = PublicBody.paginate :order => "public_body_translations.name", :page => @page, :per_page => 100,
- :conditions => @query.nil? ? "public_body_translations.locale = '#{@locale}'" :
+ @public_bodies = PublicBody.joins(:translations).where(@query.nil? ? "public_body_translations.locale = '#{@locale}'" :
["(lower(public_body_translations.name) like lower('%'||?||'%') or
lower(public_body_translations.short_name) like lower('%'||?||'%') or
- lower(public_body_translations.request_email) like lower('%'||?||'%' )) AND (public_body_translations.locale = '#{@locale}')", @query, @query, @query],
- :joins => :translations
+ lower(public_body_translations.request_email) like lower('%'||?||'%' )) AND (public_body_translations.locale = '#{@locale}')", @query, @query, @query]).paginate :order => "public_body_translations.name", :page => @page, :per_page => 100
end
@public_bodies_by_tag = PublicBody.find_by_tag(@query)
end
@@ -75,7 +73,7 @@ class AdminPublicBodyController < AdminController
def show
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
@public_body = PublicBody.find(params[:id])
render
end
@@ -87,7 +85,7 @@ class AdminPublicBodyController < AdminController
end
def create
- PublicBody.with_locale(I18n.default_locale) do
+ I18n.with_locale(I18n.default_locale) do
params[:public_body][:last_edit_editor] = admin_current_user()
@public_body = PublicBody.new(params[:public_body])
if @public_body.save
@@ -106,7 +104,7 @@ class AdminPublicBodyController < AdminController
end
def update
- PublicBody.with_locale(I18n.default_locale) do
+ 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])
@@ -120,7 +118,7 @@ class AdminPublicBodyController < AdminController
def destroy
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
public_body = PublicBody.find(params[:id])
if public_body.info_requests.size > 0
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index 53055ae32..3ad2713d2 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -14,10 +14,29 @@ class AdminRequestController < AdminController
def list
@query = params[:query]
- @info_requests = InfoRequest.paginate :order => "created_at desc",
+ if @query
+ info_requests = InfoRequest.where(["lower(title) like lower('%'||?||'%')", @query])
+ else
+ info_requests = InfoRequest
+ end
+ @info_requests = info_requests.paginate :order => "created_at desc",
:page => params[:page],
- :per_page => 100,
- :conditions => @query.nil? ? nil : ["lower(title) like lower('%'||?||'%')", @query]
+ :per_page => 100
+ end
+
+ def list_old_unclassified
+ @info_requests = WillPaginate::Collection.create((params[:page] or 1), 50) do |pager|
+ info_requests = InfoRequest.find_old_unclassified(:conditions => ["prominence = 'normal'"],
+ :limit => pager.per_page,
+ :offset => pager.offset)
+ # inject the result array into the paginated collection:
+ pager.replace(info_requests)
+
+ unless pager.total_entries
+ # the pager didn't manage to guess the total count, do it manually
+ pager.total_entries = InfoRequest.count_old_unclassified(:conditions => ["prominence = 'normal'"])
+ end
+ end
end
def show
@@ -25,11 +44,11 @@ class AdminRequestController < AdminController
# 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,
- :name_from => Configuration::contact_name,
+ :name_from => AlaveteliConfiguration::contact_name,
:info_request => @info_request, :reason => params[:reason],
- :info_request_url => 'http://' + Configuration::domain + request_path(@info_request),
+ :info_request_url => 'http://' + AlaveteliConfiguration::domain + request_url(@info_request),
:site_name => site_name)
- template = File.read(File.join(File.dirname(__FILE__), "..", "views", "admin_request", "hidden_user_explanation.rhtml"))
+ template = File.read(File.join(File.dirname(__FILE__), "..", "views", "admin_request", "hidden_user_explanation.html.erb"))
@request_hidden_user_explanation = ERB.new(template).result(vars.instance_eval { binding })
end
@@ -361,11 +380,11 @@ class AdminRequestController < AdminController
info_request.save!
if ! info_request.is_external?
- ContactMailer.deliver_from_admin_message(
+ ContactMailer.from_admin_message(
info_request.user,
subject,
params[:explanation].strip.html_safe
- )
+ ).deliver
flash[:notice] = _("Your message to {{recipient_user_name}} has been sent",:recipient_user_name=>CGI.escapeHTML(info_request.user.name))
else
flash[:notice] = _("This external request has been hidden")
diff --git a/app/controllers/admin_track_controller.rb b/app/controllers/admin_track_controller.rb
index 525c96782..bd0eee27b 100644
--- a/app/controllers/admin_track_controller.rb
+++ b/app/controllers/admin_track_controller.rb
@@ -7,9 +7,13 @@
class AdminTrackController < AdminController
def list
@query = params[:query]
- @admin_tracks = TrackThing.paginate :order => "created_at desc", :page => params[:page], :per_page => 100,
- :conditions => @query.nil? ? nil : ["lower(track_query) like lower('%'||?||'%')", @query ]
- @popular = ActiveRecord::Base.connection.select_all("select count(*) as count, title, info_request_id from track_things join info_requests on info_request_id = info_requests.id where info_request_id is not null group by info_request_id, title order by count desc limit 10;")
+ if @query
+ track_things = TrackThing.where(["lower(track_query) like lower('%'||?||'%')", @query])
+ else
+ track_things = TrackThing
+ end
+ @admin_tracks = track_things.paginate :order => "created_at desc", :page => params[:page], :per_page => 100
+ @popular = ActiveRecord::Base.connection.select_all("select count(*) as count, title, info_request_id from track_things join info_requests on info_request_id = info_requests.id where info_request_id is not null group by info_request_id, title order by count desc limit 10;")
end
private
diff --git a/app/controllers/admin_user_controller.rb b/app/controllers/admin_user_controller.rb
index feffa208e..e6a167de8 100644
--- a/app/controllers/admin_user_controller.rb
+++ b/app/controllers/admin_user_controller.rb
@@ -12,9 +12,13 @@ class AdminUserController < AdminController
def list
@query = params[:query]
- @admin_users = User.paginate :order => "name", :page => params[:page], :per_page => 100,
- :conditions => @query.nil? ? nil : ["lower(name) like lower('%'||?||'%') or
- lower(email) like lower('%'||?||'%')", @query, @query]
+ if @query
+ users = User.where(["lower(name) like lower('%'||?||'%') or
+ lower(email) like lower('%'||?||'%')", @query, @query])
+ else
+ users = User
+ end
+ @admin_users = users.paginate :order => "name", :page => params[:page], :per_page => 100
end
def list_banned
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index 5d8ceb888..49b226e4b 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -83,7 +83,7 @@ class ApiController < ApplicationController
direction = json["direction"]
body = json["body"]
- sent_at_str = json["sent_at"]
+ sent_at = json["sent_at"]
errors = []
@@ -107,12 +107,6 @@ class ApiController < ApplicationController
errors << "The 'body' is empty"
end
- begin
- sent_at = Time.iso8601(sent_at_str)
- rescue ArgumentError
- errors << "Failed to parse 'sent_at' field as ISO8601 time: #{sent_at_str}"
- end
-
if direction == "request" && !attachments.nil?
errors << "You cannot attach files to messages in the 'request' direction"
end
@@ -155,7 +149,8 @@ class ApiController < ApplicationController
)
end
- mail = RequestMailer.create_external_response(request, body, sent_at, attachment_hashes)
+ mail = RequestMailer.external_response(request, body, sent_at, attachment_hashes)
+
request.receive(mail, mail.encoded, true)
end
render :json => {
@@ -248,6 +243,6 @@ class ApiController < ApplicationController
private
def make_url(*args)
- "http://" + Configuration::domain + "/" + args.join("/")
+ "http://" + AlaveteliConfiguration::domain + "/" + args.join("/")
end
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index f3deeb64a..df522519d 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -16,9 +16,6 @@ class ApplicationController < ActionController::Base
layout "default"
include FastGettext::Translation # make functions like _, n_, N_ etc available)
- # Send notification email on exceptions
- include ExceptionNotification::Notifiable
-
# Note: a filter stops the chain if it redirects or renders something
before_filter :authentication_check
before_filter :set_gettext_locale
@@ -27,9 +24,6 @@ class ApplicationController < ActionController::Base
before_filter :set_vary_header
before_filter :set_popup_banner
- # scrub sensitive parameters from the logs
- filter_parameter_logging :password
-
def set_vary_header
response.headers['Vary'] = 'Cookie'
end
@@ -54,12 +48,12 @@ class ApplicationController < ActionController::Base
end
def set_gettext_locale
- if Configuration::include_default_locale_in_urls == false
+ if AlaveteliConfiguration::include_default_locale_in_urls == false
params_locale = params[:locale] ? params[:locale] : I18n.default_locale
else
params_locale = params[:locale]
end
- if Configuration::use_default_browser_language
+ if AlaveteliConfiguration::use_default_browser_language
requested_locale = params_locale || session[:locale] || cookies[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'] || I18n.default_locale
else
requested_locale = params_locale || session[:locale] || cookies[:locale] || I18n.default_locale
@@ -74,9 +68,6 @@ class ApplicationController < ActionController::Base
end
end
- # scrub sensitive parameters from the logs
- filter_parameter_logging :password
-
helper_method :locale_from_params
# Help work out which request causes RAM spike.
@@ -92,7 +83,7 @@ class ApplicationController < ActionController::Base
# egrep "CONSUME MEMORY: [0-9]{7} KB" production.log
around_filter :record_memory
def record_memory
- record_memory = Configuration::debug_record_memory
+ record_memory = AlaveteliConfiguration::debug_record_memory
if record_memory
logger.info "Processing request for #{request.url} with Rails process #{Process.pid}"
File.read("/proc/#{Process.pid}/status").match(/VmRSS:\s+(\d+)/)
@@ -151,22 +142,23 @@ class ApplicationController < ActionController::Base
@exception_backtrace = exception.backtrace.join("\n")
@exception_class = exception.class.to_s
@exception_message = exception.message
- render :template => "general/exception_caught.rhtml", :status => @status
+ render :template => "general/exception_caught", :status => @status
end
- # For development sites.
- alias original_rescue_action_locally rescue_action_locally
- def rescue_action_locally(exception)
- # Make sure expiry time for session is set (before_filters are
- # otherwise missed by this override)
- session_remember_me
+ # FIXME: This was disabled during the Rails 3 upgrade as this is now handled by Rack
+ # # For development sites.
+ # alias original_rescue_action_locally rescue_action_locally
+ # def rescue_action_locally(exception)
+ # # Make sure expiry time for session is set (before_filters are
+ # # otherwise missed by this override)
+ # session_remember_me
- # Make sure the locale is set correctly too
- set_gettext_locale
+ # # Make sure the locale is set correctly too
+ # set_gettext_locale
- # Display default, detailed error for developers
- original_rescue_action_locally(exception)
- end
+ # # Display default, detailed error for developers
+ # original_rescue_action_locally(exception)
+ # end
def local_request?
false
@@ -175,6 +167,7 @@ class ApplicationController < ActionController::Base
# Called from test code, is a mimic of UserController.confirm, for use in following email
# links when in controller tests (though we also have full integration tests that
# can work over multiple controllers)
+ # TODO: Move this to the tests. It shouldn't be here
def test_code_redirect_by_email_token(token, controller_example_group)
post_redirect = PostRedirect.find_by_email_token(token)
if post_redirect.nil?
@@ -182,7 +175,7 @@ class ApplicationController < ActionController::Base
end
session[:user_id] = post_redirect.user.id
session[:user_circumstance] = post_redirect.circumstance
- params = controller_example_group.params_from(:get, post_redirect.local_part_uri)
+ params = Rails.application.routes.recognize_path(post_redirect.local_part_uri)
params.merge(post_redirect.post_params)
controller_example_group.get params[:action], params
end
@@ -258,7 +251,7 @@ class ApplicationController < ActionController::Base
# Check the user is logged in
def authenticated?(reason_params)
unless session[:user_id]
- post_redirect = PostRedirect.new(:uri => request.request_uri, :post_params => params,
+ post_redirect = PostRedirect.new(:uri => request.fullpath, :post_params => params,
:reason_params => reason_params)
post_redirect.save!
# 'modal' controls whether the sign-in form will be displayed in the typical full-blown
@@ -346,10 +339,10 @@ class ApplicationController < ActionController::Base
#
def check_read_only
- if !Configuration::read_only.empty?
+ if !AlaveteliConfiguration::read_only.empty?
flash[:notice] = _("<p>{{site_name}} is currently in maintenance. You can only view existing requests. You cannot make new ones, add followups or annotations, or otherwise change the database.</p> <p>{{read_only}}</p>",
:site_name => site_name,
- :read_only => Configuration::read_only)
+ :read_only => AlaveteliConfiguration::read_only)
redirect_to frontpage_url
end
@@ -552,10 +545,10 @@ class ApplicationController < ActionController::Base
def country_from_ip
country = ""
- if !Configuration::gaze_url.empty?
- country = quietly_try_to_open("#{Configuration::gaze_url}/gaze-rest?f=get_country_from_ip;ip=#{request.remote_ip}")
+ if !AlaveteliConfiguration::gaze_url.empty?
+ country = quietly_try_to_open("#{AlaveteliConfiguration::gaze_url}/gaze-rest?f=get_country_from_ip;ip=#{request.remote_ip}")
end
- country = Configuration::iso_country_code if country.empty?
+ country = AlaveteliConfiguration::iso_country_code if country.empty?
return country
end
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index f6a46458e..6f79c50cb 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -21,11 +21,11 @@ class GeneralController < ApplicationController
medium_cache
# get some example searches and public bodies to display
# either from config, or based on a (slow!) query if not set
- body_short_names = Configuration::frontpage_publicbody_examples.split(/\s*;\s*/).map{|s| "'%s'" % s.gsub(/'/, "''") }.join(", ")
+ body_short_names = AlaveteliConfiguration::frontpage_publicbody_examples.split(/\s*;\s*/).map{|s| "'%s'" % s.gsub(/'/, "''") }.join(", ")
@locale = self.locale_from_params()
locale_condition = 'public_body_translations.locale = ?'
conditions = [locale_condition, @locale]
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
if body_short_names.empty?
# This is too slow
@popular_bodies = PublicBody.visible.find(:all,
@@ -71,7 +71,7 @@ class GeneralController < ApplicationController
def blog
medium_cache
@feed_autodetect = []
- @feed_url = Configuration::blog_feed
+ @feed_url = AlaveteliConfiguration::blog_feed
separator = @feed_url.include?('?') ? '&' : '?'
@feed_url = "#{@feed_url}#{separator}lang=#{self.locale_from_params()}"
@blog_items = []
@@ -84,7 +84,7 @@ class GeneralController < ApplicationController
@feed_autodetect = [{:url => @feed_url, :title => "#{site_name} blog"}]
end
end
- @twitter_user = Configuration::twitter_username
+ @twitter_user = AlaveteliConfiguration::twitter_username
end
# Just does a redirect from ?query= search to /query
@@ -109,7 +109,7 @@ class GeneralController < ApplicationController
def search
# XXX Why is this so complicated with arrays and stuff? Look at the route
# in config/routes.rb for comments.
- combined = params[:combined]
+ combined = params[:combined].split("/")
@sortby = nil
@bodies = @requests = @users = true
if combined.size > 0 && (['advanced'].include?(combined[-1]))
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index 573abac63..5ab44fe1a 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -18,7 +18,7 @@ class HelpController < ApplicationController
end
def contact
- @contact_email = Configuration::contact_email
+ @contact_email = AlaveteliConfiguration::contact_email
# if they clicked remove for link to request/body, remove it
if params[:remove]
@@ -49,14 +49,14 @@ class HelpController < ApplicationController
end
@contact = ContactValidator.new(params[:contact])
if @contact.valid? && !params[:remove]
- ContactMailer.deliver_to_admin_message(
+ ContactMailer.to_admin_message(
params[:contact][:name],
params[:contact][:email],
params[:contact][:subject],
params[:contact][:message],
@user,
@last_request, @last_body
- )
+ ).deliver
flash[:notice] = _("Your message has been sent. Thank you for getting in touch! We'll get back to you soon.")
redirect_to frontpage_url
return
diff --git a/app/controllers/holiday_controller.rb b/app/controllers/holiday_controller.rb
index 3101c07e3..939f26776 100644
--- a/app/controllers/holiday_controller.rb
+++ b/app/controllers/holiday_controller.rb
@@ -12,7 +12,7 @@ class HolidayController < ApplicationController
def due_date
if params[:holiday]
@request_date = Date.strptime(params[:holiday]) or raise "Invalid date"
- @due_date = Holiday.due_date_from(@request_date, Configuration::reply_late_after_days, Configuration::working_or_calendar_days)
+ @due_date = Holiday.due_date_from(@request_date, AlaveteliConfiguration::reply_late_after_days, AlaveteliConfiguration::working_or_calendar_days)
@skipped = Holiday.all(
:conditions => [ 'day >= ? AND day <= ?',
@request_date.strftime("%F"), @due_date.strftime("%F")
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index aa6980b69..8d4883938 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -16,7 +16,7 @@ class PublicBodyController < ApplicationController
return
end
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
@public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil?
if @public_body.url_name.nil?
@@ -69,7 +69,7 @@ class PublicBodyController < ApplicationController
@public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil?
- PublicBody.with_locale(self.locale_from_params()) do
+ I18n.with_locale(self.locale_from_params()) do
if params[:submitted_view_email]
if verify_recaptcha
flash.discard(:error)
@@ -127,11 +127,9 @@ class PublicBodyController < ApplicationController
@description = _("in the category ‘{{category_name}}’", :category_name=>category_name)
end
end
- PublicBody.with_locale(@locale) do
- @public_bodies = PublicBody.paginate(
- :order => "public_body_translations.name", :page => params[:page], :per_page => 100,
- :conditions => conditions,
- :joins => :translations
+ I18n.with_locale(@locale) do
+ @public_bodies = PublicBody.where(conditions).joins(:translations).order("public_body_translations.name").paginate(
+ :page => params[:page], :per_page => 100
)
render :template => "public_body/list"
end
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index ec5c9d055..33f18e737 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -17,7 +17,7 @@ class RequestController < ApplicationController
@@custom_states_loaded = false
begin
- if ENV["RAILS_ENV"] != "test"
+ if !Rails.env.test?
require 'customstates'
include RequestControllerCustomStates
@@custom_states_loaded = true
@@ -28,7 +28,7 @@ class RequestController < ApplicationController
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 Configuration::force_registration_on_new_request && !authenticated?(
+ if AlaveteliConfiguration::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")
@@ -44,7 +44,7 @@ class RequestController < ApplicationController
end
def show
- if !Configuration::varnish_host.blank?
+ if !AlaveteliConfiguration::varnish_host.blank?
# If varnish is set up to accept PURGEs, then cache for a
# long time
long_cache
@@ -52,7 +52,7 @@ class RequestController < ApplicationController
medium_cache
end
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
# Look up by old style numeric identifiers
if params[:url_title].match(/^[0-9]+$/)
@@ -242,16 +242,19 @@ class RequestController < ApplicationController
# Read parameters in - first the public body (by URL name or id)
if params[:url_name]
if params[:url_name].match(/^[0-9]+$/)
- params[:info_request][:public_body_id] = params[:url_name]
+ params[:info_request][:public_body] = PublicBody.find(params[:url_name])
else
public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
raise ActiveRecord::RecordNotFound.new("None found") if public_body.nil? # XXX proper 404
- params[:info_request][:public_body_id] = public_body.id
+ params[:info_request][:public_body] = public_body
end
elsif params[:public_body_id]
- params[:info_request][:public_body_id] = params[:public_body_id]
+ params[:info_request][:public_body] = PublicBody.find(params[:public_body_id])
+ # Explicitly load the association as this isn't done automatically in newer Rails versions
+ elsif params[:info_request][:public_body_id]
+ params[:info_request][:public_body] = PublicBody.find(params[:info_request][:public_body_id])
end
- if !params[:info_request][:public_body_id]
+ if !params[:info_request][:public_body]
# compulsory to have a body by here, or go to front page which is start of process
redirect_to frontpage_url
return
@@ -344,7 +347,7 @@ class RequestController < ApplicationController
end
if !authenticated?(
- :web => _("To send your FOI request"),
+ :web => _("To send your FOI request").to_str,
:email => _("Then your FOI request to {{public_body_name}} will be sent.",:public_body_name=>@info_request.public_body.name),
:email_subject => _("Confirm your FOI request to ") + @info_request.public_body.name
)
@@ -368,8 +371,8 @@ class RequestController < ApplicationController
replied by then.</p>
<p>If you write about this request (for example in a forum or a blog) please link to this page, and add an
annotation below telling people about your writing.</p>",:law_used_full=>@info_request.law_used_full,
- :late_number_of_days => Configuration::reply_late_after_days)
- redirect_to show_new_request_url(:url_title => @info_request.url_title)
+ :late_number_of_days => AlaveteliConfiguration::reply_late_after_days)
+ redirect_to show_new_request_path(:url_title => @info_request.url_title)
end
# Submitted to the describing state of messages form
@@ -424,6 +427,7 @@ class RequestController < ApplicationController
# admin user (not because you also own the request).
if !info_request.is_actual_owning_user?(authenticated_user)
# Don't give advice on what to do next, as it isn't their request
+ RequestMailer.deliver_old_unclassified_updated(@info_request) if !@info_request.is_external?
if session[:request_game]
flash[:notice] = _('Thank you for updating the status of the request \'<a href="{{url}}">{{info_request_title}}</a>\'. There are some more requests below for you to classify.',:info_request_title=>CGI.escapeHTML(info_request.title), :url=>CGI.escapeHTML(request_path(info_request)))
redirect_to categorise_play_url
@@ -434,6 +438,7 @@ class RequestController < ApplicationController
return
end
+ calculated_status = @info_request.calculate_status
# Display advice for requester on what to do next, as appropriate
flash[:notice] = case info_request.calculate_status
when 'waiting_response'
@@ -708,10 +713,13 @@ class RequestController < ApplicationController
key_path = foi_fragment_cache_path(key)
if foi_fragment_cache_exists?(key_path)
logger.info("Reading cache for #{key_path}")
- raise PermissionDenied.new("Directory listing not allowed") if File.directory?(key_path)
- cached = foi_fragment_cache_read(key_path)
- response.content_type = AlaveteliFileTypes.filename_to_mimetype(params[:file_name].join("/")) || 'application/octet-stream'
- render_for_text(cached)
+
+ if File.directory?(key_path)
+ render :text => "Directory listing not allowed", :status => 403
+ else
+ render :text => foi_fragment_cache_read(key_path),
+ :content_type => (AlaveteliFileTypes.filename_to_mimetype(params[:file_name]) || 'application/octet-stream')
+ end
return
end
@@ -738,7 +746,7 @@ class RequestController < ApplicationController
@incoming_message.binary_mask_stuff!(@attachment.body, @attachment.content_type)
# we don't use @attachment.content_type here, as we want same mime type when cached in cache_attachments above
- response.content_type = AlaveteliFileTypes.filename_to_mimetype(params[:file_name].join("/")) || 'application/octet-stream'
+ response.content_type = AlaveteliFileTypes.filename_to_mimetype(params[:file_name]) || 'application/octet-stream'
render :text => @attachment.body
end
@@ -788,7 +796,7 @@ class RequestController < ApplicationController
raise ActiveRecord::RecordNotFound.new(message)
end
@part_number = params[:part].to_i
- @filename = params[:file_name].join("/")
+ @filename = params[:file_name]
if html_conversion
@original_filename = @filename.gsub(/\.html$/, "")
else
@@ -811,7 +819,7 @@ class RequestController < ApplicationController
# FOI officers can upload a response
def upload_response
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
@info_request = InfoRequest.find_by_url_title!(params[:url_title])
@reason_params = {
@@ -849,7 +857,8 @@ class RequestController < ApplicationController
return
end
- mail = RequestMailer.create_fake_response(@info_request, @user, body, file_name, file_content)
+ mail = RequestMailer.fake_response(@info_request, @user, body, file_name, file_content)
+
@info_request.receive(mail, mail.encoded, true)
flash[:notice] = _("Thank you for responding to this FOI request! Your response has been published below, and a link to your response has been emailed to ") + CGI.escapeHTML(@info_request.user.name) + "."
redirect_to request_url(@info_request)
@@ -863,12 +872,12 @@ class RequestController < ApplicationController
# by making the last work a wildcard, which is quite the same
query = params[:q]
@xapian_requests = perform_search_typeahead(query, InfoRequestEvent)
- render :partial => "request/search_ahead.rhtml"
+ render :partial => "request/search_ahead"
end
def download_entire_request
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
@info_request = InfoRequest.find_by_url_title!(params[:url_title])
# Test for whole request being hidden or requester-only
if !@info_request.all_can_view?
@@ -891,10 +900,10 @@ class RequestController < ApplicationController
if !File.exists?(file_path)
FileUtils.mkdir_p(File.dirname(file_path))
Zip::ZipFile.open(file_path, Zip::ZipFile::CREATE) { |zipfile|
- convert_command = Configuration::html_to_pdf_command
+ convert_command = AlaveteliConfiguration::html_to_pdf_command
done = false
if !convert_command.blank? && File.exists?(convert_command)
- url = "http://#{Configuration::domain}#{request_path(@info_request)}?print_stylesheet=1"
+ url = "http://#{AlaveteliConfiguration::domain}#{request_path(@info_request)}?print_stylesheet=1"
tempfile = Tempfile.new('foihtml2pdf')
output = AlaveteliExternalCommand.run(convert_command, url, tempfile.path)
if !output.nil?
@@ -911,7 +920,7 @@ class RequestController < ApplicationController
end
if !done
@info_request_events = @info_request.info_request_events
- template = File.read(File.join(File.dirname(__FILE__), "..", "views", "request", "simple_correspondence.rhtml"))
+ template = File.read(File.join(File.dirname(__FILE__), "..", "views", "request", "simple_correspondence.html.erb"))
output = ERB.new(template).result(binding)
zipfile.get_output_stream("correspondence.txt") { |f|
f.puts(output)
diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb
index e75dac903..11ed4ac8f 100644
--- a/app/controllers/services_controller.rb
+++ b/app/controllers/services_controller.rb
@@ -6,7 +6,7 @@ class ServicesController < ApplicationController
def other_country_message
text = ""
- iso_country_code = Configuration::iso_country_code.downcase
+ iso_country_code = AlaveteliConfiguration::iso_country_code.downcase
if country_from_ip.downcase != iso_country_code
found_country = WorldFOIWebsites.by_code(country_from_ip)
@@ -36,9 +36,9 @@ class ServicesController < ApplicationController
:content_type => "text/plain",
:layout => false,
:locals => {:name_to => info_request.user_name,
- :name_from => Configuration::contact_name,
+ :name_from => AlaveteliConfiguration::contact_name,
:info_request => info_request, :reason => params[:reason],
- :info_request_url => 'http://' + Configuration::domain + request_path(info_request),
+ :info_request_url => 'http://' + AlaveteliConfiguration::domain + request_path(info_request),
:site_name => site_name}
end
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index 15da7f327..2679cacc9 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -80,10 +80,7 @@ class TrackController < ApplicationController
# Track a search term
def track_search_query
- # XXX should be better thing in rails routes than having to do this
- # join just to get / and . to work in a query.
- query_array = params[:query_array]
- @query = query_array.join("/")
+ @query = params[:query_array]
# XXX more hackery to make alternate formats still work with query_array
if /^(.*)\.json$/.match(@query)
@@ -157,10 +154,10 @@ class TrackController < ApplicationController
def atom_feed_internal
@xapian_object = perform_search([InfoRequestEvent], @track_thing.track_query, @track_thing.params[:feed_sortby], nil, 25, 1)
respond_to do |format|
- format.atom { render :template => 'track/atom_feed', :content_type => "application/atom+xml" }
format.json { render :json => @xapian_object.results.map { |r| r[:model].json_for_api(true,
- lambda { |t| @template.highlight_and_excerpt(t, @xapian_object.words_to_highlight, 150) }
+ lambda { |t| view_context.highlight_and_excerpt(t, @xapian_object.words_to_highlight, 150) }
) } }
+ format.any { render :template => 'track/atom_feed.atom', :layout => false, :content_type => :atom }
end
end
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index fc8b6e014..658daeeff 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -136,7 +136,7 @@ class UserController < ApplicationController
# Login form
def signin
work_out_post_redirect
- @request_from_foreign_country = country_from_ip != Configuration::iso_country_code
+ @request_from_foreign_country = country_from_ip != AlaveteliConfiguration::iso_country_code
# make sure we have cookies
if session.instance_variable_get(:@dbman)
if not session.instance_variable_get(:@dbman).instance_variable_get(:@original)
@@ -190,7 +190,7 @@ class UserController < ApplicationController
# Create new account form
def signup
work_out_post_redirect
- @request_from_foreign_country = country_from_ip != Configuration::iso_country_code
+ @request_from_foreign_country = country_from_ip != AlaveteliConfiguration::iso_country_code
# Make the user and try to save it
@user_signup = User.new(params[:user_signup])
error = false
@@ -222,7 +222,7 @@ class UserController < ApplicationController
post_redirect = PostRedirect.find_by_email_token(params[:email_token])
if post_redirect.nil?
- render :template => 'user/bad_token.rhtml'
+ render :template => 'user/bad_token'
return
end
@@ -288,7 +288,7 @@ class UserController < ApplicationController
post_redirect.user = user_signchangepassword
post_redirect.save!
url = confirm_url(:email_token => post_redirect.email_token)
- UserMailer.deliver_confirm_login(user_signchangepassword, post_redirect.reason_params, url)
+ UserMailer.confirm_login(user_signchangepassword, post_redirect.reason_params, url).deliver
else
# User not found, but still show confirm page to not leak fact user exists
end
@@ -352,7 +352,7 @@ class UserController < ApplicationController
# if new email already in use, send email there saying what happened
user_alreadyexists = User.find_user_by_email(@signchangeemail.new_email)
if user_alreadyexists
- UserMailer.deliver_changeemail_already_used(@user.email, @signchangeemail.new_email)
+ UserMailer.changeemail_already_used(@user.email, @signchangeemail.new_email).deliver
# it is important this screen looks the same as the one below, so
# you can't change to someone's email in order to tell if they are
# registered with that email on the site
@@ -373,7 +373,7 @@ class UserController < ApplicationController
post_redirect.save!
url = confirm_url(:email_token => post_redirect.email_token)
- UserMailer.deliver_changeemail_confirm(@user, @signchangeemail.new_email, url)
+ UserMailer.changeemail_confirm(@user, @signchangeemail.new_email, url).deliver
# it is important this screen looks the same as the one above, so
# you can't change to someone's email in order to tell if they are
# registered with that email on the site
@@ -419,13 +419,13 @@ class UserController < ApplicationController
params[:contact][:email] = @user.email
@contact = ContactValidator.new(params[:contact])
if @contact.valid?
- ContactMailer.deliver_user_message(
+ ContactMailer.user_message(
@user,
@recipient_user,
user_url(@user),
params[:contact][:subject],
params[:contact][:message]
- )
+ ).deliver
flash[:notice] = _("Your message to {{recipient_user_name}} has been sent!",:recipient_user_name=>CGI.escapeHTML(@recipient_user.name))
redirect_to user_url(@recipient_user)
return
@@ -465,7 +465,7 @@ class UserController < ApplicationController
@draft_profile_photo = ProfilePhoto.new(:data => file_content, :draft => true)
if !@draft_profile_photo.valid?
# error page (uses @profile_photo's error fields in view to show errors)
- render :template => 'user/set_draft_profile_photo.rhtml'
+ render :template => 'user/set_draft_profile_photo'
return
end
@draft_profile_photo.save
@@ -480,7 +480,7 @@ class UserController < ApplicationController
return
end
- render :template => 'user/set_crop_profile_photo.rhtml'
+ render :template => 'user/set_crop_profile_photo'
return
elsif !params[:submitted_crop_profile_photo].nil?
# crop the draft photo according to jquery parameters and set it as the users photo
@@ -499,7 +499,7 @@ class UserController < ApplicationController
redirect_to set_profile_about_me_url()
end
else
- render :template => 'user/set_draft_profile_photo.rhtml'
+ render :template => 'user/set_draft_profile_photo'
end
end
@@ -631,7 +631,7 @@ class UserController < ApplicationController
post_redirect.save!
url = confirm_url(:email_token => post_redirect.email_token)
- UserMailer.deliver_confirm_login(user, post_redirect.reason_params, url)
+ UserMailer.confirm_login(user, post_redirect.reason_params, url).deliver
render :action => 'confirm'
end
@@ -642,7 +642,7 @@ class UserController < ApplicationController
post_redirect.save!
url = confirm_url(:email_token => post_redirect.email_token)
- UserMailer.deliver_already_registered(user, post_redirect.reason_params, url)
+ UserMailer.already_registered(user, post_redirect.reason_params, url).deliver
render :action => 'confirm' # must be same as for send_confirmation_mail above to avoid leak of presence of email in db
end
diff --git a/app/helpers/config_helper.rb b/app/helpers/config_helper.rb
index 73e12172f..026600ff1 100644
--- a/app/helpers/config_helper.rb
+++ b/app/helpers/config_helper.rb
@@ -1,5 +1,5 @@
module ConfigHelper
def site_name
- Configuration::site_name
+ AlaveteliConfiguration::site_name
end
-end \ No newline at end of file
+end
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index dc5c8f34e..ffa34e345 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -218,6 +218,9 @@ module LinkToHelper
return url
end
+ def search_link(query, variety_postfix = nil, sort_postfix = nil, advanced = nil)
+ link_to h(query), search_url(query)
+ end
def search_path(query, options = {})
search_url(query, options.merge(:only_path => true))
@@ -238,7 +241,7 @@ module LinkToHelper
# TODO: Remove in next release
def main_url(relative_path, append = nil)
warn "[DEPRECATION] main_url is deprecated. Please remove it from your theme."
- url_prefix = "http://" + Configuration::domain
+ url_prefix = "http://" + AlaveteliConfiguration::domain
url = url_prefix + relative_path
if !append.nil?
begin
@@ -282,5 +285,13 @@ module LinkToHelper
def year_from_date(date)
return date.strftime("%Y").strip
end
+
+ #I18n locale switcher
+
+ def locale_switcher(locale, params)
+ params['locale'] = locale
+ return url_for(params)
+ end
+
end
diff --git a/app/helpers/mailer_helper.rb b/app/helpers/mailer_helper.rb
index be2ce47aa..3d4bbac71 100644
--- a/app/helpers/mailer_helper.rb
+++ b/app/helpers/mailer_helper.rb
@@ -1,5 +1,5 @@
module MailerHelper
def contact_from_name_and_email
- "#{Configuration::contact_name} <#{Configuration::contact_email}>"
+ "#{AlaveteliConfiguration::contact_name} <#{AlaveteliConfiguration::contact_email}>"
end
end
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
new file mode 100644
index 000000000..e4178081f
--- /dev/null
+++ b/app/mailers/application_mailer.rb
@@ -0,0 +1,62 @@
+# models/application_mailer.rb:
+# Shared code between different mailers.
+#
+# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
+# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+
+require 'action_mailer/version'
+class ApplicationMailer < ActionMailer::Base
+ # Include all the functions views get, as emails call similar things.
+ helper :application
+ include MailerHelper
+
+ # This really should be the default - otherwise you lose any information
+ # about the errors, and have to do error checking on return codes.
+ self.raise_delivery_errors = true
+
+ def blackhole_email
+ AlaveteliConfiguration::blackhole_prefix+"@"+AlaveteliConfiguration::incoming_email_domain
+ 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.
+ include LinkToHelper
+
+ # Site-wide access to configuration settings
+ include ConfigHelper
+
+ # For each multipart template (e.g. "the_template_file.text.html.erb") available,
+ # add the one from the view path with the highest priority as a part to the mail
+ def render_multipart_templates
+ added_content_types = {}
+ self.view_paths.each do |view_path|
+ Dir.glob("#{view_path}/#{mailer_name}/#{@template}.*").each do |path|
+ template = view_path["#{mailer_name}/#{File.basename(path)}"]
+
+ # Skip unless template has a multipart format
+ next unless template && template.multipart?
+ next if added_content_types[template.content_type] == true
+ @parts << Part.new(
+ :content_type => template.content_type,
+ :disposition => "inline",
+ :charset => charset,
+ :body => render_message(template, @body)
+ )
+ added_content_types[template.content_type] = true
+ end
+ end
+ end
+
+ # Look for the current template in each element of view_paths in order,
+ # return the first
+ def find_template
+ self.view_paths.each do |view_path|
+ if template = view_path["#{mailer_name}/#{@template}"]
+ return template
+ end
+ end
+ return nil
+ end
+end
+
diff --git a/app/models/contact_mailer.rb b/app/mailers/contact_mailer.rb
index abde64928..383f1a6e6 100644
--- a/app/models/contact_mailer.rb
+++ b/app/mailers/contact_mailer.rb
@@ -5,17 +5,13 @@
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
class ContactMailer < ApplicationMailer
-
# Send message to administrator
def to_admin_message(name, email, subject, message, logged_in_user, last_request, last_body)
- @from = name + " <" + email + ">"
- @recipients = contact_from_name_and_email
- @subject = subject
- @body = { :message => message,
- :logged_in_user => logged_in_user ,
- :last_request => last_request,
- :last_body => last_body
- }
+ @message, @logged_in_user, @last_request, @last_body = message, logged_in_user, last_request, last_body
+
+ mail(:from => "#{name} <#{email}>",
+ :to => contact_from_name_and_email,
+ :subject => subject)
end
# We always set Reply-To when we set Return-Path to be different from From,
@@ -26,31 +22,24 @@ class ContactMailer < ApplicationMailer
# Send message to another user
def user_message(from_user, recipient_user, from_user_url, subject, message)
- @from = from_user.name_and_email
+ @message, @from_user, @recipient_user, @from_user_url = message, from_user, recipient_user, from_user_url
+
# Do not set envelope from address to the from_user, so they can't get
# someone's email addresses from transitory bounce messages.
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from
- @recipients = recipient_user.name_and_email
- @subject = subject
- @body = {
- :message => message,
- :from_user => from_user,
- :recipient_user => recipient_user,
- :from_user_url => from_user_url
- }
+ headers('Return-Path' => blackhole_email, 'Reply-To' => from_user.name_and_email)
+
+ mail(:from => from_user.name_and_email,
+ :to => recipient_user.name_and_email,
+ :subject => subject)
end
# Send message to a user from the administrator
def from_admin_message(recipient_user, subject, message)
- @from = contact_from_name_and_email
- @recipients = recipient_user.name_and_email
- @subject = subject
- @body = {
- :message => message,
- :from_user => @from,
- :recipient_user => recipient_user,
- }
- bcc Configuration::contact_email
- end
+ @message, @from_user, @recipient_user = message, contact_from_name_and_email, recipient_user
+ mail(:from => contact_from_name_and_email,
+ :to => recipient_user.name_and_email,
+ :bcc => AlaveteliConfiguration::contact_email,
+ :subject => subject)
+ end
end
diff --git a/app/models/outgoing_mailer.rb b/app/mailers/outgoing_mailer.rb
index 503166b8a..c602359de 100644
--- a/app/models/outgoing_mailer.rb
+++ b/app/mailers/outgoing_mailer.rb
@@ -13,31 +13,29 @@
# throughout the application.
class OutgoingMailer < ApplicationMailer
-
# Email to public body requesting info
def initial_request(info_request, outgoing_message)
+ @info_request, @outgoing_message, @contact_email = info_request, outgoing_message, AlaveteliConfiguration::contact_email
@wrap_lines_as_paragraphs = true
- @from = info_request.incoming_name_and_email
- @recipients = info_request.recipient_name_and_email
- @subject = info_request.email_subject_request
- @headers["message-id"] = OutgoingMailer.id_for_message(outgoing_message)
- @body = {:info_request => info_request, :outgoing_message => outgoing_message,
- :contact_email => Configuration::contact_email }
+ headers["message-id"] = OutgoingMailer.id_for_message(outgoing_message)
+
+ mail(:from => info_request.incoming_name_and_email,
+ :to => info_request.recipient_name_and_email,
+ :subject => info_request.email_subject_request)
end
# Later message to public body regarding existing request
def followup(info_request, outgoing_message, incoming_message_followup)
+ @info_request, @outgoing_message, @incoming_message_followup, @contact_email = info_request, outgoing_message, incoming_message_followup, AlaveteliConfiguration::contact_email
@wrap_lines_as_paragraphs = true
- @from = info_request.incoming_name_and_email
- @recipients = OutgoingMailer.name_and_email_for_followup(info_request, incoming_message_followup)
- @subject = OutgoingMailer.subject_for_followup(info_request, outgoing_message)
- @headers["message-id"] = OutgoingMailer.id_for_message(outgoing_message)
- @body = {:info_request => info_request, :outgoing_message => outgoing_message,
- :incoming_message_followup => incoming_message_followup,
- :contact_email => Configuration::contact_email }
+ headers["message-id"] = OutgoingMailer.id_for_message(outgoing_message)
+
+ mail(:from => info_request.incoming_name_and_email,
+ :to => OutgoingMailer.name_and_email_for_followup(info_request, incoming_message_followup),
+ :subject => OutgoingMailer.subject_for_followup(info_request, outgoing_message))
end
- # XXX the condition checking valid_to_reply_to? also appears in views/request/_followup.rhtml,
+ # XXX the condition checking valid_to_reply_to? also appears in views/request/_followup.html.erb,
# it shouldn't really, should call something here.
# XXX also OutgoingMessage.get_salutation
# XXX these look like they should be members of IncomingMessage, but logically they
@@ -90,7 +88,7 @@ class OutgoingMailer < ApplicationMailer
message_id = "ogm-" + outgoing_message.id.to_s
t = Time.now
message_id += "+" + '%08x%05x-%04x' % [t.to_i, t.tv_usec, rand(0xffff)]
- message_id += "@" + Configuration::incoming_email_domain
+ message_id += "@" + AlaveteliConfiguration::incoming_email_domain
return "<" + message_id + ">"
end
diff --git a/app/models/request_mailer.rb b/app/mailers/request_mailer.rb
index 955f73ef4..3e0b05b65 100644
--- a/app/models/request_mailer.rb
+++ b/app/mailers/request_mailer.rb
@@ -5,86 +5,85 @@
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
require 'alaveteli_file_types'
-if Rails.env == 'test' && RUBY_VERSION.to_f >= 1.9
- # Avoid spec/script/mailin_spec.rb running script/runner as a test suite
- # http://stackoverflow.com/questions/1899009/why-are-tests-running-in-production-mode-and-causing-my-script-runners-to-fail
- Test::Unit.run = true
-end
-class RequestMailer < ApplicationMailer
-
+class RequestMailer < ApplicationMailer
# Used when an FOI officer uploads a response from their web browser - this is
# the "fake" email used to store in the same format in the database as if they
# had emailed it.
- def fake_response(info_request, from_user, body, attachment_name, attachment_content)
- @from = from_user.name_and_email
- @recipients = info_request.incoming_name_and_email
- @body = {
- :body => body
- }
+ def fake_response(info_request, from_user, message_body, attachment_name, attachment_content)
+ @message_body = message_body
+
if !attachment_name.nil? && !attachment_content.nil?
content_type = AlaveteliFileTypes.filename_to_mimetype(attachment_name) || 'application/octet-stream'
- attachment :content_type => content_type,
- :body => attachment_content,
- :filename => attachment_name
+ attachments[attachment_name] = {:content => attachment_content,
+ :content_type => content_type}
end
+
+ mail(:from => from_user.name_and_email,
+ :to => info_request.incoming_name_and_email)
end
# Used when a response is uploaded using the API
- def external_response(info_request, body, sent_at, attachments)
- @from = blackhole_email
- @recipients = info_request.incoming_name_and_email
- @body = { :body => body }
-
- # ActionMailer only works properly when the time is in the local timezone:
- # see https://rails.lighthouseapp.com/projects/8994/tickets/3113-actionmailer-only-works-correctly-with-sent_on-times-that-are-in-the-local-time-zone
- @sent_on = sent_at.dup.localtime
+ def external_response(info_request, message_body, sent_at, attachment_hashes)
+ @message_body = message_body
- attachments.each do |attachment_hash|
- attachment attachment_hash
+ attachment_hashes.each do |attachment_hash|
+ attachments[attachment_hash[:filename]] = {:content => attachment_hash[:body],
+ :content_type => attachment_hash[:content_type]}
end
+
+ mail(:from => blackhole_email,
+ :to => info_request.incoming_name_and_email,
+ :date => sent_at)
end
# Incoming message arrived for a request, but new responses have been stopped.
def stopped_responses(info_request, email, raw_email_data)
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # we don't care about bounces, likely from spammers
- 'Auto-Submitted' => 'auto-replied' # http://tools.ietf.org/html/rfc3834
- @recipients = email.from_addrs[0].to_s
- @subject = _("Your response to an FOI request was not delivered")
- attachment :content_type => 'message/rfc822', :body => raw_email_data,
- :filename => "original.eml", :transfer_encoding => '7bit', :content_disposition => 'inline'
- @body = {
- :info_request => info_request,
- :contact_email => Configuration::contact_email
- }
+ headers('Return-Path' => blackhole_email, # we don't care about bounces, likely from spammers
+ 'Auto-Submitted' => 'auto-replied') # http://tools.ietf.org/html/rfc3834
+
+ attachments.inline["original.eml"] = raw_email_data
+
+ @info_request = info_request
+ @contact_email = AlaveteliConfiguration::contact_email
+
+ mail(:to => email.from_addrs[0].to_s,
+ :from => contact_from_name_and_email,
+ :reply_to => contact_from_name_and_email,
+ :subject => _("Your response to an FOI request was not delivered"))
end
# An FOI response is outside the scope of the system, and needs admin attention
- def requires_admin(info_request, set_by = nil, message = "")
+ def requires_admin(info_request, set_by = nil)
user = set_by || info_request.user
- @from = user.name_and_email
- @recipients = contact_from_name_and_email
- @subject = _("FOI response requires admin ({{reason}}) - {{title}}", :reason => info_request.described_state, :title => info_request.title)
- url = request_url(info_request)
- admin_url = admin_request_show_url(info_request)
- @body = {:reported_by => user, :message => message, :info_request => info_request, :url => url, :admin_url => admin_url }
+ @reported_by = user
+ @url = request_url(info_request)
+ @admin_url = admin_request_show_url(info_request)
+ @info_request = info_request
+
+ mail(:from => user.name_and_email,
+ :to => contact_from_name_and_email,
+ :subject => _("FOI response requires admin ({{reason}}) - {{title}}", :reason => info_request.described_state, :title => info_request.title))
end
# Tell the requester that a new response has arrived
def new_response(info_request, incoming_message)
# Don't use login link here, just send actual URL. This is
# because people tend to forward these emails amongst themselves.
- url = incoming_message_url(incoming_message)
+ @url = incoming_message_url(incoming_message)
+ @incoming_message, @info_request = incoming_message, info_request
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
+ headers('Return-Path' => blackhole_email,
'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
- 'X-Auto-Response-Suppress' => 'OOF'
- @recipients = info_request.user.name_and_email
- @subject = (_("New response to your FOI request - ") + info_request.title).html_safe
- @body = { :incoming_message => incoming_message, :info_request => info_request, :url => url }
+ 'X-Auto-Response-Suppress' => 'OOF')
+
+ mail(:from => contact_from_name_and_email,
+ :to => info_request.user.name_and_email,
+ :subject => _("New response to your FOI request - ") + info_request.title,
+ :charset => "UTF-8",
+ # not much we can do if the user's email is broken
+ :reply_to => contact_from_name_and_email)
end
# Tell the requester that the public body is late in replying
@@ -92,18 +91,21 @@ class RequestMailer < ApplicationMailer
respond_url = respond_to_last_url(info_request) + "#followup"
post_redirect = PostRedirect.new(
- :uri => respond_url,
+ :uri => respond_to_last_url(info_request) + "#followup",
:user_id => user.id)
post_redirect.save!
url = confirm_url(:email_token => post_redirect.email_token)
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
+ @url = confirm_url(:email_token => post_redirect.email_token)
+ @info_request = info_request
+
+ headers('Return-Path' => blackhole_email, 'Reply-To' => contact_from_name_and_email, # not much we can do if the user's email is broken
'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
- 'X-Auto-Response-Suppress' => 'OOF'
- @recipients = user.name_and_email
- @subject = (_("Delayed response to your FOI request - ") + info_request.title).html_safe
- @body = { :info_request => info_request, :url => url }
+ 'X-Auto-Response-Suppress' => 'OOF')
+
+ mail(:from => contact_from_name_and_email,
+ :to => user.name_and_email,
+ :subject => _("Delayed response to your FOI request - ") + info_request.title).html_safe
end
# Tell the requester that the public body is very late in replying
@@ -111,18 +113,19 @@ class RequestMailer < ApplicationMailer
respond_url = respond_to_last_url(info_request) + "#followup"
post_redirect = PostRedirect.new(
- :uri => respond_url,
+ :uri => respond_to_last_url(info_request) + "#followup",
:user_id => user.id)
post_redirect.save!
- url = confirm_url(:email_token => post_redirect.email_token)
+ @url = confirm_url(:email_token => post_redirect.email_token)
+ @info_request = info_request
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
+ headers('Return-Path' => blackhole_email, 'Reply-To' => contact_from_name_and_email, # not much we can do if the user's email is broken
'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
- 'X-Auto-Response-Suppress' => 'OOF'
- @recipients = user.name_and_email
- @subject = (_("You're long overdue a response to your FOI request - ") + info_request.title).html_safe
- @body = { :info_request => info_request, :url => url }
+ 'X-Auto-Response-Suppress' => 'OOF')
+
+ mail(:from => contact_from_name_and_email,
+ :to => user.name_and_email,
+ :subject => _("You're long overdue a response to your FOI request - ") + info_request.title).html_safe
end
# Tell the requester that they need to say if the new response
@@ -134,27 +137,31 @@ class RequestMailer < ApplicationMailer
:uri => request_url(info_request) + "#describe_state_form_1",
:user_id => info_request.user.id)
post_redirect.save!
- url = confirm_url(:email_token => post_redirect.email_token)
+ @url = confirm_url(:email_token => post_redirect.email_token)
+ @incoming_message = incoming_message
+ @info_request = info_request
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
+ headers('Return-Path' => blackhole_email, 'Reply-To' => contact_from_name_and_email, # not much we can do if the user's email is broken
'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
- 'X-Auto-Response-Suppress' => 'OOF'
- @recipients = info_request.user.name_and_email
- @subject = _("Was the response you got to your FOI request any good?")
- @body = { :incoming_message => incoming_message, :info_request => info_request, :url => url }
+ 'X-Auto-Response-Suppress' => 'OOF')
+
+ mail(:from => contact_from_name_and_email,
+ :to => info_request.user.name_and_email,
+ :subject => _("Was the response you got to your FOI request any good?"))
end
# Tell the requester that someone updated their old unclassified request
def old_unclassified_updated(info_request)
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
+ @url = request_url(info_request)
+ @info_request = info_request
+
+ headers('Return-Path' => blackhole_email, 'Reply-To' => contact_from_name_and_email, # not much we can do if the user's email is broken
'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
- 'X-Auto-Response-Suppress' => 'OOF'
- @recipients = info_request.user.name_and_email
- @subject = _("Someone has updated the status of your request")
- url = request_url(info_request)
- @body = {:info_request => info_request, :url => url}
+ 'X-Auto-Response-Suppress' => 'OOF')
+
+ mail(:from => contact_from_name_and_email,
+ :to => info_request.user.name_and_email,
+ :subject => _("Someone has updated the status of your request"))
end
# Tell the requester that they need to clarify their request
@@ -166,35 +173,43 @@ class RequestMailer < ApplicationMailer
:uri => respond_url,
:user_id => info_request.user.id)
post_redirect.save!
- url = confirm_url(:email_token => post_redirect.email_token)
+ @url = confirm_url(:email_token => post_redirect.email_token)
+ @incoming_message = incoming_message
+ @info_request = info_request
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
+ headers('Return-Path' => blackhole_email, 'Reply-To' => contact_from_name_and_email, # not much we can do if the user's email is broken
'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
- 'X-Auto-Response-Suppress' => 'OOF'
- @recipients = info_request.user.name_and_email
- @subject = (_("Clarify your FOI request - ") + info_request.title).html_safe
- @body = { :incoming_message => incoming_message, :info_request => info_request, :url => url }
+ 'X-Auto-Response-Suppress' => 'OOF')
+
+ mail(:from => contact_from_name_and_email,
+ :to => info_request.user.name_and_email,
+ :subject => _("Clarify your FOI request - ") + info_request.title)
end
# Tell requester that somebody add an annotation to their request
def comment_on_alert(info_request, comment)
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
+ @comment, @info_request = comment, info_request
+ @url = comment_url(comment)
+
+ headers('Return-Path' => blackhole_email, 'Reply-To' => contact_from_name_and_email, # not much we can do if the user's email is broken
'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
- 'X-Auto-Response-Suppress' => 'OOF'
- @recipients = info_request.user.name_and_email
- @subject = (_("Somebody added a note to your FOI request - ") + info_request.title).html_safe
- @body = { :comment => comment, :info_request => info_request, :url => comment_url(comment) }
+ 'X-Auto-Response-Suppress' => 'OOF')
+
+ mail(:from => contact_from_name_and_email,
+ :to => info_request.user.name_and_email,
+ :subject => _("Somebody added a note to your FOI request - ") + info_request.title).html_safe
end
def comment_on_alert_plural(info_request, count, earliest_unalerted_comment)
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
+ @count, @info_request = count, info_request
+ @url = main_url(comment_url(earliest_unalerted_comment))
+
+ headers('Return-Path' => blackhole_email, 'Reply-To' => contact_from_name_and_email, # not much we can do if the user's email is broken
'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
- 'X-Auto-Response-Suppress' => 'OOF'
- @recipients = info_request.user.name_and_email
- @subject = (_("Some notes have been added to your FOI request - ") + info_request.title).html_safe
- @body = { :count => count, :info_request => info_request, :url => comment_url(earliest_unalerted_comment) }
+ 'X-Auto-Response-Suppress' => 'OOF')
+
+ mail(:from => contact_from_name_and_email,
+ :to => info_request.user.name_and_email,
+ :subject => _("Some notes have been added to your FOI request - ") + info_request.title).html_safe
end
# Class function, called by script/mailin with all incoming responses.
@@ -307,9 +322,9 @@ class RequestMailer < ApplicationMailer
# (otherwise they are banned, and there is no point sending it)
if info_request.user.can_make_followup?
if calculated_status == 'waiting_response_overdue'
- RequestMailer.deliver_overdue_alert(info_request, info_request.user)
+ RequestMailer.overdue_alert(info_request, info_request.user).deliver
elsif calculated_status == 'waiting_response_very_overdue'
- RequestMailer.deliver_very_overdue_alert(info_request, info_request.user)
+ RequestMailer.very_overdue_alert(info_request, info_request.user).deliver
else
raise "unknown request status"
end
@@ -323,7 +338,7 @@ class RequestMailer < ApplicationMailer
# Send email alerts for new responses which haven't been classified. By default,
# it goes out 3 days after last update of event, then after 10, then after 24.
def self.alert_new_response_reminders
- Configuration::new_response_reminder_after_days.each_with_index do |days, i|
+ AlaveteliConfiguration::new_response_reminder_after_days.each_with_index do |days, i|
self.alert_new_response_reminders_internal(days, "new_response_reminder_#{i+1}")
end
end
@@ -348,7 +363,7 @@ class RequestMailer < ApplicationMailer
store_sent.alert_type = type_code
store_sent.info_request_event_id = alert_event_id
# XXX uses same template for reminder 1 and reminder 2 right now.
- RequestMailer.deliver_new_response_reminder_alert(info_request, last_response_message)
+ RequestMailer.new_response_reminder_alert(info_request, last_response_message).deliver
store_sent.save!
end
end
@@ -376,7 +391,7 @@ class RequestMailer < ApplicationMailer
# Only send the alert if the user can act on it by making a followup
# (otherwise they are banned, and there is no point sending it)
if info_request.user.can_make_followup?
- RequestMailer.deliver_not_clarified_alert(info_request, last_response_message)
+ RequestMailer.not_clarified_alert(info_request, last_response_message).deliver
end
store_sent.save!
end
@@ -440,9 +455,9 @@ class RequestMailer < ApplicationMailer
store_sent.alert_type = 'comment_1'
store_sent.info_request_event_id = last_comment_event.id
if count > 1
- RequestMailer.deliver_comment_on_alert_plural(info_request, count, earliest_unalerted_comment_event.comment)
+ RequestMailer.comment_on_alert_plural(info_request, count, earliest_unalerted_comment_event.comment).deliver
elsif count == 1
- RequestMailer.deliver_comment_on_alert(info_request, last_comment_event.comment)
+ RequestMailer.comment_on_alert(info_request, last_comment_event.comment).deliver
else
raise "internal error"
end
diff --git a/app/models/track_mailer.rb b/app/mailers/track_mailer.rb
index 51440e4d7..ea5489726 100644
--- a/app/models/track_mailer.rb
+++ b/app/mailers/track_mailer.rb
@@ -6,26 +6,27 @@
class TrackMailer < ApplicationMailer
def event_digest(user, email_about_things)
+ @user, @email_about_things = user, email_about_things
+
post_redirect = PostRedirect.new(
:uri => user_url(user) + "#email_subscriptions",
:user_id => user.id)
post_redirect.save!
- unsubscribe_url = confirm_url(:email_token => post_redirect.email_token)
+ @unsubscribe_url = confirm_url(:email_token => post_redirect.email_token)
- @from = contact_from_name_and_email
- headers 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
- 'Precedence' => 'bulk' # http://www.vbulletin.com/forum/project.php?issueid=27687 (Exchange hack)
+ headers('Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
+ 'Precedence' => 'bulk')# http://www.vbulletin.com/forum/project.php?issueid=27687 (Exchange hack)
# 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces for tracks
# (We let it return bounces for now, so we can manually kill the tracks that bounce so Yahoo
# etc. don't decide we are spammers.)
- @recipients = user.name_and_email
- @subject = _("Your {{site_name}} email alert", :site_name => site_name)
- @body = { :user => user, :email_about_things => email_about_things, :unsubscribe_url => unsubscribe_url }
+ mail(:from => contact_from_name_and_email,
+ :to => user.name_and_email,
+ :subject => _("Your {{site_name}} email alert", :site_name => site_name))
end
def contact_from_name_and_email
- "#{Configuration::track_sender_name} <#{Configuration::track_sender_email}>"
+ "#{AlaveteliConfiguration::track_sender_name} <#{AlaveteliConfiguration::track_sender_email}>"
end
# Send email alerts for tracked things. Never more than one email
@@ -91,10 +92,9 @@ class TrackMailer < ApplicationMailer
if email_about_things.size > 0
# Send the email
- previous_locale = I18n.locale
- I18n.locale = user.get_locale
- TrackMailer.deliver_event_digest(user, email_about_things)
- I18n.locale = previous_locale
+ I18n.with_locale(user.get_locale) do
+ TrackMailer.event_digest(user, email_about_things).deliver
+ end
end
# Record that we've now sent those alerts to that user
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
new file mode 100644
index 000000000..d9d15ec68
--- /dev/null
+++ b/app/mailers/user_mailer.rb
@@ -0,0 +1,44 @@
+# models/user_mailer.rb:
+# Emails relating to user accounts. e.g. Confirming a new account
+#
+# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
+# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+
+class UserMailer < ApplicationMailer
+ def confirm_login(user, reasons, url)
+ @reasons, @name, @url = reasons, user.name, url
+ headers('Return-Path' => blackhole_email, 'Reply-To' => contact_from_name_and_email) # we don't care about bounces when people are fiddling with their account
+
+ mail(:from => contact_from_name_and_email,
+ :to => user.name_and_email,
+ :subject => reasons[:email_subject])
+ end
+
+ def already_registered(user, reasons, url)
+ @reasons, @name, @url = reasons, user.name, url
+ headers('Return-Path' => blackhole_email, 'Reply-To' => contact_from_name_and_email) # we don't care about bounces when people are fiddling with their account
+
+ mail(:from => contact_from_name_and_email,
+ :to => user.name_and_email,
+ :subject => reasons[:email_subject])
+ end
+
+ def changeemail_confirm(user, new_email, url)
+ @name, @url, @old_email, @new_email = user.name, url, user.email, new_email
+ headers('Return-Path' => blackhole_email, 'Reply-To' => contact_from_name_and_email) # we don't care about bounces when people are fiddling with their account
+
+ mail(:from => contact_from_name_and_email,
+ :to => new_email,
+ :subject => _("Confirm your new email address on {{site_name}}", :site_name => site_name))
+ end
+
+ def changeemail_already_used(old_email, new_email)
+ @old_email, @new_email = old_email, new_email
+ headers('Return-Path' => blackhole_email, 'Reply-To' => contact_from_name_and_email) # we don't care about bounces when people are fiddling with their account
+
+ mail(:from => contact_from_name_and_email,
+ :to => new_email,
+ :subject => _("Unable to change email address on {{site_name}}", :site_name=>site_name))
+ end
+end
+
diff --git a/app/models/about_me_validator.rb b/app/models/about_me_validator.rb
index 8ee505ac8..1b594873c 100644
--- a/app/models/about_me_validator.rb
+++ b/app/models/about_me_validator.rb
@@ -1,25 +1,23 @@
-# == Schema Information
-# Schema version: 114
-#
-# Table name: about_me_validators
-#
-# about_me :text default("I..."), not null
-#
-
# models/about_me_validator.rb:
# Validates editing about me text on user profile pages.
#
# Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-class AboutMeValidator < ActiveRecord::BaseWithoutTable
- strip_attributes!
+class AboutMeValidator
+ include ActiveModel::Validations
- column :about_me, :text, "I...", false
+ attr_accessor :about_me
# TODO: Switch to built in validations
validate :length_of_about_me
+ def initialize(attributes = {})
+ attributes.each do |name, value|
+ send("#{name}=", value)
+ end
+ end
+
private
def length_of_about_me
diff --git a/app/models/application_mailer.rb b/app/models/application_mailer.rb
deleted file mode 100644
index 1a97a4bf9..000000000
--- a/app/models/application_mailer.rb
+++ /dev/null
@@ -1,164 +0,0 @@
-# models/application_mailer.rb:
-# Shared code between different mailers.
-#
-# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-
-require 'action_mailer/version'
-class ApplicationMailer < ActionMailer::Base
- # Include all the functions views get, as emails call similar things.
- helper :application
- include MailerHelper
-
- # This really should be the default - otherwise you lose any information
- # about the errors, and have to do error checking on return codes.
- self.raise_delivery_errors = true
-
- def blackhole_email
- Configuration::blackhole_prefix+"@"+Configuration::incoming_email_domain
- 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.
- include LinkToHelper
-
- # Site-wide access to configuration settings
- include ConfigHelper
-
- # Instantiate a new mailer object. If +method_name+ is not +nil+, the mailer
- # will be initialized according to the named method. If not, the mailer will
- # remain uninitialized (useful when you only need to invoke the "receive"
- # method, for instance).
- def initialize(method_name=nil, *parameters) #:nodoc:
- create!(method_name, *parameters) if method_name
- end
-
- # For each multipart template (e.g. "the_template_file.text.html.erb") available,
- # add the one from the view path with the highest priority as a part to the mail
- def render_multipart_templates
- added_content_types = {}
- self.view_paths.each do |view_path|
- Dir.glob("#{view_path}/#{mailer_name}/#{@template}.*").each do |path|
- template = view_path["#{mailer_name}/#{File.basename(path)}"]
-
- # Skip unless template has a multipart format
- next unless template && template.multipart?
- next if added_content_types[template.content_type] == true
- @parts << Part.new(
- :content_type => template.content_type,
- :disposition => "inline",
- :charset => charset,
- :body => render_message(template, @body)
- )
- added_content_types[template.content_type] = true
- end
- end
- end
-
- # Look for the current template in each element of view_paths in order,
- # return the first
- def find_template
- self.view_paths.each do |view_path|
- if template = view_path["#{mailer_name}/#{@template}"]
- return template
- end
- end
- return nil
- end
-
- if ActionMailer::VERSION::MAJOR == 2
-
- # This method is a customised version of ActionMailer::Base.create!
- # modified to allow templates to be selected correctly for multipart
- # mails when themes have added to the view_paths. The problem from our
- # point of view with ActionMailer::Base is that it sets template_root to
- # the first element of the view_paths array and then uses only that (directly
- # and via template_path, which is created from it) in the create! method when
- # looking for templates. Our modified version looks for templates in the view_paths
- # in order.
-
- # It also has a line converting the mail subject to a string. This is because we
- # use translated strings in the subject lines, sometimes in conjunction with
- # user input, like request titles. The _() function used for translation
- # returns an instance of SafeBuffer, which doesn't handle gsub calls in the block form
- # with $ variables - https://github.com/rails/rails/issues/1555.
- # Unfortunately ActionMailer uses that form in quoted_printable(), which will be
- # called if any part of the subject requires quoting. So we convert the subject
- # back to a string via to_str() before passing in to create_mail. There is a test
- # for this in spec/models/request_mailer_spec.rb
-
- # Changed lines marked with ***
-
- # Initialize the mailer via the given +method_name+. The body will be
- # rendered and a new TMail::Mail object created.
- def create!(method_name, *parameters) #:nodoc:
- initialize_defaults(method_name)
- __send__(method_name, *parameters)
-
- # If an explicit, textual body has not been set, we check assumptions.
- unless String === @body
- # First, we look to see if there are any likely templates that match,
- # which include the content-type in their file name (i.e.,
- # "the_template_file.text.html.erb", etc.). Only do this if parts
- # have not already been specified manually.
- if @parts.empty?
- # *** render_multipart_templates replaces the following code
- # Dir.glob("#{template_path}/#{@template}.*").each do |path|
- # template = template_root["#{mailer_name}/#{File.basename(path)}"]
- #
- # # Skip unless template has a multipart format
- # next unless template && template.multipart?
- #
- # @parts << Part.new(
- # :content_type => template.content_type,
- # :disposition => "inline",
- # :charset => charset,
- # :body => render_message(template, @body)
- # )
- # end
- render_multipart_templates
-
- unless @parts.empty?
- @content_type = "multipart/alternative" if @content_type !~ /^multipart/
- @parts = sort_parts(@parts, @implicit_parts_order)
- end
- end
-
- # Then, if there were such templates, we check to see if we ought to
- # also render a "normal" template (without the content type). If a
- # normal template exists (or if there were no implicit parts) we render
- # it.
- template_exists = @parts.empty?
-
- # *** find_template replaces template_root call
- # template_exists ||= template_root["#{mailer_name}/#{@template}"]
- template_exists ||= find_template
-
- @body = render_message(@template, @body) if template_exists
-
- # Finally, if there are other message parts and a textual body exists,
- # we shift it onto the front of the parts and set the body to nil (so
- # that create_mail doesn't try to render it in addition to the parts).
- if !@parts.empty? && String === @body
- @parts.unshift ActionMailer::Part.new(:charset => charset, :body => @body)
- @body = nil
- end
- end
-
- # If this is a multipart e-mail add the mime_version if it is not
- # already set.
- @mime_version ||= "1.0" if !@parts.empty?
-
- # *** Convert into a string
- @subject = @subject.to_str if @subject
-
- # build the mail object itself
- @mail = create_mail
- end
- else
- raise "ApplicationMailer.create! is obsolete - find another way to ensure that themes can override mail templates for multipart mails"
- end
-
-end
-
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb
index f40ab6fbb..ec66074b7 100644
--- a/app/models/censor_rule.rb
+++ b/app/models/censor_rule.rb
@@ -33,13 +33,15 @@ class CensorRule < ActiveRecord::Base
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}}
+ 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; ")
+ [:info_request, :user, :public_body].each do |a|
+ errors.add(a, "Rule must apply to an info request, a user or a body")
+ end
end
end
diff --git a/app/models/change_email_validator.rb b/app/models/change_email_validator.rb
index 2ddebb177..00b1320a2 100644
--- a/app/models/change_email_validator.rb
+++ b/app/models/change_email_validator.rb
@@ -1,36 +1,27 @@
-# == Schema Information
-# Schema version: 114
-#
-# Table name: change_email_validators
-#
-# old_email :string
-# new_email :string
-# password :string
-# user_circumstance :string
-#
-
# models/changeemail_validator.rb:
# Validates email change form submissions.
#
# Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-class ChangeEmailValidator < ActiveRecord::BaseWithoutTable
- strip_attributes!
-
- column :old_email, :string
- column :new_email, :string
- column :password, :string
- column :user_circumstance, :string
+class ChangeEmailValidator
+ include ActiveModel::Validations
- attr_accessor :logged_in_user
+ attr_accessor :old_email, :new_email, :password, :user_circumstance, :logged_in_user
validates_presence_of :old_email, :message => N_("Please enter your old email address")
validates_presence_of :new_email, :message => N_("Please enter your new email address")
validates_presence_of :password, :message => N_("Please enter your password"), :unless => :changing_email
validate :password_and_format_of_email
- def changing_email()
+ def initialize(attributes = {})
+ attributes.each do |name, value|
+ send("#{name}=", value)
+ end
+ end
+
+
+ def changing_email
self.user_circumstance == 'change_email'
end
@@ -41,11 +32,11 @@ class ChangeEmailValidator < ActiveRecord::BaseWithoutTable
errors.add(:old_email, _("Old email doesn't look like a valid address"))
end
- if !errors[:old_email]
+ if errors[:old_email].blank?
if self.old_email.downcase != self.logged_in_user.email.downcase
errors.add(:old_email, _("Old email address isn't the same as the address of the account you are logged in with"))
elsif (!self.changing_email) && (!self.logged_in_user.has_this_password?(self.password))
- if !errors[:password]
+ if errors[:password].blank?
errors.add(:password, _("Password is not correct"))
end
end
@@ -55,5 +46,4 @@ class ChangeEmailValidator < ActiveRecord::BaseWithoutTable
errors.add(:new_email, _("New email doesn't look like a valid address"))
end
end
-
end
diff --git a/app/models/contact_validator.rb b/app/models/contact_validator.rb
index d277161f9..a644de2ea 100644
--- a/app/models/contact_validator.rb
+++ b/app/models/contact_validator.rb
@@ -1,35 +1,29 @@
-# == Schema Information
-# Schema version: 114
-#
-# Table name: contact_validators
-#
-# name :string
-# email :string
-# subject :text
-# message :text
-#
-
# models/contact_validator.rb:
# Validates contact form submissions.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-class ContactValidator < ActiveRecord::BaseWithoutTable
- strip_attributes!
+class ContactValidator
+ include ActiveModel::Validations
- column :name, :string
- column :email, :string
- column :subject, :text
- column :message, :text
+ attr_accessor :name, :email, :subject, :message
validates_presence_of :name, :message => N_("Please enter your name")
validates_presence_of :email, :message => N_("Please enter your email address")
validates_presence_of :subject, :message => N_("Please enter a subject")
validates_presence_of :message, :message => N_("Please enter the message you want to send")
+ validate :email_format
- def validate
- errors.add(:email, _("Email doesn't look like a valid address")) unless MySociety::Validate.is_valid_email(self.email)
+ def initialize(attributes = {})
+ attributes.each do |name, value|
+ send("#{name}=", value)
+ end
end
+ private
+
+ def email_format
+ errors.add(:email, _("Email doesn't look like a valid address")) unless MySociety::Validate.is_valid_email(self.email)
+ end
end
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index bba0b6a8d..a55f98b10 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -38,11 +38,7 @@ class FoiAttachment < ActiveRecord::Base
BODY_MAX_DELAY = 5
def directory
- rails_env = Rails.env
- if rails_env.nil? || rails_env.empty?
- raise "$RAILS_ENV is not set"
- end
- base_dir = File.expand_path(File.join(File.dirname(__FILE__), "../../cache", "attachments_#{rails_env}"))
+ base_dir = File.expand_path(File.join(File.dirname(__FILE__), "../../cache", "attachments_#{Rails.env}"))
return File.join(base_dir, self.hexdigest[0..2])
end
@@ -67,22 +63,9 @@ class FoiAttachment < ActiveRecord::Base
file.write d
}
update_display_size!
- encode_cached_body!
@cached_body = d
end
- # If the original mail part had a charset, it's some kind of string, so assume that
- # it should be handled as a string in the stated charset, not a bytearray, and then
- # convert it our default encoding. For ruby 1.8 this is a noop.
- def encode_cached_body!
- if RUBY_VERSION.to_f >= 1.9
- if charset
- @cached_body.force_encoding(charset)
- @cached_body = @cached_body.encode(Encoding.default_internal, charset)
- end
- end
- end
-
def body
if @cached_body.nil?
tries = 0
@@ -103,7 +86,6 @@ class FoiAttachment < ActiveRecord::Base
self.incoming_message.parse_raw_email!(force)
retry
end
- encode_cached_body!
end
return @cached_body
end
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 5c845ead3..02d04b163 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -37,7 +37,7 @@ require 'rexml/document'
require 'zip/zip'
require 'mapi/msg'
require 'mapi/convert'
-
+require 'iconv'
class IncomingMessage < ActiveRecord::Base
belongs_to :info_request
@@ -193,7 +193,7 @@ class IncomingMessage < ActiveRecord::Base
text.gsub!(self.info_request.public_body.request_email, _("[{{public_body}} request email]", :public_body => self.info_request.public_body.short_or_long_name))
end
text.gsub!(self.info_request.incoming_email, _('[FOI #{{request}} email]', :request => self.info_request.id.to_s) )
- text.gsub!(Configuration::contact_email, _("[{{site_name}} contact email]", :site_name => Configuration::site_name) )
+ text.gsub!(AlaveteliConfiguration::contact_email, _("[{{site_name}} contact email]", :site_name => AlaveteliConfiguration::site_name) )
end
# Replaces all email addresses in (possibly binary data) with equal length alternative ones.
@@ -219,7 +219,7 @@ class IncomingMessage < ActiveRecord::Base
if censored_uncompressed_text != uncompressed_text
# then use the altered file (recompressed)
recompressed_text = nil
- if Configuration::use_ghostscript_compression == true
+ if AlaveteliConfiguration::use_ghostscript_compression == true
command = ["gs", "-sDEVICE=pdfwrite", "-dCompatibilityLevel=1.4", "-dPDFSETTINGS=/screen", "-dNOPAUSE", "-dQUIET", "-dBATCH", "-sOutputFile=-", "-"]
else
command = ["pdftk", "-", "output", "-", "compress"]
@@ -316,7 +316,7 @@ class IncomingMessage < ActiveRecord::Base
text.gsub!(/(Mobile|Mob)([\s\/]*(Fax|Tel))*\s*:?[\s\d]*\d/, "[mobile number]")
# Remove WhatDoTheyKnow signup links
- text.gsub!(/http:\/\/#{Configuration::domain}\/c\/[^\s]+/, "[WDTK login link]")
+ text.gsub!(/http:\/\/#{AlaveteliConfiguration::domain}\/c\/[^\s]+/, "[WDTK login link]")
# Remove things from censor rules
self.info_request.apply_censor_rules_to_text!(text)
@@ -534,7 +534,7 @@ class IncomingMessage < ActiveRecord::Base
source_charset = 'utf-8' if source_charset.nil?
text = Iconv.conv('utf-8//IGNORE', source_charset, text) +
_("\n\n[ {{site_name}} note: The above text was badly encoded, and has had strange characters removed. ]",
- :site_name => Configuration::site_name)
+ :site_name => AlaveteliConfiguration::site_name)
rescue Iconv::InvalidEncoding, Iconv::IllegalSequence, Iconv::InvalidCharacter
if source_charset != "utf-8"
source_charset = "utf-8"
@@ -605,7 +605,7 @@ class IncomingMessage < ActiveRecord::Base
content_type = 'application/octet-stream'
end
hexdigest = Digest::MD5.hexdigest(content)
- attachment = self.foi_attachments.find_or_create_by_hexdigest(:hexdigest => hexdigest)
+ attachment = self.foi_attachments.find_or_create_by_hexdigest(hexdigest)
attachment.update_attributes(:filename => filename,
:content_type => content_type,
:body => content,
@@ -632,14 +632,14 @@ class IncomingMessage < ActiveRecord::Base
attachment_attributes = MailHandler.get_attachment_attributes(self.mail(force))
attachments = []
attachment_attributes.each do |attrs|
- attachment = self.foi_attachments.find_or_create_by_hexdigest(:hexdigest => attrs[:hexdigest])
- body = attrs.delete(:body)
+ attachment = self.foi_attachments.find_or_create_by_hexdigest(attrs[:hexdigest])
attachment.update_attributes(attrs)
- # Set the body separately as its handling can depend on the value of charset
- attachment.body = body
attachment.save!
attachments << attachment.id
end
+ # Reload to refresh newly created foi_attachments
+ self.reload
+
main_part = get_main_body_text_part
# we don't use get_main_body_text_internal, as we want to avoid charset
# conversions, since /usr/bin/uudecode needs to deal with those.
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 237364f56..130c5b02c 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -26,8 +26,7 @@
require 'digest/sha1'
class InfoRequest < ActiveRecord::Base
- include ActionView::Helpers::UrlHelper
- include ActionController::UrlWriter
+ include Rails.application.routes.url_helpers
strip_attributes!
@@ -51,7 +50,7 @@ class InfoRequest < ActiveRecord::Base
has_tag_string
- named_scope :visible, :conditions => {:prominence => "normal"}
+ scope :visible, :conditions => {:prominence => "normal"}
# user described state (also update in info_request_event, admin_request/edit.rhtml)
validate :must_be_valid_state
@@ -81,6 +80,11 @@ class InfoRequest < ActiveRecord::Base
'blackhole' # just dump them
]
+ # only check on create, so existing models with mixed case are allowed
+ validate :title_formatting, :on => :create
+
+ after_initialize :set_defaults
+
def self.enumerate_states
states = [
'waiting_response',
@@ -148,7 +152,7 @@ class InfoRequest < ActiveRecord::Base
@@custom_states_loaded = false
begin
- if ENV["RAILS_ENV"] != "test"
+ if !Rails.env.test?
require 'customstates'
include InfoRequestCustomStates
@@custom_states_loaded = true
@@ -456,7 +460,7 @@ public
if !allow
if self.handle_rejected_responses == 'bounce'
- RequestMailer.deliver_stopped_responses(self, email, raw_email_data) if !is_external?
+ RequestMailer.stopped_responses(self, email, raw_email_data).deliver if !is_external?
elsif self.handle_rejected_responses == 'holding_pen'
InfoRequest.holding_pen_request.receive(email, raw_email_data, false, reason)
elsif self.handle_rejected_responses == 'blackhole'
@@ -484,13 +488,13 @@ public
self.awaiting_description = true
params = { :incoming_message_id => incoming_message.id }
if !rejected_reason.empty?
- params[:rejected_reason] = rejected_reason
+ params[:rejected_reason] = rejected_reason.to_str
end
self.log_event("response", params)
self.save!
end
self.info_request_events.each { |event| event.xapian_mark_needs_index } # for the "waiting_classification" index
- RequestMailer.deliver_new_response(self, incoming_message) if !is_external?
+ RequestMailer.new_response(self, incoming_message).deliver if !is_external?
end
@@ -543,6 +547,10 @@ public
# states which require administrator action (hence email administrators
# when they are entered, and offer state change dialog to them)
+ def InfoRequest.requires_admin_states
+ return ['requires_admin', 'error_message', 'attention_requested']
+ end
+
def requires_admin?
['requires_admin', 'error_message', 'attention_requested'].include?(described_state)
end
@@ -564,7 +572,7 @@ public
if self.requires_admin?
# Check there is someone to send the message "from"
if !set_by.nil? || !self.user.nil?
- RequestMailer.deliver_requires_admin(self, set_by, message)
+ RequestMailer.requires_admin(self, set_by, message).deliver
end
end
@@ -694,7 +702,7 @@ public
# last_event_forming_initial_request. There may be more obscure
# things, e.g. fees, not properly covered.
def date_response_required_by
- Holiday.due_date_from(self.date_initial_request_last_sent_at, Configuration::reply_late_after_days, Configuration::working_or_calendar_days)
+ Holiday.due_date_from(self.date_initial_request_last_sent_at, AlaveteliConfiguration::reply_late_after_days, AlaveteliConfiguration::working_or_calendar_days)
end
# This is a long stop - even with UK public interest test extensions, 40
# days is a very long time.
@@ -702,10 +710,10 @@ public
last_sent = last_event_forming_initial_request
if self.public_body.is_school?
# schools have 60 working days maximum (even over a long holiday)
- Holiday.due_date_from(self.date_initial_request_last_sent_at, Configuration::special_reply_very_late_after_days, Configuration::working_or_calendar_days)
+ Holiday.due_date_from(self.date_initial_request_last_sent_at, AlaveteliConfiguration::special_reply_very_late_after_days, AlaveteliConfiguration::working_or_calendar_days)
else
# public interest test ICO guidance gives 40 working maximum
- Holiday.due_date_from(self.date_initial_request_last_sent_at, Configuration::reply_very_late_after_days, Configuration::working_or_calendar_days)
+ Holiday.due_date_from(self.date_initial_request_last_sent_at, AlaveteliConfiguration::reply_very_late_after_days, AlaveteliConfiguration::working_or_calendar_days)
end
end
@@ -791,6 +799,16 @@ public
end
end
+ # Returns last event
+ def get_last_event
+ events = self.info_request_events
+ if events.size == 0
+ return nil
+ else
+ return events[-1]
+ end
+ end
+
# Get previous email sent to
def get_previous_email_sent_to(info_request_event)
last_email = nil
@@ -867,10 +885,10 @@ public
end
def InfoRequest.magic_email_for_id(prefix_part, id)
- magic_email = Configuration::incoming_email_prefix
+ magic_email = AlaveteliConfiguration::incoming_email_prefix
magic_email += prefix_part + id.to_s
magic_email += "-" + InfoRequest.hash_from_id(id)
- magic_email += "@" + Configuration::incoming_email_domain
+ magic_email += "@" + AlaveteliConfiguration::incoming_email_domain
return magic_email
end
@@ -881,7 +899,7 @@ public
end
def InfoRequest.hash_from_id(id)
- return Digest::SHA1.hexdigest(id.to_s + Configuration::incoming_email_secret)[0,8]
+ return Digest::SHA1.hexdigest(id.to_s + AlaveteliConfiguration::incoming_email_secret)[0,8]
end
# Called by find_by_incoming_email - and used to be called by separate
@@ -1104,7 +1122,7 @@ public
before_save :purge_in_cache
def purge_in_cache
- if !Configuration::varnish_host.blank? && !self.id.nil?
+ if !AlaveteliConfiguration::varnish_host.blank? && !self.id.nil?
# we only do this for existing info_requests (new ones have a nil id)
path = url_for(:controller => 'request', :action => 'show', :url_title => self.url_title, :only_path => true, :locale => :none)
req = PurgeRequest.find_by_url(path)
@@ -1122,5 +1140,34 @@ public
yield(column.human_name, self.send(column.name), column.type.to_s, column.name)
end
end
+
+ private
+
+ def set_defaults
+ begin
+ if self.described_state.nil?
+ self.described_state = 'waiting_response'
+ end
+ rescue ActiveModel::MissingAttributeError
+ # this should only happen on Model.exists?() call. It can be safely ignored.
+ # See http://www.tatvartha.com/2011/03/activerecordmissingattributeerror-missing-attribute-a-bug-or-a-features/
+ end
+ # FOI or EIR?
+ if !self.public_body.nil? && self.public_body.eir_only?
+ self.law_used = 'eir'
+ end
+ end
+
+ def title_formatting
+ if !self.title.nil? && !MySociety::Validate.uses_mixed_capitals(self.title, 10)
+ errors.add(:title, _('Please write the summary using a mixture of capital and lower case letters. This makes it easier for others to read.'))
+ end
+ if !self.title.nil? && title.size > 200
+ errors.add(:title, _('Please keep the summary short, like in the subject of an email. You can use a phrase, rather than a full sentence.'))
+ end
+ if !self.title.nil? && self.title =~ /^(FOI|Freedom of Information)\s*requests?$/i
+ errors.add(:title, _('Please describe more what the request is about in the subject. There is no need to say it is an FOI request, we add that on anyway.'))
+ end
+ end
end
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 871b81b1f..b52bb371e 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -405,7 +405,7 @@ class InfoRequestEvent < ActiveRecord::Base
:comment_id => self.comment_id,
# XXX would be nice to add links here, but alas the
- # code to make them is in views only. See views/request/details.rhtml
+ # code to make them is in views only. See views/request/details.html.erb
# perhaps can call with @template somehow
}
diff --git a/app/models/mail_server_log.rb b/app/models/mail_server_log.rb
index 755584b90..77cd23a96 100644
--- a/app/models/mail_server_log.rb
+++ b/app/models/mail_server_log.rb
@@ -53,7 +53,7 @@ class MailServerLog < ActiveRecord::Base
done.save!
f = is_gz ? Zlib::GzipReader.open(file_name) : File.open(file_name, 'r')
- case(Configuration::mta_log_type.to_sym)
+ case(AlaveteliConfiguration::mta_log_type.to_sym)
when :exim
load_exim_log_data(f, done)
when :postfix
@@ -123,13 +123,13 @@ class MailServerLog < ActiveRecord::Base
# We also check the email prefix so that we could, for instance, separately handle a staging and production
# instance running on the same server with different email prefixes.
def MailServerLog.email_addresses_on_line(line)
- prefix = Regexp::quote(Configuration::incoming_email_prefix)
- domain = Regexp::quote(Configuration::incoming_email_domain)
+ prefix = Regexp::quote(AlaveteliConfiguration::incoming_email_prefix)
+ domain = Regexp::quote(AlaveteliConfiguration::incoming_email_domain)
line.scan(/#{prefix}request-[^\s]+@#{domain}/).sort.uniq
end
def MailServerLog.request_sent?(ir)
- case(Configuration::mta_log_type.to_sym)
+ case(AlaveteliConfiguration::mta_log_type.to_sym)
when :exim
request_exim_sent?(ir)
when :postfix
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index c75894e6a..784cf19e2 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -51,6 +51,8 @@ class OutgoingMessage < ActiveRecord::Base
end
end
+ after_initialize :set_default_letter
+
# How the default letter starts and ends
def get_salutation
ret = ""
@@ -86,7 +88,7 @@ class OutgoingMessage < ActiveRecord::Base
"'" + self.info_request.title + "'." +
"\n\n\n\n [ " + self.get_internal_review_insert_here_note + " ] \n\n\n\n" +
"A full history of my FOI request and all correspondence is available on the Internet at this address:\n" +
- "http://" + Configuration::domain + "/request/" + self.info_request.url_title
+ "http://" + AlaveteliConfiguration::domain + "/request/" + self.info_request.url_title
else
""
end
@@ -130,13 +132,6 @@ class OutgoingMessage < ActiveRecord::Base
MySociety::Validate.contains_postcode?(self.body)
end
- # Set default letter
- def after_initialize
- if self.body.nil?
- self.body = get_default_message
- end
- end
-
# Deliver outgoing message
# Note: You can test this from script/console with, say:
# InfoRequest.find(1).outgoing_messages[0].send_message
@@ -147,7 +142,7 @@ class OutgoingMessage < ActiveRecord::Base
self.status = 'sent'
self.save!
- mail_message = OutgoingMailer.deliver_initial_request(self.info_request, self)
+ mail_message = OutgoingMailer.initial_request(self.info_request, self).deliver
self.info_request.log_event(log_event_type, {
:email => mail_message.to_addrs.join(", "),
:outgoing_message_id => self.id,
@@ -159,7 +154,7 @@ class OutgoingMessage < ActiveRecord::Base
self.status = 'sent'
self.save!
- mail_message = OutgoingMailer.deliver_followup(self.info_request, self, self.incoming_message_followup)
+ mail_message = OutgoingMailer.followup(self.info_request, self, self.incoming_message_followup).deliver
self.info_request.log_event('followup_' + log_event_type, {
:email => mail_message.to_addrs.join(", "),
:outgoing_message_id => self.id,
@@ -253,6 +248,12 @@ class OutgoingMessage < ActiveRecord::Base
private
+ def set_default_letter
+ if self.body.nil?
+ self.body = get_default_message
+ end
+ end
+
def format_of_body
if self.body.empty? || self.body =~ /\A#{get_salutation}\s+#{get_signoff}/ || self.body =~ /#{get_internal_review_insert_here_note}/
if self.message_type == 'followup'
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index 31f08c21a..dfca936e2 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -32,6 +32,8 @@ class PostRedirect < ActiveRecord::Base
# Optional, does a login confirm before redirect for use in email links.
belongs_to :user
+ after_initialize :generate_token
+
# We store YAML version of POST parameters in the database
def post_params=(params)
self.post_params_yaml = params.to_yaml
@@ -62,18 +64,6 @@ class PostRedirect < ActiveRecord::Base
MySociety::Util.generate_token
end
- # Make the token
- def after_initialize
- # The token is used to return you to what you are doing after the login form.
- if not self.token
- self.token = PostRedirect.generate_random_token
- end
- # There is a separate token to use in the URL if we send a confirmation email.
- if not self.email_token
- self.email_token = PostRedirect.generate_random_token
- end
- end
-
# Used by (rspec) test code only
def self.get_last_post_redirect
# XXX yeuch - no other easy way of getting the token so we can check
@@ -89,6 +79,18 @@ class PostRedirect < ActiveRecord::Base
PostRedirect.delete_all "updated_at < (now() - interval '2 months')"
end
+ private
+
+ def generate_token
+ # The token is used to return you to what you are doing after the login form.
+ if not self.token
+ self.token = PostRedirect.generate_random_token
+ end
+ # There is a separate token to use in the URL if we send a confirmation email.
+ if not self.email_token
+ self.email_token = PostRedirect.generate_random_token
+ end
+ end
end
diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb
index 73d7ca12b..41cb298b3 100644
--- a/app/models/profile_photo.rb
+++ b/app/models/profile_photo.rb
@@ -29,25 +29,9 @@ class ProfilePhoto < ActiveRecord::Base
attr_accessor :x, :y, :w, :h
- # convert binary data blob into ImageMagick image when assigned
attr_accessor :image
- def after_initialize
- if data.nil?
- self.image = nil
- return
- end
-
- image_list = Magick::ImageList.new
- begin
- image_list.from_blob(data)
- rescue Magick::ImageMagickError
- self.image = nil
- return
- end
- self.image = image_list[0] # XXX perhaps take largest image or somesuch if there were multiple in the file?
- self.convert_image
- end
+ after_initialize :convert_data_to_image
# make image valid format and size
def convert_image
@@ -112,6 +96,25 @@ class ProfilePhoto < ActiveRecord::Base
raise "Internal error, real pictures must have a user"
end
end
+
+ # Convert binary data blob into ImageMagick image when assigned
+ def convert_data_to_image
+ if data.nil?
+ self.image = nil
+ return
+ end
+
+ image_list = Magick::ImageList.new
+ begin
+ image_list.from_blob(data)
+ rescue Magick::ImageMagickError
+ self.image = nil
+ return
+ end
+
+ self.image = image_list[0] # XXX perhaps take largest image or somesuch if there were multiple in the file?
+ self.convert_image
+ end
end
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 168b9f4c7..a76aeb189 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -45,7 +45,7 @@ class PublicBody < ActiveRecord::Base
before_save :set_api_key, :set_default_publication_scheme
# Every public body except for the internal admin one is visible
- named_scope :visible, lambda {
+ scope :visible, lambda {
{
:conditions => "public_bodies.id <> #{PublicBody.internal_admin_body.id}"
}
@@ -54,7 +54,7 @@ class PublicBody < ActiveRecord::Base
translates :name, :short_name, :request_email, :url_name, :notes, :first_letter, :publication_scheme
# Convenience methods for creating/editing translations via forms
- def translation(locale)
+ def find_translation_by_locale(locale)
self.translations.find_by_locale(locale)
end
@@ -79,7 +79,7 @@ class PublicBody < ActiveRecord::Base
if translation_attrs.respond_to? :each_value # Hash => updating
translation_attrs.each_value do |attrs|
next if skip?(attrs)
- t = translation(attrs[:locale]) || PublicBody::Translation.new
+ t = translation_for(attrs[:locale]) || PublicBody::Translation.new
t.attributes = attrs
calculate_cached_fields(t)
t.save!
@@ -106,28 +106,25 @@ class PublicBody < ActiveRecord::Base
# like find_by_url_name but also search historic url_name if none found
def self.find_by_url_name_with_historic(name)
- locale = self.locale || I18n.locale
- PublicBody.with_locale(locale) do
- found = PublicBody.find(:all,
- :conditions => ["public_body_translations.url_name=?", name],
- :joins => :translations,
- :readonly => false)
- # If many bodies are found (usually because the url_name is the same across
- # locales) return any of them
- return found.first if found.size >= 1
-
- # If none found, then search the history of short names
- old = PublicBody::Version.find_all_by_url_name(name)
- # Find unique public bodies in it
- old = old.map { |x| x.public_body_id }
- old = old.uniq
- # Maybe return the first one, so we show something relevant,
- # rather than throwing an error?
- raise "Two bodies with the same historical URL name: #{name}" if old.size > 1
- return unless old.size == 1
- # does acts_as_versioned provide a method that returns the current version?
- return PublicBody.find(old.first)
- end
+ found = PublicBody.find(:all,
+ :conditions => ["public_body_translations.url_name=?", name],
+ :joins => :translations,
+ :readonly => false)
+ # If many bodies are found (usually because the url_name is the same across
+ # locales) return any of them
+ return found.first if found.size >= 1
+
+ # If none found, then search the history of short names
+ old = PublicBody::Version.find_all_by_url_name(name)
+ # Find unique public bodies in it
+ old = old.map { |x| x.public_body_id }
+ old = old.uniq
+ # Maybe return the first one, so we show something relevant,
+ # rather than throwing an error?
+ raise "Two bodies with the same historical URL name: #{name}" if old.size > 1
+ return unless old.size == 1
+ # does acts_as_versioned provide a method that returns the current version?
+ return PublicBody.find(old.first)
end
# Set the first letter, which is used for faster queries
@@ -243,13 +240,13 @@ class PublicBody < ActiveRecord::Base
# When name or short name is changed, also change the url name
def short_name=(short_name)
- globalize.write(self.class.locale || I18n.locale, :short_name, short_name)
+ globalize.write(I18n.locale, :short_name, short_name)
self[:short_name] = short_name
self.update_url_name
end
def name=(name)
- globalize.write(self.class.locale || I18n.locale, :name, name)
+ globalize.write(I18n.locale, :name, name)
self[:name] = name
self.update_url_name
end
@@ -329,13 +326,13 @@ class PublicBody < ActiveRecord::Base
# The "internal admin" is a special body for internal use.
def PublicBody.internal_admin_body
- PublicBody.with_locale(I18n.default_locale) do
+ I18n.with_locale(I18n.default_locale) do
pb = PublicBody.find_by_url_name("internal_admin_authority")
if pb.nil?
pb = PublicBody.new(
:name => 'Internal admin authority',
:short_name => "",
- :request_email => Configuration::contact_email,
+ :request_email => AlaveteliConfiguration::contact_email,
:home_page => "",
:notes => "",
:publication_scheme => "",
@@ -367,7 +364,7 @@ class PublicBody < ActiveRecord::Base
# of updating them
bodies_by_name = {}
set_of_existing = Set.new()
- PublicBody.with_locale(I18n.default_locale) do
+ I18n.with_locale(I18n.default_locale) do
bodies = (tag.nil? || tag.empty?) ? PublicBody.find(:all) : PublicBody.find_by_tag(tag)
for existing_body in bodies
# Hide InternalAdminBody from import notes
@@ -410,7 +407,7 @@ class PublicBody < ActiveRecord::Base
if public_body = bodies_by_name[name] # Existing public body
available_locales.each do |locale|
- PublicBody.with_locale(locale) do
+ I18n.with_locale(locale) do
changed = ActiveSupport::OrderedHash.new
field_list.each do |field_name|
localized_field_name = (locale.to_s == I18n.default_locale.to_s) ? field_name : "#{field_name}.#{locale}"
@@ -445,7 +442,7 @@ class PublicBody < ActiveRecord::Base
else # New public body
public_body = PublicBody.new(:name=>"", :short_name=>"", :request_email=>"")
available_locales.each do |locale|
- PublicBody.with_locale(locale) do
+ I18n.with_locale(locale) do
changed = ActiveSupport::OrderedHash.new
field_list.each do |field_name|
localized_field_name = (locale.to_s == I18n.default_locale.to_s) ? field_name : "#{field_name}.#{locale}"
@@ -551,7 +548,7 @@ class PublicBody < ActiveRecord::Base
# Returns nil if configuration variable not set
def override_request_email
- e = Configuration::override_all_public_body_request_emails
+ e = AlaveteliConfiguration::override_all_public_body_request_emails
e if e != ""
end
@@ -635,6 +632,8 @@ class PublicBody < ActiveRecord::Base
end
end
+ private
+
def request_email_if_requestable
# Request_email can be blank, meaning we don't have details
if self.is_requestable?
diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb
index de7978b82..032839b2f 100644
--- a/app/models/raw_email.rb
+++ b/app/models/raw_email.rb
@@ -23,10 +23,10 @@ class RawEmail < ActiveRecord::Base
raise "Failed to find the id number of the associated request: has it been saved?"
end
- if ENV["RAILS_ENV"] == "test"
+ if Rails.env.test?
return File.join(Rails.root, 'files/raw_email_test')
else
- return File.join(Configuration::raw_emails_location,
+ return File.join(AlaveteliConfiguration::raw_emails_location,
request_id[0..2], request_id)
end
end
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index a0c74bdb6..219c66811 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -260,7 +260,7 @@ class TrackThing < ActiveRecord::Base
:title_in_email => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'",
:title_in_rss => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'",
# Authentication
- :web => _("To follow requests made using {{site_name}} to the public authority '{{public_body_name}}'", :site_name=>Configuration::site_name, :public_body_name=>CGI.escapeHTML(self.public_body.name)),
+ :web => _("To follow requests made using {{site_name}} to the public authority '{{public_body_name}}'", :site_name=>AlaveteliConfiguration::site_name, :public_body_name=>CGI.escapeHTML(self.public_body.name)),
:email => _("Then you will be notified whenever someone requests something or gets a response from '{{public_body_name}}'.", :public_body_name=>CGI.escapeHTML(self.public_body.name)),
:email_subject => _("Confirm you want to follow requests to '{{public_body_name}}'", :public_body_name=>self.public_body.name),
# RSS sorting
diff --git a/app/models/user.rb b/app/models/user.rb
index e6c666e47..63dd5b1dd 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -58,6 +58,9 @@ class User < ActiveRecord::Base
],
:terms => [ [ :variety, 'V', "variety" ] ],
:if => :indexed_by_search?
+
+ after_initialize :set_defaults
+
def created_at_numeric
# format it here as no datetime support in Xapian's value ranges
return self.created_at.strftime("%Y%m%d%H%M%S")
@@ -67,17 +70,6 @@ class User < ActiveRecord::Base
"user"
end
- def after_initialize
- if self.admin_level.nil?
- self.admin_level = 'none'
- end
- if self.new_record?
- # make alert emails go out at a random time for each new user, so
- # overall they are spread out throughout the day.
- self.last_daily_track_email = User.random_time_in_last_day
- end
- end
-
# requested_by: and commented_by: search queries also need updating after save
after_update :reindex_referencing_models
def reindex_referencing_models
@@ -98,12 +90,7 @@ class User < ActiveRecord::Base
end
def get_locale
- if !self.locale.nil?
- locale = self.locale
- else
- locale = I18n.locale
- end
- return locale.to_s
+ (self.locale || I18n.locale).to_s
end
def visible_comments
@@ -141,14 +128,14 @@ class User < ActiveRecord::Base
if user
# There is user with email, check password
if !user.has_this_password?(params[:password])
- user.errors.add_to_base(auth_fail_message)
+ user.errors.add(:base, auth_fail_message)
end
else
# No user of same email, make one (that we don't save in the database)
# for the forms code to use.
user = User.new(params)
# deliberately same message as above so as not to leak whether registered
- user.errors.add_to_base(auth_fail_message)
+ user.errors.add(:base, auth_fail_message)
end
user
end
@@ -201,12 +188,12 @@ class User < ActiveRecord::Base
# The "internal admin" is a special user for internal use.
def User.internal_admin_user
- u = User.find_by_email(Configuration::contact_email)
+ u = User.find_by_email(AlaveteliConfiguration::contact_email)
if u.nil?
password = PostRedirect.generate_random_token
u = User.new(
:name => 'Internal admin user',
- :email => Configuration::contact_email,
+ :email => AlaveteliConfiguration::contact_email,
:password => password,
:password_confirmation => password
)
@@ -279,16 +266,16 @@ class User < ActiveRecord::Base
return false if self.no_limit
# Has the user issued as many as MAX_REQUESTS_PER_USER_PER_DAY requests in the past 24 hours?
- return false if Configuration::max_requests_per_user_per_day.blank?
+ return false if AlaveteliConfiguration::max_requests_per_user_per_day.blank?
recent_requests = InfoRequest.count(:conditions => ["user_id = ? and created_at > now() - '1 day'::interval", self.id])
- return (recent_requests >= Configuration::max_requests_per_user_per_day)
+ return (recent_requests >= AlaveteliConfiguration::max_requests_per_user_per_day)
end
def next_request_permitted_at
return nil if self.no_limit
- n_most_recent_requests = InfoRequest.all(:conditions => ["user_id = ? and created_at > now() - '1 day'::interval", self.id], :order => "created_at DESC", :limit => Configuration::max_requests_per_user_per_day)
- return nil if n_most_recent_requests.size < Configuration::max_requests_per_user_per_day
+ n_most_recent_requests = InfoRequest.all(:conditions => ["user_id = ? and created_at > now() - '1 day'::interval", self.id], :order => "created_at DESC", :limit => AlaveteliConfiguration::max_requests_per_user_per_day)
+ return nil if n_most_recent_requests.size < AlaveteliConfiguration::max_requests_per_user_per_day
nth_most_recent_request = n_most_recent_requests[-1]
return nth_most_recent_request.created_at + 1.day
@@ -407,6 +394,17 @@ class User < ActiveRecord::Base
self.salt = self.object_id.to_s + rand.to_s
end
+ def set_defaults
+ if self.admin_level.nil?
+ self.admin_level = 'none'
+ end
+ if self.new_record?
+ # make alert emails go out at a random time for each new user, so
+ # overall they are spread out throughout the day.
+ self.last_daily_track_email = User.random_time_in_last_day
+ end
+ end
+
def email_and_name_are_valid
if self.email != "" && !MySociety::Validate.is_valid_email(self.email)
errors.add(:email, _("Please enter a valid email address"))
diff --git a/app/models/user_mailer.rb b/app/models/user_mailer.rb
deleted file mode 100644
index 1be4f8aa3..000000000
--- a/app/models/user_mailer.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-# models/user_mailer.rb:
-# Emails relating to user accounts. e.g. Confirming a new account
-#
-# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-
-class UserMailer < ApplicationMailer
- def confirm_login(user, reasons, url)
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces when people are fiddling with their account
- @recipients = user.name_and_email
- @subject = reasons[:email_subject]
- @body[:reasons] = reasons
- @body[:name] = user.name
- @body[:url] = url
- end
-
- def already_registered(user, reasons, url)
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces when people are fiddling with their account
- @recipients = user.name_and_email
- @subject = reasons[:email_subject]
- @body[:reasons] = reasons
- @body[:name] = user.name
- @body[:url] = url
- end
-
- def changeemail_confirm(user, new_email, url)
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces when people are fiddling with their account
- @recipients = new_email
- @subject = _("Confirm your new email address on {{site_name}}", :site_name=>site_name)
- @body[:name] = user.name
- @body[:url] = url
- @body[:old_email] = user.email
- @body[:new_email] = new_email
- end
-
- def changeemail_already_used(old_email, new_email)
- @from = contact_from_name_and_email
- headers 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces when people are fiddling with their account
- @recipients = new_email
- @subject = _("Unable to change email address on {{site_name}}", :site_name=>site_name)
- @body[:old_email] = old_email
- @body[:new_email] = new_email
- end
-end
-
diff --git a/app/views/admin_censor_rule/_form.rhtml b/app/views/admin_censor_rule/_form.html.erb
index 5035238d6..5035238d6 100644
--- a/app/views/admin_censor_rule/_form.rhtml
+++ b/app/views/admin_censor_rule/_form.html.erb
diff --git a/app/views/admin_censor_rule/_show.rhtml b/app/views/admin_censor_rule/_show.html.erb
index 0d4cece93..0d4cece93 100644
--- a/app/views/admin_censor_rule/_show.rhtml
+++ b/app/views/admin_censor_rule/_show.html.erb
diff --git a/app/views/admin_censor_rule/edit.rhtml b/app/views/admin_censor_rule/edit.html.erb
index 4eb99ce57..230446ed3 100644
--- a/app/views/admin_censor_rule/edit.rhtml
+++ b/app/views/admin_censor_rule/edit.html.erb
@@ -2,14 +2,14 @@
<h1><%=@title%></h1>
-<% form_tag admin_rule_update_path(@censor_rule), :class => "form form-horizontal" do %>
+<%= form_tag admin_rule_update_path(@censor_rule), :class => "form form-horizontal" do %>
<%= render :partial => 'form', :locals => { :info_request => @censor_rule.info_request, :user => @censor_rule.user } %>
<div class="form-actions">
<%= submit_tag 'Save', :accesskey => 's', :class => "btn btn-primary" %>
</div>
<% end %>
-<% form_tag admin_rule_destroy_path(@censor_rule), :class => "form form-horizontal" do %>
+<%= form_tag admin_rule_destroy_path(@censor_rule), :class => "form form-horizontal" do %>
<%= hidden_field_tag(:censor_rule_id, @censor_rule.id) %>
<div class="form-actions">
Permanent! --&gt; <%= submit_tag "Destroy rule", :class => "btn btn-primary" %>
diff --git a/app/views/admin_censor_rule/new.rhtml b/app/views/admin_censor_rule/new.html.erb
index f6978c07c..1694308f3 100644
--- a/app/views/admin_censor_rule/new.rhtml
+++ b/app/views/admin_censor_rule/new.html.erb
@@ -1,8 +1,8 @@
-<% @title = _('New censor rule') %>
+<% @title = 'New censor rule' %>
<h1><%=@title%></h1>
-<% form_tag admin_rule_create_path, :class => "form form-horizontal" do %>
+<%= form_tag admin_rule_create_path, :class => "form form-horizontal" do %>
<%= render :partial => 'form', :locals => { :info_request => @info_request, :user => @censor_user } %>
<div class="form-actions">
<%= submit_tag "Create", :class => "btn btn-primary" %>
diff --git a/app/views/admin_general/_admin_navbar.rhtml b/app/views/admin_general/_admin_navbar.html.erb
index 5cc740f70..5cc740f70 100644
--- a/app/views/admin_general/_admin_navbar.rhtml
+++ b/app/views/admin_general/_admin_navbar.html.erb
diff --git a/app/views/admin_general/debug.rhtml b/app/views/admin_general/debug.html.erb
index 7fd256025..bf984c2e1 100644
--- a/app/views/admin_general/debug.rhtml
+++ b/app/views/admin_general/debug.html.erb
@@ -21,16 +21,13 @@ RUBY_VERSION <%=h RUBY_VERSION %>
<br>
Rails::VERSION::STRING <%=h Rails::VERSION::STRING%>
<br>
-TMail::VERSION::STRING <%=h TMail::VERSION::STRING%>
-<br>
Xapian::version_string <%=h Xapian::version_string%>
</p>
<h2>Configuration</h2>
-<p>environment: <%=h Rails::configuration.environment %>
-<br>environment_path: <%=h Rails::configuration.environment_path %>
-<br>framework_paths: <%=h Rails::configuration.framework_paths.to_yaml %>
+<p>Rails env: <%=h Rails.env %>
+<br>Rails root: <%=h Rails.root %>
</p>
<h2>Environment variables</h2>
diff --git a/app/views/admin_general/index.rhtml b/app/views/admin_general/index.html.erb
index 9940434ac..9940434ac 100644
--- a/app/views/admin_general/index.rhtml
+++ b/app/views/admin_general/index.html.erb
diff --git a/app/views/admin_general/stats.rhtml b/app/views/admin_general/stats.html.erb
index 27dc25ee0..27dc25ee0 100644
--- a/app/views/admin_general/stats.rhtml
+++ b/app/views/admin_general/stats.html.erb
diff --git a/app/views/admin_general/timeline.rhtml b/app/views/admin_general/timeline.html.erb
index 8fd8875b6..8fd8875b6 100644
--- a/app/views/admin_general/timeline.rhtml
+++ b/app/views/admin_general/timeline.html.erb
diff --git a/app/views/admin_public_body/_form.rhtml b/app/views/admin_public_body/_form.html.erb
index 3f346842c..68069e838 100644
--- a/app/views/admin_public_body/_form.rhtml
+++ b/app/views/admin_public_body/_form.html.erb
@@ -18,7 +18,7 @@
prefix = "public_body[translated_versions][]"
object = @public_body.new_record? ?
PublicBody::Translation.new :
- @public_body.translation(locale.to_s) || PublicBody::Translation.new
+ @public_body.find_translation_by_locale(locale.to_s) || PublicBody::Translation.new
end
fields_for prefix, object do |t|
diff --git a/app/views/admin_public_body/_one_list.rhtml b/app/views/admin_public_body/_one_list.html.erb
index d8746bae7..8f1d719ec 100644
--- a/app/views/admin_public_body/_one_list.rhtml
+++ b/app/views/admin_public_body/_one_list.html.erb
@@ -31,7 +31,7 @@
<% end %>
</div>
-<% form_tag(admin_body_mass_tag_add_url, :method => "post", :class => "form form-inline" ) do %>
+<%= form_tag(admin_body_mass_tag_add_url, :method => "post", :class => "form form-inline" ) do %>
<p>
<%= text_field_tag 'new_tag', params[:new_tag], { :size => 15, :id => "mass_add_tag_new_tag_" + table_name } %>
<%= hidden_field_tag(:query, params[:query], { :id => "mass_add_tag_query_" + table_name } ) %>
diff --git a/app/views/admin_public_body/_tag_help.rhtml b/app/views/admin_public_body/_tag_help.html.erb
index b64e65877..b64e65877 100644
--- a/app/views/admin_public_body/_tag_help.rhtml
+++ b/app/views/admin_public_body/_tag_help.html.erb
diff --git a/app/views/admin_public_body/_tags.rhtml b/app/views/admin_public_body/_tags.html.erb
index 26526f304..26526f304 100644
--- a/app/views/admin_public_body/_tags.rhtml
+++ b/app/views/admin_public_body/_tags.html.erb
diff --git a/app/views/admin_public_body/edit.rhtml b/app/views/admin_public_body/edit.html.erb
index eb0c45f19..a24122671 100644
--- a/app/views/admin_public_body/edit.rhtml
+++ b/app/views/admin_public_body/edit.html.erb
@@ -20,7 +20,7 @@
</div>
<% if @public_body.info_requests.empty? %>
- <% form_tag(admin_body_destroy_path(@public_body), :class => "form form-inline") do %>
+ <%= form_tag(admin_body_destroy_path(@public_body), :class => "form form-inline") do %>
<%= hidden_field_tag(:public_body_id, { :value => @public_body.id } ) %>
<%= submit_tag _("Destroy {{name}}", :name => @public_body.name), :class => "btn btn-danger" %> (this is permanent!)
<% end %>
diff --git a/app/views/admin_public_body/import_csv.rhtml b/app/views/admin_public_body/import_csv.html.erb
index bfe1b0c3b..afda5a468 100644
--- a/app/views/admin_public_body/import_csv.rhtml
+++ b/app/views/admin_public_body/import_csv.html.erb
@@ -9,7 +9,7 @@
<pre id="error"><%=@errors %></pre>
<% end %>
-<% form_tag 'import_csv', :multipart => true do %>
+<%= form_tag 'import_csv', :multipart => true do %>
<p>
<% if @original_csv_file && @temporary_csv_file %>
CSV file:
diff --git a/app/views/admin_public_body/list.rhtml b/app/views/admin_public_body/list.html.erb
index acc05f50d..3d7d9c4cd 100644
--- a/app/views/admin_public_body/list.rhtml
+++ b/app/views/admin_public_body/list.html.erb
@@ -15,7 +15,7 @@
</div>
</div>
-<% form_tag({}, :method => "get", :class => "form form-search") do %>
+<%= form_tag({}, :method => "get", :class => "form form-search") do %>
<%= text_field_tag 'query', params[:query], { :size => 30, :class => "input-large search-query" } %>
<%= submit_tag "Search", :class => "btn" %>
<% if !@query.nil? %>
@@ -35,7 +35,6 @@
<h2>All authorities</h2>
<% else %>
<h2>Substring search matches (<%= @public_bodies.total_entries %> total)</h2>
-
<% end %>
<%= render :partial => 'one_list', :locals => { :bodies => @public_bodies, :table_name => 'substring' } %>
<% end %>
diff --git a/app/views/admin_public_body/missing_scheme.rhtml b/app/views/admin_public_body/missing_scheme.html.erb
index 2ea55ae00..2ea55ae00 100644
--- a/app/views/admin_public_body/missing_scheme.rhtml
+++ b/app/views/admin_public_body/missing_scheme.html.erb
diff --git a/app/views/admin_public_body/new.rhtml b/app/views/admin_public_body/new.html.erb
index 6ead1810c..2ee96c466 100644
--- a/app/views/admin_public_body/new.rhtml
+++ b/app/views/admin_public_body/new.html.erb
@@ -4,7 +4,7 @@
<div class="row">
<div class="span8">
<div id="public_body_form">
- <% form_for :public_body, @public_body, :url => admin_body_create_path, :html => {:class => "form form-horizontal"} do |f| %>
+ <%= form_for :public_body, @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" %>
diff --git a/app/views/admin_public_body/show.rhtml b/app/views/admin_public_body/show.html.erb
index cfb10b24e..cfb10b24e 100644
--- a/app/views/admin_public_body/show.rhtml
+++ b/app/views/admin_public_body/show.html.erb
diff --git a/app/views/admin_request/_incoming_message_actions.rhtml b/app/views/admin_request/_incoming_message_actions.html.erb
index 84c29dcc3..653e73337 100644
--- a/app/views/admin_request/_incoming_message_actions.rhtml
+++ b/app/views/admin_request/_incoming_message_actions.html.erb
@@ -1,6 +1,6 @@
<fieldset class="form-horizontal">
<legend>Actions</legend>
- <% form_tag admin_request_redeliver_incoming_path, :class => "form form-inline" do %>
+ <%= form_tag admin_request_redeliver_incoming_path, :class => "form form-inline" do %>
<div class="control-group">
<label class="control-label" for="url_title_<%= incoming_message.id %>">Redeliver message to one or more other requests</label>
<div class="controls">
@@ -22,7 +22,7 @@
</div>
</div>
- <% form_tag admin_request_destroy_incoming_path, :class => "form form-inline" do %>
+ <%= form_tag admin_request_destroy_incoming_path, :class => "form form-inline" do %>
<div class="control-group">
<label class="control-label" for="destroy_message_<%= incoming_message.id %>">Destroy message</label>
<div class="controls">
diff --git a/app/views/admin_request/_some_requests.rhtml b/app/views/admin_request/_some_requests.html.erb
index cff94956d..cff94956d 100644
--- a/app/views/admin_request/_some_requests.rhtml
+++ b/app/views/admin_request/_some_requests.html.erb
diff --git a/app/views/admin_request/_tags.rhtml b/app/views/admin_request/_tags.html.erb
index 22fbf13c8..22fbf13c8 100644
--- a/app/views/admin_request/_tags.rhtml
+++ b/app/views/admin_request/_tags.html.erb
diff --git a/app/views/admin_request/edit.rhtml b/app/views/admin_request/edit.html.erb
index 1cf5d4f12..0e9c68aea 100644
--- a/app/views/admin_request/edit.rhtml
+++ b/app/views/admin_request/edit.html.erb
@@ -2,7 +2,7 @@
<%= error_messages_for 'info_request' %>
-<% form_tag admin_request_update_path(@info_request) do %>
+<%= form_tag admin_request_update_path(@info_request) do %>
<p><label for="info_request_title"><strong>Title</strong></label> (warning: editing this will break URLs right now)<br/>
<%= text_field 'info_request', 'title', :size => 50 %></p>
@@ -49,7 +49,7 @@
<hr>
-<% form_tag admin_request_destroy_path(@info_request) do %>
+<%= form_tag admin_request_destroy_path(@info_request) do %>
<p>
<strong>This is permanent and irreversible!</strong> <%= submit_tag 'Destroy request entirely' %>
<br>Use it mainly if someone posts private information, e.g. made a Data Protection request. It
diff --git a/app/views/admin_request/edit_comment.rhtml b/app/views/admin_request/edit_comment.html.erb
index 07031f5f2..2cf49a4a8 100644
--- a/app/views/admin_request/edit_comment.rhtml
+++ b/app/views/admin_request/edit_comment.html.erb
@@ -2,7 +2,7 @@
<%= error_messages_for 'comment' %>
-<% form_tag admin_request_update_comment_path(@comment) do %>
+<%= form_tag admin_request_update_comment_path(@comment) do %>
<p><label for="comment_body">Body of annotation</label><br/>
<%= text_area 'comment', 'body', :rows => 10, :cols => 60 %></p>
diff --git a/app/views/admin_request/edit_outgoing.rhtml b/app/views/admin_request/edit_outgoing.html.erb
index ab209be0d..a0c60520a 100644
--- a/app/views/admin_request/edit_outgoing.rhtml
+++ b/app/views/admin_request/edit_outgoing.html.erb
@@ -2,7 +2,7 @@
<%= error_messages_for 'outgoing_message' %>
-<% form_tag admin_request_update_outgoing_path(@outgoing_message) do %>
+<%= form_tag admin_request_update_outgoing_path(@outgoing_message) do %>
<p><label for="outgoing_message_body">Body of message</label><br/>
<%= text_area 'outgoing_message', 'body', :rows => 10, :cols => 60 %></p>
@@ -22,7 +22,7 @@
<%= link_to 'List all', admin_request_list_path %>
</p>
-<% form_tag admin_request_destroy_outgoing_path do %>
+<%= form_tag admin_request_destroy_outgoing_path do %>
<div>
<%= hidden_field_tag 'outgoing_message_id', @outgoing_message.id %>
Warning, this is permanent! ---&gt;
diff --git a/app/views/admin_request/hidden_user_explanation.rhtml b/app/views/admin_request/hidden_user_explanation.html.erb
index 7084e986f..7084e986f 100644
--- a/app/views/admin_request/hidden_user_explanation.rhtml
+++ b/app/views/admin_request/hidden_user_explanation.html.erb
diff --git a/app/views/admin_request/list.rhtml b/app/views/admin_request/list.html.erb
index 10b39d3a2..2bd3e3326 100644
--- a/app/views/admin_request/list.rhtml
+++ b/app/views/admin_request/list.html.erb
@@ -2,7 +2,7 @@
<h1><%=@title%></h1>
-<% form_tag({}, :method => "get", :class => "form form-search") do %>
+<%= form_tag({}, :method => "get", :class => "form form-search") do %>
<%= text_field_tag 'query', params[:query], { :size => 30, :class => "input-large search-query" } %>
<%= submit_tag "Search", :class => "btn" %> (substring search, titles only)
<% end %>
diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.html.erb
index 1401a7b94..c725f42c4 100644
--- a/app/views/admin_request/show.rhtml
+++ b/app/views/admin_request/show.html.erb
@@ -2,7 +2,7 @@
<h1><%=@title%></h1>
-<% form_tag admin_request_move_request_path, { :class => "form form-horizontal" } do %>
+<%= form_tag admin_request_move_request_path, { :class => "form form-horizontal" } do %>
<%= hidden_field_tag 'info_request_id', @info_request.id %>
<div class="accordion" id="info_request">
<div class="accordion-group">
@@ -121,7 +121,7 @@
<p class="help-block">(see also option to general URLs for individual incoming messages below)</p>
</div>
</div>
- <% form_tag admin_request_hide_path(@info_request), :class => "form form-inline", :id => "hide_request_form" do %>
+ <%= form_tag admin_request_hide_path(@info_request), :class => "form form-inline", :id => "hide_request_form" do %>
<div class="control-group">
<% if @info_request.is_external? %>
<label class="control-label">Hide the request:</label>
@@ -160,6 +160,17 @@
</div>
</div>
+<% for info_request_event in @info_request.info_request_events.find(:all, :order => "created_at, id") %>
+ <tr class="<%= cycle('odd', 'even') %>">
+ <td><%=h info_request_event.id %></td>
+ <% for column in InfoRequestEvent.content_columns %>
+ <td>
+ <% if column.name == 'params_yaml' %>
+ <%= info_request_event.params_yaml_as_html %>
+ <% elsif column.text? %>
+ <%=h (info_request_event.send(column.name) || '').gsub(/_/,' ') %>
+ <% else %>
+ <%=h info_request_event.send(column.name) %>
<% end %>
<div class="form-actions" id="request_hide_button">
<%= submit_tag _("Hide request"), :class => "btn" %>
@@ -191,7 +202,7 @@
<tr>
<td>
<% if info_request_event.described_state != 'waiting_clarification' and info_request_event.event_type == 'response' %>
- <% form_tag admin_request_clarification_path, :class => "form form-inline admin-table-form admin-inline-form" do %>
+ <%= form_tag admin_request_clarification_path, :class => "form form-inline admin-table-form admin-inline-form" do %>
<%= hidden_field_tag 'info_request_event_id', info_request_event.id, :id => nil %>
<%= submit_tag "Was clarification request", :class => "btn btn-mini btn-primary" %>
<% end %>
@@ -245,7 +256,7 @@
<tbody>
<tr>
<td colspan="2">
- <% form_tag admin_request_resend_path, :class => "admin-table-form" do %>
+ <%= form_tag admin_request_resend_path, :class => "admin-table-form" do %>
<%= hidden_field_tag 'outgoing_message_id', outgoing_message.id %>
<%= submit_tag "Resend", :class => "btn" %>
<% end %>
diff --git a/app/views/admin_request/show_raw_email.rhtml b/app/views/admin_request/show_raw_email.html.erb
index 72c782ad6..72c782ad6 100644
--- a/app/views/admin_request/show_raw_email.rhtml
+++ b/app/views/admin_request/show_raw_email.html.erb
diff --git a/app/views/admin_track/_some_tracks.rhtml b/app/views/admin_track/_some_tracks.html.erb
index 95101cb55..e9facfb5d 100644
--- a/app/views/admin_track/_some_tracks.rhtml
+++ b/app/views/admin_track/_some_tracks.html.erb
@@ -32,7 +32,7 @@
<% if include_destroy %>
<tr>
<td colspan="2">
- <% form_tag admin_user_destroy_track_path, :class => "form form-inline admin-table-form" do %>
+ <%= form_tag admin_user_destroy_track_path, :class => "form form-inline admin-table-form" do %>
<div>
<%= hidden_field_tag 'track_id', track_thing.id %>
<%= submit_tag "Destroy track", :class => "btn btn-warning" %>
@@ -70,3 +70,5 @@
<% end %>
</div>
<% end %>
+</table>
+
diff --git a/app/views/admin_track/list.rhtml b/app/views/admin_track/list.html.erb
index 9cff5635b..5e967a926 100644
--- a/app/views/admin_track/list.rhtml
+++ b/app/views/admin_track/list.html.erb
@@ -2,7 +2,7 @@
<h1><%=@title%></h1>
-<% form_tag({}, :method => "get", :class => "form form-search") do %>
+<%= form_tag({}, :method => "get", :class => "form form-search") do %>
<%= text_field_tag 'query', params[:query], { :size => 30, :class => "input-large search-query" } %>
<%= submit_tag "Search", :class => "btn" %> (substring search the query – so use url_names_for_a_particular_request_or_authority_or_person)
<% end %>
diff --git a/app/views/admin_user/_form.rhtml b/app/views/admin_user/_form.html.erb
index e7175d09c..e7175d09c 100644
--- a/app/views/admin_user/_form.rhtml
+++ b/app/views/admin_user/_form.html.erb
diff --git a/app/views/admin_user/_user_table.rhtml b/app/views/admin_user/_user_table.html.erb
index 57066bf3f..57066bf3f 100644
--- a/app/views/admin_user/_user_table.rhtml
+++ b/app/views/admin_user/_user_table.html.erb
diff --git a/app/views/admin_user/edit.rhtml b/app/views/admin_user/edit.html.erb
index 3333a1e48..e641a13d6 100644
--- a/app/views/admin_user/edit.rhtml
+++ b/app/views/admin_user/edit.html.erb
@@ -1,6 +1,6 @@
<h1><%=@title%></h1>
-<% form_tag admin_user_update_path(@admin_user), :class => "form form-horizontal" do %>
+<%= form_tag admin_user_update_path(@admin_user), :class => "form form-horizontal" do %>
<%= render :partial => 'form' %>
<div class="form-actions">
<%= submit_tag 'Save', :accesskey => 's', :class => "btn btn-primary" %>
diff --git a/app/views/admin_user/list.rhtml b/app/views/admin_user/list.html.erb
index 23f75c159..b1238f87a 100644
--- a/app/views/admin_user/list.rhtml
+++ b/app/views/admin_user/list.html.erb
@@ -2,7 +2,7 @@
<h1><%=@title%></h1>
-<% form_tag({}, :method => "get", :class => "form form-search") do %>
+<%= form_tag({}, :method => "get", :class => "form form-search") do %>
<%= text_field_tag 'query', params[:query], { :size => 30, :class => "input-large search-query"} %>
<%= submit_tag "Search", :class => "btn" %> (substring search, names and emails)
<%= link_to 'Banned users', admin_user_list_banned_path, :class => "btn btn-info" %>
diff --git a/app/views/admin_user/list_banned.rhtml b/app/views/admin_user/list_banned.html.erb
index e535415e6..e535415e6 100644
--- a/app/views/admin_user/list_banned.rhtml
+++ b/app/views/admin_user/list_banned.html.erb
diff --git a/app/views/admin_user/show.rhtml b/app/views/admin_user/show.html.erb
index 279758f03..26a385f31 100644
--- a/app/views/admin_user/show.rhtml
+++ b/app/views/admin_user/show.html.erb
@@ -4,7 +4,7 @@
<% if @admin_user.profile_photo %>
<div class="user_photo_on_admin">
- <% form_tag admin_clear_profile_photo_path(@admin_user), :multipart => true, :class => "form" do %>
+ <%= form_tag admin_clear_profile_photo_path(@admin_user), :multipart => true, :class => "form" do %>
<img src="<%= get_profile_photo_url(:url_name => @admin_user.url_name) %>">
<br>
<%= submit_tag "Clear photo", :class => "btn btn-info" %>
diff --git a/app/views/admin_user/show_bounce_message.rhtml b/app/views/admin_user/show_bounce_message.html.erb
index ad643a13e..ad643a13e 100644
--- a/app/views/admin_user/show_bounce_message.rhtml
+++ b/app/views/admin_user/show_bounce_message.html.erb
diff --git a/app/views/comment/_comment_form.rhtml b/app/views/comment/_comment_form.html.erb
index 120929643..91cd8f7d0 100644
--- a/app/views/comment/_comment_form.rhtml
+++ b/app/views/comment/_comment_form.html.erb
@@ -1,4 +1,4 @@
-<% form_for(:comment, @comment, :url => { :controller => "comment", :action => "new", :type => "request" }, :html => { :id => 'comment_form' } ) do |f| %>
+<%= form_for(@comment, :as => :comment, :url => { :controller => "comment", :action => "new", :type => "request" }, :html => { :id => 'comment_form' } ) do |f| %>
<p>
<%= f.text_area :body, :rows => 10, :cols => 55 %>
</p>
diff --git a/app/views/comment/_single_comment.rhtml b/app/views/comment/_single_comment.html.erb
index 421a9d4ba..421a9d4ba 100644
--- a/app/views/comment/_single_comment.rhtml
+++ b/app/views/comment/_single_comment.html.erb
diff --git a/app/views/comment/new.rhtml b/app/views/comment/new.html.erb
index 578732cdb..578732cdb 100644
--- a/app/views/comment/new.rhtml
+++ b/app/views/comment/new.html.erb
diff --git a/app/views/comment/preview.rhtml b/app/views/comment/preview.html.erb
index 702bd9a9b..cd966e6a5 100644
--- a/app/views/comment/preview.rhtml
+++ b/app/views/comment/preview.html.erb
@@ -1,6 +1,6 @@
<% @title = _("Preview new annotation on '{{info_request_title}}'",:info_request_title=>h(@info_request.title)) %>
-<% form_for(:comment, @comment, :html => { :id => 'preview_form' }, :url => { :controller => "comment", :action => "new", :type => "request" } ) do |f| %>
+<%= form_for(@comment, :html => { :id => 'preview_form' }, :url => { :controller => "comment", :action => "new", :type => "request" } ) do |f| %>
<h1><%= _('Now preview your annotation') %></h1>
diff --git a/app/views/contact_mailer/from_admin_message.rhtml b/app/views/contact_mailer/from_admin_message.text.erb
index 4169d8d3a..4169d8d3a 100644
--- a/app/views/contact_mailer/from_admin_message.rhtml
+++ b/app/views/contact_mailer/from_admin_message.text.erb
diff --git a/app/views/contact_mailer/to_admin_message.rhtml b/app/views/contact_mailer/to_admin_message.text.erb
index dc9b1090b..dc9b1090b 100644
--- a/app/views/contact_mailer/to_admin_message.rhtml
+++ b/app/views/contact_mailer/to_admin_message.text.erb
diff --git a/app/views/contact_mailer/user_message.rhtml b/app/views/contact_mailer/user_message.text.erb
index afa1494db..afa1494db 100644
--- a/app/views/contact_mailer/user_message.rhtml
+++ b/app/views/contact_mailer/user_message.text.erb
diff --git a/app/views/general/_advanced_search_tips.rhtml b/app/views/general/_advanced_search_tips.html.erb
index 08ce04439..08ce04439 100644
--- a/app/views/general/_advanced_search_tips.rhtml
+++ b/app/views/general/_advanced_search_tips.html.erb
diff --git a/app/views/general/_before_body_end.rhtml b/app/views/general/_before_body_end.html.erb
index 25fdf4684..25fdf4684 100644
--- a/app/views/general/_before_body_end.rhtml
+++ b/app/views/general/_before_body_end.html.erb
diff --git a/app/views/general/_before_head_end.rhtml b/app/views/general/_before_head_end.html.erb
index 8886745ab..8886745ab 100644
--- a/app/views/general/_before_head_end.rhtml
+++ b/app/views/general/_before_head_end.html.erb
diff --git a/app/views/general/_credits.rhtml b/app/views/general/_credits.html.erb
index b1a9ce05e..b1a9ce05e 100644
--- a/app/views/general/_credits.rhtml
+++ b/app/views/general/_credits.html.erb
diff --git a/app/views/general/_custom_state_descriptions.rhtml b/app/views/general/_custom_state_descriptions.html.erb
index 913a6d50a..913a6d50a 100644
--- a/app/views/general/_custom_state_descriptions.rhtml
+++ b/app/views/general/_custom_state_descriptions.html.erb
diff --git a/app/views/general/_custom_state_transitions_complete.rhtml b/app/views/general/_custom_state_transitions_complete.html.erb
index e69de29bb..e69de29bb 100644
--- a/app/views/general/_custom_state_transitions_complete.rhtml
+++ b/app/views/general/_custom_state_transitions_complete.html.erb
diff --git a/app/views/general/_custom_state_transitions_pending.rhtml b/app/views/general/_custom_state_transitions_pending.html.erb
index e69de29bb..e69de29bb 100644
--- a/app/views/general/_custom_state_transitions_pending.rhtml
+++ b/app/views/general/_custom_state_transitions_pending.html.erb
diff --git a/app/views/general/_footer.rhtml b/app/views/general/_footer.html.erb
index 36f3919f0..990093694 100644
--- a/app/views/general/_footer.rhtml
+++ b/app/views/general/_footer.html.erb
@@ -1,6 +1,6 @@
<div id="footer">
<%= link_to _("Contact {{site_name}}", :site_name => site_name), help_contact_path %>
-| <img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="https://twitter.com/<%= Configuration::twitter_username %>"><%= _("Follow us on twitter") %></a>
+| <img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="https://twitter.com/<%= AlaveteliConfiguration::twitter_username %>"><%= _("Follow us on twitter") %></a>
<%= render :partial => 'general/credits' %>
</div>
<div class="after-footer">&nbsp;</div>
diff --git a/app/views/general/_frontpage_bodies_list.rhtml b/app/views/general/_frontpage_bodies_list.html.erb
index 54400602b..54400602b 100644
--- a/app/views/general/_frontpage_bodies_list.rhtml
+++ b/app/views/general/_frontpage_bodies_list.html.erb
diff --git a/app/views/general/_frontpage_intro_sentence.rhtml b/app/views/general/_frontpage_intro_sentence.html.erb
index 74b849fc9..74b849fc9 100644
--- a/app/views/general/_frontpage_intro_sentence.rhtml
+++ b/app/views/general/_frontpage_intro_sentence.html.erb
diff --git a/app/views/general/_frontpage_new_request.rhtml b/app/views/general/_frontpage_new_request.html.erb
index 499b60eb5..499b60eb5 100644
--- a/app/views/general/_frontpage_new_request.rhtml
+++ b/app/views/general/_frontpage_new_request.html.erb
diff --git a/app/views/general/_frontpage_requests_list.rhtml b/app/views/general/_frontpage_requests_list.html.erb
index fa498dfa7..fa498dfa7 100644
--- a/app/views/general/_frontpage_requests_list.rhtml
+++ b/app/views/general/_frontpage_requests_list.html.erb
diff --git a/app/views/general/_frontpage_search_box.rhtml b/app/views/general/_frontpage_search_box.html.erb
index 890602416..890602416 100644
--- a/app/views/general/_frontpage_search_box.rhtml
+++ b/app/views/general/_frontpage_search_box.html.erb
diff --git a/app/views/general/_locale_switcher.rhtml b/app/views/general/_locale_switcher.html.erb
index d0040bb0d..d0040bb0d 100644
--- a/app/views/general/_locale_switcher.rhtml
+++ b/app/views/general/_locale_switcher.html.erb
diff --git a/app/views/general/_localised_datepicker.rhtml b/app/views/general/_localised_datepicker.html.erb
index ec6593ea0..ec6593ea0 100644
--- a/app/views/general/_localised_datepicker.rhtml
+++ b/app/views/general/_localised_datepicker.html.erb
diff --git a/app/views/general/_orglink.rhtml b/app/views/general/_orglink.html.erb
index 66002c021..66002c021 100644
--- a/app/views/general/_orglink.rhtml
+++ b/app/views/general/_orglink.html.erb
diff --git a/app/views/general/_popup_banner.rhtml b/app/views/general/_popup_banner.html.erb
index 8b1378917..8b1378917 100644
--- a/app/views/general/_popup_banner.rhtml
+++ b/app/views/general/_popup_banner.html.erb
diff --git a/app/views/general/_stylesheet_includes.rhtml b/app/views/general/_stylesheet_includes.html.erb
index 7a03680f8..5b6e12258 100644
--- a/app/views/general/_stylesheet_includes.rhtml
+++ b/app/views/general/_stylesheet_includes.html.erb
@@ -16,6 +16,6 @@
<![endif]-->
<!-- the following method for customising CSS is deprecated; see `doc/THEMES.md` for detail -->
<%= stylesheet_link_tag 'custom', :title => "Main", :rel => "stylesheet" %>
- <% if Configuration::force_registration_on_new_request %>
+ <% if AlaveteliConfiguration::force_registration_on_new_request %>
<%= stylesheet_link_tag 'jquery.fancybox-1.3.4', :rel => "stylesheet" %>
<% end %>
diff --git a/app/views/general/_topnav.rhtml b/app/views/general/_topnav.html.erb
index c7f2cedea..c7f2cedea 100644
--- a/app/views/general/_topnav.rhtml
+++ b/app/views/general/_topnav.html.erb
diff --git a/app/views/general/blog.rhtml b/app/views/general/blog.html.erb
index d42b32282..7146aab5d 100644
--- a/app/views/general/blog.rhtml
+++ b/app/views/general/blog.html.erb
@@ -7,9 +7,9 @@
<img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="https://twitter.com/<%= @twitter_user %>"><%= _("Follow us on twitter") %></a><br/><br/>
<img src="/images/feed-16.png" alt="RSS icon"> <a href="<%= @feed_url %>"><%= _("Subscribe to blog") %></a>
</div>
- <% if Configuration::twitter_widget_id %>
+ <% if AlaveteliConfiguration::twitter_widget_id %>
<div id="twitter">
- <a class="twitter-timeline" data-dnt=true href="https://twitter.com/<%= Configuration::twitter_username %>" data-widget-id="<%= Configuration::twitter_widget_id %>">Tweets by @<%= Configuration::twitter_username %></a>
+ <a class="twitter-timeline" data-dnt=true href="https://twitter.com/<%= AlaveteliConfiguration::twitter_username %>" data-widget-id="<%= AlaveteliConfiguration::twitter_widget_id %>">Tweets by @<%= AlaveteliConfiguration::twitter_username %></a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
<% end %>
@@ -20,15 +20,15 @@
<h1><%=@title %></h1>
<div id="blog">
- <% for item in @blog_items: %>
+ <% @blog_items.each do |item| %>
<div class="blog_post">
- <h2 id="<%= Time.parse(item['pubDate'][0]).to_i %>"><a href="<%=item['link']%>"><%=h item['title'] %></a></h2>
- <p class="subtitle"><%= _("Posted on {{date}} by {{author}}", :date=>simple_date(Time.parse(item['pubDate'][0])), :author=>item['creator']) %></p>
+ <h2 id="<%= Time.parse(item['pubDate'][0]).to_i %>"><a href="<%=item['link'][0]%>"><%=h item['title'][0] %></a></h2>
+ <p class="subtitle"><%= _("Posted on {{date}} by {{author}}", :date=>simple_date(Time.parse(item['pubDate'][0])), :author=>item['creator'][0]) %></p>
<div>
<% if item['encoded'] %>
- <%= raw item['encoded'] %>
+ <%= raw item['encoded'][0] %>
<% elsif item['description'] %>
- <%= raw item['description'] %>
+ <%= raw item['description'][0] %>
<% end %>
</div>
<p><em>
diff --git a/app/views/general/custom_css.rhtml b/app/views/general/custom_css.html.erb
index 0def82ed0..0def82ed0 100644
--- a/app/views/general/custom_css.rhtml
+++ b/app/views/general/custom_css.html.erb
diff --git a/app/views/general/exception_caught.rhtml b/app/views/general/exception_caught.html.erb
index f8fe4343b..8d78e2e92 100644
--- a/app/views/general/exception_caught.rhtml
+++ b/app/views/general/exception_caught.html.erb
@@ -7,7 +7,7 @@
<ul>
<li><%= _("Check for mistakes if you typed or copied the address.")%></li>
<li><%= _("Search the site to find what you were looking for.")%>
- <% form_tag({:controller => "general", :action => "search_redirect"}, {:id => "search_form" }) do %>
+ <%= form_tag({:controller => "general", :action => "search_redirect"}, {:id => "search_form" }) do %>
<%= text_field_tag 'query', params[:query], { :size => 30, :title => "type your search term here" } %>
<%= submit_tag _("Search") %>
<% end %>
diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.html.erb
index 6eceb3b28..bf5261d15 100644
--- a/app/views/general/frontpage.rhtml
+++ b/app/views/general/frontpage.html.erb
@@ -1,4 +1,4 @@
-<%# TODO: Cache for 5 minutes %>
+<% # TODO: Cache for 5 minutes %>
<div id="frontpage_splash">
<div id="left_column">
<%= render :partial => "frontpage_new_request" %>
diff --git a/app/views/general/search.rhtml b/app/views/general/search.html.erb
index 50f9f9286..7072ab90f 100644
--- a/app/views/general/search.rhtml
+++ b/app/views/general/search.html.erb
@@ -22,7 +22,7 @@
<% if @advanced %>
<div id="advanced-search">
<p><%= _('To use the advanced search, combine phrases and labels as described in the search tips below.') %></p>
- <% form_tag(advanced_search_url, :method => "get") do %>
+ <%= form_tag(advanced_search_url, :method => "get") do %>
<p>
<%= text_field_tag :query, @query, { :size => 60 } %>
<%= hidden_field_tag 'sortby', @inputted_sortby %>
@@ -35,7 +35,7 @@
<% end %>
</div>
<% else %>
- <% form_tag(request.url, {:method => "get", :id => "search_form"}) do %>
+ <%= form_tag(request.url, {:method => "get", :id => "search_form"}) do %>
<p>
<%= text_field_tag 'query', params[:query], { :size => 40, :title => "type your search term here" } %>
<%= hidden_field_tag 'sortby', @inputted_sortby %>
diff --git a/app/views/help/_sidebar.rhtml b/app/views/help/_sidebar.html.erb
index 2b7ed5647..2b7ed5647 100644
--- a/app/views/help/_sidebar.rhtml
+++ b/app/views/help/_sidebar.html.erb
diff --git a/app/views/help/_why_they_should_reply_by_email.rhtml b/app/views/help/_why_they_should_reply_by_email.html.erb
index faaa2b2e2..faaa2b2e2 100644
--- a/app/views/help/_why_they_should_reply_by_email.rhtml
+++ b/app/views/help/_why_they_should_reply_by_email.html.erb
diff --git a/app/views/help/about.rhtml b/app/views/help/about.html.erb
index 477f0e750..477f0e750 100644
--- a/app/views/help/about.rhtml
+++ b/app/views/help/about.html.erb
diff --git a/app/views/help/alaveteli.rhtml b/app/views/help/alaveteli.html.erb
index 6210f9f24..6210f9f24 100644
--- a/app/views/help/alaveteli.rhtml
+++ b/app/views/help/alaveteli.html.erb
diff --git a/app/views/help/api.rhtml b/app/views/help/api.html.erb
index 57390d65a..57390d65a 100644
--- a/app/views/help/api.rhtml
+++ b/app/views/help/api.html.erb
diff --git a/app/views/help/contact.rhtml b/app/views/help/contact.html.erb
index b1b5d4f24..ad89db9ec 100644
--- a/app/views/help/contact.rhtml
+++ b/app/views/help/contact.html.erb
@@ -40,13 +40,13 @@
<% end %>
</div>
-<% form_for :contact do |f| %>
+<%= form_for :contact do |f| %>
<% if not @user %>
<p>
<label class="form_label" for="contact_name">Your name:</label>
<%= f.text_field :name, :size => 20 %>
- (or <%= link_to "sign in", signin_path(:r => request.request_uri) %>)
+ (or <%= link_to "sign in", signin_path(:r => request.fullpath) %>)
</p>
<p>
diff --git a/app/views/help/credits.rhtml b/app/views/help/credits.html.erb
index 02f1e40e8..02f1e40e8 100644
--- a/app/views/help/credits.rhtml
+++ b/app/views/help/credits.html.erb
diff --git a/app/views/help/officers.rhtml b/app/views/help/officers.html.erb
index 6db706f78..6db706f78 100644
--- a/app/views/help/officers.rhtml
+++ b/app/views/help/officers.html.erb
diff --git a/app/views/help/privacy.rhtml b/app/views/help/privacy.html.erb
index 8e5293892..8e5293892 100644
--- a/app/views/help/privacy.rhtml
+++ b/app/views/help/privacy.html.erb
diff --git a/app/views/help/requesting.rhtml b/app/views/help/requesting.html.erb
index e7cfdd199..e7cfdd199 100644
--- a/app/views/help/requesting.rhtml
+++ b/app/views/help/requesting.html.erb
diff --git a/app/views/help/unhappy.rhtml b/app/views/help/unhappy.html.erb
index 79e3f8273..79e3f8273 100644
--- a/app/views/help/unhappy.rhtml
+++ b/app/views/help/unhappy.html.erb
diff --git a/app/views/holiday/due_date.rhtml b/app/views/holiday/due_date.html.erb
index 6f8c2e51a..6f8c2e51a 100644
--- a/app/views/holiday/due_date.rhtml
+++ b/app/views/holiday/due_date.html.erb
diff --git a/app/views/layouts/admin.rhtml b/app/views/layouts/admin.html.erb
index a58913892..a58913892 100644
--- a/app/views/layouts/admin.rhtml
+++ b/app/views/layouts/admin.html.erb
diff --git a/app/views/layouts/contact_mailer.rhtml b/app/views/layouts/contact_mailer.html.erb
index 3cdc75009..3cdc75009 100644
--- a/app/views/layouts/contact_mailer.rhtml
+++ b/app/views/layouts/contact_mailer.html.erb
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.html.erb
index a66b85e02..023a93138 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.html.erb
@@ -43,7 +43,7 @@
<%= render :partial => 'general/before_head_end' %>
</head>
<body class="<%= 'front' if params[:action] == 'frontpage' %>">
- <% if Configuration::force_registration_on_new_request && !@user %>
+ <% if AlaveteliConfiguration::force_registration_on_new_request && !@user %>
<%= javascript_include_tag 'jquery.fancybox-1.3.4.pack' %>
<script type="text/javascript">
$(document).ready(function() {
@@ -93,9 +93,9 @@
<% end %>
- <%= link_to _("Sign out"), signout_path(:r => request.request_uri) %>
+ <%= link_to _("Sign out"), signout_path(:r => request.fullpath) %>
<% else %>
- <%= link_to _("Sign in or sign up"), signin_path(:r => request.request_uri) %>
+ <%= link_to _("Sign in or sign up"), signin_path(:r => request.fullpath) %>
<% end %>
</div>
<% end %>
@@ -140,13 +140,13 @@
<input type="text">
</div>
<%
- unless Configuration::ga_code.empty? || (@user && @user.super?) %>
+ unless AlaveteliConfiguration::ga_code.empty? || (@user && @user.super?) %>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
- var pageTracker = _gat._getTracker("<%= Configuration::ga_code %>");
+ var pageTracker = _gat._getTracker("<%= AlaveteliConfiguration::ga_code %>");
pageTracker._trackPageview();
</script>
diff --git a/app/views/layouts/no_chrome.rhtml b/app/views/layouts/no_chrome.html.erb
index 120ba6f28..120ba6f28 100644
--- a/app/views/layouts/no_chrome.rhtml
+++ b/app/views/layouts/no_chrome.html.erb
diff --git a/app/views/layouts/outgoing_mailer.rhtml b/app/views/layouts/outgoing_mailer.html.erb
index 8bf8ef216..8bf8ef216 100644
--- a/app/views/layouts/outgoing_mailer.rhtml
+++ b/app/views/layouts/outgoing_mailer.html.erb
diff --git a/app/views/layouts/request_mailer.rhtml b/app/views/layouts/request_mailer.html.erb
index 3cdc75009..3cdc75009 100644
--- a/app/views/layouts/request_mailer.rhtml
+++ b/app/views/layouts/request_mailer.html.erb
diff --git a/app/views/layouts/user_mailer.rhtml b/app/views/layouts/user_mailer.html.erb
index 3cdc75009..3cdc75009 100644
--- a/app/views/layouts/user_mailer.rhtml
+++ b/app/views/layouts/user_mailer.html.erb
diff --git a/app/views/outgoing_mailer/_followup_footer.rhtml b/app/views/outgoing_mailer/_followup_footer.text.erb
index d7bc7c5aa..d7bc7c5aa 100644
--- a/app/views/outgoing_mailer/_followup_footer.rhtml
+++ b/app/views/outgoing_mailer/_followup_footer.text.erb
diff --git a/app/views/outgoing_mailer/followup.rhtml b/app/views/outgoing_mailer/followup.text.erb
index 049ebc881..049ebc881 100644
--- a/app/views/outgoing_mailer/followup.rhtml
+++ b/app/views/outgoing_mailer/followup.text.erb
diff --git a/app/views/outgoing_mailer/initial_request.rhtml b/app/views/outgoing_mailer/initial_request.text.erb
index 5c418ecc7..5c418ecc7 100644
--- a/app/views/outgoing_mailer/initial_request.rhtml
+++ b/app/views/outgoing_mailer/initial_request.text.erb
diff --git a/app/views/public_body/_alphabet.rhtml b/app/views/public_body/_alphabet.html.erb
index 46b345c2a..111da5b3b 100644
--- a/app/views/public_body/_alphabet.rhtml
+++ b/app/views/public_body/_alphabet.html.erb
@@ -1,3 +1,3 @@
-<% "A".upto("Z") do |l| -%>
+<%= "A".upto("Z") do |l| -%>
<%= link_to_unless (@tag == l), l, list_public_bodies_path(:tag => l.downcase) %>
<% end %>
diff --git a/app/views/public_body/_body_listing.rhtml b/app/views/public_body/_body_listing.html.erb
index 864ab8c9b..864ab8c9b 100644
--- a/app/views/public_body/_body_listing.rhtml
+++ b/app/views/public_body/_body_listing.html.erb
diff --git a/app/views/public_body/_body_listing_single.rhtml b/app/views/public_body/_body_listing_single.html.erb
index d0496fbb8..d0496fbb8 100644
--- a/app/views/public_body/_body_listing_single.rhtml
+++ b/app/views/public_body/_body_listing_single.html.erb
diff --git a/app/views/public_body/_list_sidebar_extra.rhtml b/app/views/public_body/_list_sidebar_extra.html.erb
index d3d65fec8..d3d65fec8 100644
--- a/app/views/public_body/_list_sidebar_extra.rhtml
+++ b/app/views/public_body/_list_sidebar_extra.html.erb
diff --git a/app/views/public_body/_search_ahead.rhtml b/app/views/public_body/_search_ahead.html.erb
index 7ade89b8e..7ade89b8e 100644
--- a/app/views/public_body/_search_ahead.rhtml
+++ b/app/views/public_body/_search_ahead.html.erb
diff --git a/app/views/public_body/list.rhtml b/app/views/public_body/list.html.erb
index ea5cd9613..3d73090d4 100644
--- a/app/views/public_body/list.rhtml
+++ b/app/views/public_body/list.html.erb
@@ -32,7 +32,7 @@
<div id="left_column_flip">
<h1><%= _('Public authorities') %></h1>
-<% form_tag(list_public_bodies_default_url, :method => "get", :id=>"search_form") do %>
+<%= form_tag(list_public_bodies_default_url, :method => "get", :id=>"search_form") do %>
<div>
<%= text_field_tag(:public_body_query, params[:public_body_query], { :title => "type your search term here" } ) %>
<%= submit_tag(_("Search")) %>
diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.html.erb
index df6346e4f..df6346e4f 100644
--- a/app/views/public_body/show.rhtml
+++ b/app/views/public_body/show.html.erb
diff --git a/app/views/public_body/view_email.rhtml b/app/views/public_body/view_email.html.erb
index 3799d227b..3799d227b 100644
--- a/app/views/public_body/view_email.rhtml
+++ b/app/views/public_body/view_email.html.erb
diff --git a/app/views/public_body/view_email_captcha.rhtml b/app/views/public_body/view_email_captcha.html.erb
index 6f301e055..4f6db5b67 100644
--- a/app/views/public_body/view_email_captcha.rhtml
+++ b/app/views/public_body/view_email_captcha.html.erb
@@ -4,7 +4,7 @@
<p><%= _('To view the email address that we use to send FOI requests to {{public_body_name}}, please enter these words.', :public_body_name => h(@public_body.name))%></p>
-<% form_for :contact do |f| %>
+<%= form_for :contact do |f| %>
<%= recaptcha_tags %>
<%= hidden_field_tag(:submitted_view_email, { :value => 1 } ) %>
diff --git a/app/views/request/_after_actions.rhtml b/app/views/request/_after_actions.html.erb
index d3ddb981b..d3ddb981b 100644
--- a/app/views/request/_after_actions.rhtml
+++ b/app/views/request/_after_actions.html.erb
diff --git a/app/views/request/_bubble.rhtml b/app/views/request/_bubble.html.erb
index 94498612a..94498612a 100644
--- a/app/views/request/_bubble.rhtml
+++ b/app/views/request/_bubble.html.erb
diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.html.erb
index 68711b259..68711b259 100644
--- a/app/views/request/_correspondence.rhtml
+++ b/app/views/request/_correspondence.html.erb
diff --git a/app/views/request/_describe_state.rhtml b/app/views/request/_describe_state.html.erb
index 0b65024fd..05cce013e 100644
--- a/app/views/request/_describe_state.rhtml
+++ b/app/views/request/_describe_state.html.erb
@@ -1,6 +1,6 @@
<% if @is_owning_user %>
- <% form_for(:incoming_message, @info_request, :url => describe_state_url(:id => @info_request.id)) do |f| %>
+ <%= form_for(@info_request, :as => :incoming_message, :url => describe_state_url(:id => @info_request.id), :html => {:id => "describe_form_#{id_suffix}"}) do |f| %>
<h2><%= _('What best describes the status of this request now?') %></h2>
<hr>
@@ -101,13 +101,13 @@
</p>
<% end %>
<% elsif @old_unclassified %>
- <%= render :partial => 'other_describe_state', :locals => {:id_suffix => id_suffix } %>
+ <%= render :partial => 'request/other_describe_state', :locals => {:id_suffix => id_suffix } %>
<% else %>
<% if !@info_request.is_external? %>
<%= _('We don\'t know whether the most recent response to this request contains
information or not
&ndash;
- 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)) %>
+ 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.fullpath)) %>
<% end %>
<% end %>
diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.html.erb
index bccfccca7..6d2282613 100644
--- a/app/views/request/_followup.rhtml
+++ b/app/views/request/_followup.html.erb
@@ -79,7 +79,7 @@
</p>
<% end %>
- <% form_for(:outgoing_message, @outgoing_message, :html => { :id => 'followup_form' }, :url => incoming_message.nil? ? show_response_no_followup_url(:id => @info_request.id) : show_response_url(:id => @info_request.id, :incoming_message_id => incoming_message.id)) do |o| %>
+ <%= form_for(@outgoing_message, :html => { :id => 'followup_form' }, :url => incoming_message.nil? ? show_response_no_followup_url(:id => @info_request.id) : show_response_url(:id => @info_request.id, :incoming_message_id => incoming_message.id)) do |o| %>
<p>
<%= o.text_area :body, :rows => 15, :cols => 55 %>
</p>
diff --git a/app/views/request/_hidden_correspondence.rhtml b/app/views/request/_hidden_correspondence.html.erb
index 0873b312f..a5e680385 100644
--- a/app/views/request/_hidden_correspondence.rhtml
+++ b/app/views/request/_hidden_correspondence.html.erb
@@ -8,20 +8,20 @@
<div class="correspondence" id="incoming-<%=incoming_message.id.to_s%>">
<p>
<%= raw(_('This response has been hidden. See annotations to find out why.
- If you are the requester, then you may <a href="%s">sign in</a> to view the response.') % [signin_url(:r => request.request_uri)]) %>
+ If you are the requester, then you may <a href="%s">sign in</a> to view the response.') % [signin_url(:r => request.fullpath)]) %>
</p>
</div>
<% elsif [ 'sent', 'followup_sent', 'resent', 'followup_resent' ].include?(info_request_event.event_type) %>
<div class="correspondence" id="outgoing-<%=outgoing_message.id.to_s%>">
<p>
<%= raw(_('This outgoing message has been hidden. See annotations to
- find out why. If you are the requester, then you may <a href="%s">sign in</a> to view the response.') % [signin_url(:r => request.request_uri)]) %>
+ find out why. If you are the requester, then you may <a href="%s">sign in</a> to view the response.') % [signin_url(:r => request.fullpath)]) %>
</p>
</div>
<% elsif info_request_event.event_type == 'comment' %>
<div class="comment_in_request" id="comment-<%=comment.id.to_s%>">
<p><%= raw(_('This comment has been hidden. See annotations to
- find out why. If you are the requester, then you may <a href="%s">sign in</a> to view the response.') % [signin_url(:r => request.request_uri)]) %>
+ find out why. If you are the requester, then you may <a href="%s">sign in</a> to view the response.') % [signin_url(:r => request.fullpath)]) %>
</p>
</div>
<% end %>
diff --git a/app/views/request/_next_actions.rhtml b/app/views/request/_next_actions.html.erb
index f318df6e4..f318df6e4 100644
--- a/app/views/request/_next_actions.rhtml
+++ b/app/views/request/_next_actions.html.erb
diff --git a/app/views/request/_other_describe_state.rhtml b/app/views/request/_other_describe_state.html.erb
index 3a80823c6..e49f9ecb3 100644
--- a/app/views/request/_other_describe_state.rhtml
+++ b/app/views/request/_other_describe_state.html.erb
@@ -1,6 +1,6 @@
-<% form_for(:incoming_message, @info_request, :url => describe_state_url(:id => @info_request.id)) do |f| %>
+<%= form_for(@info_request, :as => :incoming_message, :url => describe_state_url(:id => @info_request.id), :html => {:id => "describe_form_#{id_suffix}"}) do |f| %>
<h2><%= _('Hi! We need your help. The person who made the following request
hasn\'t told us whether or not it was successful. Would you mind taking
a moment to read it and help us keep the place tidy for everyone?
diff --git a/app/views/request/_request_filter_form.rhtml b/app/views/request/_request_filter_form.html.erb
index 0c215a9b6..090db01df 100644
--- a/app/views/request/_request_filter_form.rhtml
+++ b/app/views/request/_request_filter_form.html.erb
@@ -1,7 +1,7 @@
<%= render :partial => 'general/localised_datepicker' %>
<div id="list-filter">
- <% form_tag(request.path, :method => "get", :id=>"filter_requests_form") do %>
+ <%= form_tag(request.path, :method => "get", :id=>"filter_requests_form") do %>
<div class="list-filter-item">
<%= label_tag(:query, _("Keywords"), :class=>"form_label title") %>
<%= text_field_tag(:query, params[:query]) %>
diff --git a/app/views/request/_request_listing.rhtml b/app/views/request/_request_listing.html.erb
index 492f874f3..492f874f3 100644
--- a/app/views/request/_request_listing.rhtml
+++ b/app/views/request/_request_listing.html.erb
diff --git a/app/views/request/_request_listing_short_via_event.rhtml b/app/views/request/_request_listing_short_via_event.html.erb
index c2f6474a1..c2f6474a1 100644
--- a/app/views/request/_request_listing_short_via_event.rhtml
+++ b/app/views/request/_request_listing_short_via_event.html.erb
diff --git a/app/views/request/_request_listing_single.rhtml b/app/views/request/_request_listing_single.html.erb
index 56737fd3e..25f63b367 100644
--- a/app/views/request/_request_listing_single.rhtml
+++ b/app/views/request/_request_listing_single.html.erb
@@ -1,6 +1,6 @@
<div class="request_listing">
<span class="head">
- <%= link_to h(info_request.title), (@play_urls ? categorise_request_path(:url_title => info_request.url_title) : request_path(info_request)) %>
+ <%= link_to h(info_request.title), request_path(:url_title => info_request.url_title).html_safe %>
</span>
<span class="desc">
<%= excerpt(info_request.initial_request_text, "", 150) %>
diff --git a/app/views/request/_request_listing_via_event.rhtml b/app/views/request/_request_listing_via_event.html.erb
index cc8bae8a9..cc8bae8a9 100644
--- a/app/views/request/_request_listing_via_event.rhtml
+++ b/app/views/request/_request_listing_via_event.html.erb
diff --git a/app/views/request/_search_ahead.rhtml b/app/views/request/_search_ahead.html.erb
index 1e65a5458..1e65a5458 100644
--- a/app/views/request/_search_ahead.rhtml
+++ b/app/views/request/_search_ahead.html.erb
diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.html.erb
index af33d31a2..80536da3e 100644
--- a/app/views/request/_sidebar.rhtml
+++ b/app/views/request/_sidebar.html.erb
@@ -11,12 +11,12 @@
<% if @info_request.attention_requested %>
<% if @info_request.prominence == 'hidden' %>
<%# The eccentric formatting of the following string is in order that it be identical
- to the corresponding string in request/show.rhtml %>
+ to the corresponding string in request/show.html.erb %>
<p><%= _('This request has prominence \'hidden\'. You can only see it because you are logged
in as a super user.') %></p>
<% elsif @info_request.prominence == 'requester_only' %>
<%# The eccentric formatting of the following string is in order that it be identical
- to the corresponding string in request/show.rhtml %>
+ to the corresponding string in request/show.html.erb %>
<p><%= raw(_('This request is hidden, so that only you the requester can see it. Please
<a href="%s">contact us</a> if you are not sure why.') % [help_requesting_path]) %></p>
<% else %>
@@ -25,26 +25,23 @@
<% else %>
<p><%= _('Requests for personal information and vexatious requests are not considered valid for FOI purposes (<a href="/help/about">read more</a>).') %></p>
<p><%= _('If you believe this request is not suitable, you can report it for attention by the site administrators') %></p>
- <%= button_to _("Report this request"), report_path, :class => "link_button_green" %>
+ <%= button_to _("Report this request"), report_path(:url_title => @info_request.url_title), :class => "link_button_green" %>
<% end %>
<% end %>
<h2><%= _("Act on what you've learnt") %></h2>
<div class="act_link">
- <%
- # Cast "related" to normal string because html safe string (from rails_xss gem) and CGI::escape
- # interact badly with ':' character. Go figure! Might go away in rails 3
- %>
- <% link_to "https://twitter.com/share?" + {:url => request.url, :via => Configuration::twitter_username, :text => @info_request.title, :related => _('alaveteli_foi:The software that runs {{site_name}}', :site_name => site_name).to_str}.to_query do %>
+ <% tweet_link = "https://twitter.com/share?url=#{h(request.url)}&via=#{h(AlaveteliConfiguration::twitter_username)}&text='#{h(@info_request.title)}'&related=#{_('alaveteli_foi:The software that runs {{site_name}}', :site_name => h(site_name))}" %>
+ <%= link_to tweet_link do %>
<%= image_tag "twitter-16.png", :alt => "twitter icon" %>
- <%= _("Tweet this request") %>
<% end %>
+ <%= link_to _("Tweet this request"), tweet_link %>
</div>
<div class="act_link">
- <% link_to "http://wordpress.com/" do %>
+ <%= link_to "http://wordpress.com/" do %>
<%= image_tag "wordpress.png", :class => "rss" %>
- <%= _("Start your own blog") %>
<% end %>
+ <%= link_to _("Start your own blog"), "http://wordpress.com/"%>
</div>
<%= render :partial => 'request/next_actions' %>
diff --git a/app/views/request/_sidebar_request_listing.rhtml b/app/views/request/_sidebar_request_listing.html.erb
index ec5a5813d..ec5a5813d 100644
--- a/app/views/request/_sidebar_request_listing.rhtml
+++ b/app/views/request/_sidebar_request_listing.html.erb
diff --git a/app/views/request/_summary_suggestion.rhtml b/app/views/request/_summary_suggestion.html.erb
index a5da09cda..a5da09cda 100644
--- a/app/views/request/_summary_suggestion.rhtml
+++ b/app/views/request/_summary_suggestion.html.erb
diff --git a/app/views/request/_view_html_prefix.rhtml b/app/views/request/_view_html_prefix.html.erb
index 3a9946745..3a9946745 100644
--- a/app/views/request/_view_html_prefix.rhtml
+++ b/app/views/request/_view_html_prefix.html.erb
diff --git a/app/views/request/_view_html_stylesheet.rhtml b/app/views/request/_view_html_stylesheet.html.erb
index d6cb932a8..d6cb932a8 100644
--- a/app/views/request/_view_html_stylesheet.rhtml
+++ b/app/views/request/_view_html_stylesheet.html.erb
diff --git a/app/views/request/_wall_listing.rhtml b/app/views/request/_wall_listing.html.erb
index 4a76b09bf..4a76b09bf 100644
--- a/app/views/request/_wall_listing.rhtml
+++ b/app/views/request/_wall_listing.html.erb
diff --git a/app/views/request/details.rhtml b/app/views/request/details.html.erb
index 3cb2f5afe..3cb2f5afe 100644
--- a/app/views/request/details.rhtml
+++ b/app/views/request/details.html.erb
diff --git a/app/views/request/followup_bad.rhtml b/app/views/request/followup_bad.html.erb
index c892263e6..c892263e6 100644
--- a/app/views/request/followup_bad.rhtml
+++ b/app/views/request/followup_bad.html.erb
diff --git a/app/views/request/followup_preview.rhtml b/app/views/request/followup_preview.html.erb
index 50c64138f..55afc0245 100644
--- a/app/views/request/followup_preview.rhtml
+++ b/app/views/request/followup_preview.html.erb
@@ -2,7 +2,7 @@
<div id="followup">
-<% form_for(:outgoing_message, @outgoing_message, :html => { :id => 'preview_form' }, :url => (@incoming_message.nil? ? show_response_no_followup_url(:id => @info_request.id) : show_response_url(:id => @info_request.id, :incoming_message_id => @incoming_message.id)) + "#followup" ) do |o| %>
+<%= form_for(@outgoing_message, :html => { :id => 'preview_form' }, :url => (@incoming_message.nil? ? show_response_no_followup_url(:id => @info_request.id) : show_response_url(:id => @info_request.id, :incoming_message_id => @incoming_message.id)) + "#followup" ) do |o| %>
<% if @internal_review %>
<h1><%= _('Now preview your message asking for an internal review') %></h1>
@@ -15,7 +15,7 @@
<li><%= _('Your message will appear in <strong>search engines</strong>') %></li>
</ul>
- <% fields_for :outgoing_message do |o| %>
+ <%= fields_for :outgoing_message do |o| %>
<div class="correspondence" id="outgoing-0">
<p class="preview_subject">
diff --git a/app/views/request/hidden.rhtml b/app/views/request/hidden.html.erb
index 2d038a663..41b2ff7e4 100644
--- a/app/views/request/hidden.rhtml
+++ b/app/views/request/hidden.html.erb
@@ -12,7 +12,7 @@ various reasons why we might have done this, sorry we can\'t be more specific he
</p>
<% if @info_request.prominence == 'requester_only' %>
<p>
- <%= raw(_('If you are the requester, then you may <a href="%s">sign in</a> to view the request.') % [signin_url(:r => request.request_uri)]) %>
+ <%= raw(_('If you are the requester, then you may <a href="%s">sign in</a> to view the request.') % [signin_url(:r => request.fullpath)]) %>
</p>
<% end %>
diff --git a/app/views/request/list.rhtml b/app/views/request/list.html.erb
index 062b77c3e..062b77c3e 100644
--- a/app/views/request/list.rhtml
+++ b/app/views/request/list.html.erb
diff --git a/app/views/request/new.rhtml b/app/views/request/new.html.erb
index 4766c981b..398147041 100644
--- a/app/views/request/new.rhtml
+++ b/app/views/request/new.html.erb
@@ -33,7 +33,7 @@
<%= foi_error_messages_for :info_request, :outgoing_message %>
- <% form_for(:info_request, @info_request, :html => { :id => 'write_form' } ) do |f| %>
+ <%= form_for(@info_request, :url => new_request_path, :html => { :id => 'write_form' } ) do |f| %>
<div id="request_header">
<div id="request_header_body">
@@ -103,7 +103,7 @@
</div>
<div id="request_form">
- <% fields_for :outgoing_message do |o| %>
+ <%= 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 %>
diff --git a/app/views/request/new_bad_contact.rhtml b/app/views/request/new_bad_contact.html.erb
index 56f3f4168..56f3f4168 100644
--- a/app/views/request/new_bad_contact.rhtml
+++ b/app/views/request/new_bad_contact.html.erb
diff --git a/app/views/request/new_please_describe.rhtml b/app/views/request/new_please_describe.html.erb
index ff27405b8..6a193e70d 100644
--- a/app/views/request/new_please_describe.rhtml
+++ b/app/views/request/new_please_describe.html.erb
@@ -13,7 +13,7 @@ if they are successful yet or not.') %>
</ul>
<p>
- <%= raw(_('When you\'re done, <strong>come back here</strong>, <a href="%s">reload this page</a> and file your new request.') % [request.request_uri]) %>
+ <%= raw(_('When you\'re done, <strong>come back here</strong>, <a href="%s">reload this page</a> and file your new request.') % [request.fullpath]) %>
</p>
<p>
diff --git a/app/views/request/preview.rhtml b/app/views/request/preview.html.erb
index 8d1fd753e..84be15ed2 100644
--- a/app/views/request/preview.rhtml
+++ b/app/views/request/preview.html.erb
@@ -1,7 +1,7 @@
<% @title = "Preview new " + h(@info_request.law_used_short) + " request to '" + h(@info_request.public_body.name) + "'" %>
-<% form_for(:info_request, @info_request, :html => { :id => 'preview_form' } ) do |f| %>
-
+<%= form_for(@info_request, :url => new_request_path, :html => { :id => 'preview_form' } ) do |f| %>
+
<h1><%= _('3. Now check your request') %></h1>
<ul>
<li><%= _('Check you haven\'t included any <strong>personal information</strong>.') %></li>
@@ -10,7 +10,7 @@
</li>
</ul>
- <% fields_for :outgoing_message do |o| %>
+ <%= fields_for :outgoing_message do |o| %>
<div class="correspondence" id="outgoing-0">
<p class="preview_subject">
@@ -45,4 +45,4 @@
<p><strong><%= _('Tags:') %></strong> <%=h @info_request.tag_string %></p>
<% end %>
-<% end %> \ No newline at end of file
+<% end %>
diff --git a/app/views/request/select_authority.rhtml b/app/views/request/select_authority.html.erb
index 94e690e64..43a91beff 100644
--- a/app/views/request/select_authority.rhtml
+++ b/app/views/request/select_authority.html.erb
@@ -30,7 +30,7 @@
<h1 style="clear: left"><%= _('1. Select an authority') %></h1>
<div id="authority_selection">
- <% form_tag({:controller => "request", :action => "select_authority"}, {:id => "search_form", :method => "get"}) do %>
+ <%= form_tag({:controller => "request", :action => "select_authority"}, {:id => "search_form", :method => "get"}) do %>
<div>
<p>
<%= raw(_('First, type in the <strong>name of the UK public authority</strong> you\'d
diff --git a/app/views/request/show.rhtml b/app/views/request/show.html.erb
index ef49ef958..54006b291 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.html.erb
@@ -106,7 +106,7 @@
<%= _('The request is <strong>waiting for clarification</strong>.') %>
<% if !@info_request.is_external? %>
<%= _('If you are {{user_link}}, please',:user_link=>user_link_for_request(@info_request)) %>
- <%= link_to _("sign in"), signin_path(:r => request.request_uri) %> <%= _('to send a follow up message.') %>
+ <%= link_to _("sign in"), signin_path(:r => request.fullpath) %> <%= _('to send a follow up message.') %>
<% end %>
<% end %>
<% elsif @status == 'gone_postal' %>
diff --git a/app/views/request/show_response.rhtml b/app/views/request/show_response.html.erb
index ac1f04227..ac1f04227 100644
--- a/app/views/request/show_response.rhtml
+++ b/app/views/request/show_response.html.erb
diff --git a/app/views/request/similar.rhtml b/app/views/request/similar.html.erb
index 0d53f6919..0d53f6919 100644
--- a/app/views/request/similar.rhtml
+++ b/app/views/request/similar.html.erb
diff --git a/app/views/request/simple_correspondence.rhtml b/app/views/request/simple_correspondence.html.erb
index 0da9ef172..461fa3912 100644
--- a/app/views/request/simple_correspondence.rhtml
+++ b/app/views/request/simple_correspondence.html.erb
@@ -1,4 +1,4 @@
-<%= _('This is a plain-text version of the Freedom of Information request "{{request_title}}". The latest, full version is available online at {{full_url}}', :request_title => @info_request.title, :full_url => "http://#{Configuration::domain}#{show_request_path(:url_title=>@info_request.url_title)}") %>.
+<%= _('This is a plain-text version of the Freedom of Information request "{{request_title}}". The latest, full version is available online at {{full_url}}', :request_title => @info_request.title, :full_url => "http://#{AlaveteliConfiguration::domain}#{show_request_path(:url_title=>@info_request.url_title)}") %>.
<% for info_request_event in @info_request_events %>
<%
diff --git a/app/views/request/upload_response.rhtml b/app/views/request/upload_response.html.erb
index 675951595..158d5d3c4 100644
--- a/app/views/request/upload_response.rhtml
+++ b/app/views/request/upload_response.html.erb
@@ -30,7 +30,7 @@
<p><%= raw(_('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 %>
+ <%= 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 %>
diff --git a/app/views/request_game/play.rhtml b/app/views/request_game/play.html.erb
index d5aa0d00e..d5aa0d00e 100644
--- a/app/views/request_game/play.rhtml
+++ b/app/views/request_game/play.html.erb
diff --git a/app/views/request_mailer/comment_on_alert.rhtml b/app/views/request_mailer/comment_on_alert.text.erb
index 691e6f9bb..691e6f9bb 100644
--- a/app/views/request_mailer/comment_on_alert.rhtml
+++ b/app/views/request_mailer/comment_on_alert.text.erb
diff --git a/app/views/request_mailer/comment_on_alert_plural.rhtml b/app/views/request_mailer/comment_on_alert_plural.text.erb
index a495b8e08..a495b8e08 100644
--- a/app/views/request_mailer/comment_on_alert_plural.rhtml
+++ b/app/views/request_mailer/comment_on_alert_plural.text.erb
diff --git a/app/views/request_mailer/external_response.rhtml b/app/views/request_mailer/external_response.rhtml
deleted file mode 100644
index 896054a43..000000000
--- a/app/views/request_mailer/external_response.rhtml
+++ /dev/null
@@ -1 +0,0 @@
-<%= raw @body %>
diff --git a/app/views/request_mailer/external_response.text.erb b/app/views/request_mailer/external_response.text.erb
new file mode 100644
index 000000000..fab256adf
--- /dev/null
+++ b/app/views/request_mailer/external_response.text.erb
@@ -0,0 +1 @@
+<%= @message_body %>
diff --git a/app/views/request_mailer/fake_response.rhtml b/app/views/request_mailer/fake_response.rhtml
deleted file mode 100644
index 896054a43..000000000
--- a/app/views/request_mailer/fake_response.rhtml
+++ /dev/null
@@ -1 +0,0 @@
-<%= raw @body %>
diff --git a/app/views/request_mailer/fake_response.text.erb b/app/views/request_mailer/fake_response.text.erb
new file mode 100644
index 000000000..fab256adf
--- /dev/null
+++ b/app/views/request_mailer/fake_response.text.erb
@@ -0,0 +1 @@
+<%= @message_body %>
diff --git a/app/views/request_mailer/new_response.rhtml b/app/views/request_mailer/new_response.text.erb
index 672212f20..672212f20 100644
--- a/app/views/request_mailer/new_response.rhtml
+++ b/app/views/request_mailer/new_response.text.erb
diff --git a/app/views/request_mailer/new_response_reminder_alert.rhtml b/app/views/request_mailer/new_response_reminder_alert.text.erb
index c196dafe6..c196dafe6 100644
--- a/app/views/request_mailer/new_response_reminder_alert.rhtml
+++ b/app/views/request_mailer/new_response_reminder_alert.text.erb
diff --git a/app/views/request_mailer/not_clarified_alert.rhtml b/app/views/request_mailer/not_clarified_alert.text.erb
index 2408452b3..2408452b3 100644
--- a/app/views/request_mailer/not_clarified_alert.rhtml
+++ b/app/views/request_mailer/not_clarified_alert.text.erb
diff --git a/app/views/request_mailer/old_unclassified_updated.rhtml b/app/views/request_mailer/old_unclassified_updated.text.erb
index 5b8534832..5b8534832 100644
--- a/app/views/request_mailer/old_unclassified_updated.rhtml
+++ b/app/views/request_mailer/old_unclassified_updated.text.erb
diff --git a/app/views/request_mailer/overdue_alert.rhtml b/app/views/request_mailer/overdue_alert.text.erb
index 249bf6bb8..249bf6bb8 100644
--- a/app/views/request_mailer/overdue_alert.rhtml
+++ b/app/views/request_mailer/overdue_alert.text.erb
diff --git a/app/views/request_mailer/requires_admin.rhtml b/app/views/request_mailer/requires_admin.text.erb
index b2e58295e..b2e58295e 100644
--- a/app/views/request_mailer/requires_admin.rhtml
+++ b/app/views/request_mailer/requires_admin.text.erb
diff --git a/app/views/request_mailer/stopped_responses.rhtml b/app/views/request_mailer/stopped_responses.text.erb
index 9cd156860..9cd156860 100644
--- a/app/views/request_mailer/stopped_responses.rhtml
+++ b/app/views/request_mailer/stopped_responses.text.erb
diff --git a/app/views/request_mailer/very_overdue_alert.rhtml b/app/views/request_mailer/very_overdue_alert.text.erb
index 80597473c..80597473c 100644
--- a/app/views/request_mailer/very_overdue_alert.rhtml
+++ b/app/views/request_mailer/very_overdue_alert.text.erb
diff --git a/app/views/track/_tracking_links.rhtml b/app/views/track/_tracking_links.html.erb
index d89c0e4a9..a16dbc78f 100644
--- a/app/views/track/_tracking_links.rhtml
+++ b/app/views/track/_tracking_links.html.erb
@@ -9,7 +9,7 @@
<% elsif existing_track %>
<p><%= track_thing.params[:verb_on_page_already] %></p>
<div class="feed_link feed_link_<%=location%>">
- <%= link_to _("Unsubscribe"), {:controller => 'track', :action => 'update', :track_id => existing_track.id, :track_medium => "delete", :r => request.request_uri}, :class => "link_button_green" %>
+ <%= link_to _("Unsubscribe"), {:controller => 'track', :action => 'update', :track_id => existing_track.id, :track_medium => "delete", :r => request.fullpath}, :class => "link_button_green" %>
</div>
<% elsif track_thing %>
<div class="feed_link feed_link_<%=location%>">
diff --git a/app/views/track/atom_feed.atom.erb b/app/views/track/atom_feed.atom.erb
index 23c932308..a12b9eff0 100644
--- a/app/views/track/atom_feed.atom.erb
+++ b/app/views/track/atom_feed.atom.erb
@@ -9,7 +9,7 @@
# Get the HTML content from the same partial template as website search does
content = ''
if result[:model].class.to_s == 'InfoRequestEvent'
- content += render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request }
+ content += render :partial => 'request/request_listing_via_event.html', :locals => { :event => result[:model], :info_request => result[:model].info_request }
else
content = "<p><strong>Unknown search result type " + result[:model].class.to_s + "</strong></p>"
end
diff --git a/app/views/track_mailer/event_digest.rhtml b/app/views/track_mailer/event_digest.text.erb
index 8dbc7fe06..8dbc7fe06 100644
--- a/app/views/track_mailer/event_digest.rhtml
+++ b/app/views/track_mailer/event_digest.text.erb
diff --git a/app/views/user/_change_receive_email.rhtml b/app/views/user/_change_receive_email.html.erb
index 83e5d8601..12824f711 100644
--- a/app/views/user/_change_receive_email.rhtml
+++ b/app/views/user/_change_receive_email.html.erb
@@ -1,4 +1,4 @@
-<% form_tag(:controller=>"user", :action=>"set_receive_email_alerts") do %>
+<%= form_tag(:controller=>"user", :action=>"set_receive_email_alerts") do %>
<div>
<% if @user.receive_email_alerts %>
<%= _('You are currently receiving notification of new activity on your wall by email.', :wall_url => show_user_wall_path) %><br><br>
diff --git a/app/views/user/_show_user_info.rhtml b/app/views/user/_show_user_info.html.erb
index 305300236..305300236 100644
--- a/app/views/user/_show_user_info.rhtml
+++ b/app/views/user/_show_user_info.html.erb
diff --git a/app/views/user/_signin.rhtml b/app/views/user/_signin.html.erb
index 7db07e4b4..afc55d249 100644
--- a/app/views/user/_signin.rhtml
+++ b/app/views/user/_signin.html.erb
@@ -1,6 +1,6 @@
<div id="signin">
-<% form_tag({:action => "signin"}, {:id => "signin_form"}) do %>
+<%= form_tag({:action => "signin"}, {:id => "signin_form"}) do %>
<%= foi_error_messages_for :user_signin %>
<!--<% if not sign_in_as_existing_user %>
diff --git a/app/views/user/_signup.rhtml b/app/views/user/_signup.html.erb
index 89ab19b7e..ac4fd3e10 100644
--- a/app/views/user/_signup.rhtml
+++ b/app/views/user/_signup.html.erb
@@ -1,6 +1,6 @@
<div id="signup">
-<% form_tag({:action => "signup"}, {:id => "signup_form"}) do %>
+<%= form_tag({:action => "signup"}, {:id => "signup_form"}) do %>
<%= foi_error_messages_for :user_signup %>
<!--<h2><%= _('If you\'re new to {{site_name}}', :site_name=>site_name)%></h2>-->
diff --git a/app/views/user/_user_listing_single.rhtml b/app/views/user/_user_listing_single.html.erb
index ed1b95718..ed1b95718 100644
--- a/app/views/user/_user_listing_single.rhtml
+++ b/app/views/user/_user_listing_single.html.erb
diff --git a/app/views/user/bad_token.rhtml b/app/views/user/bad_token.html.erb
index 538bc5606..538bc5606 100644
--- a/app/views/user/bad_token.rhtml
+++ b/app/views/user/bad_token.html.erb
diff --git a/app/views/user/banned.rhtml b/app/views/user/banned.html.erb
index 475c10977..475c10977 100644
--- a/app/views/user/banned.rhtml
+++ b/app/views/user/banned.html.erb
diff --git a/app/views/user/confirm.rhtml b/app/views/user/confirm.html.erb
index bc70a1f36..bc70a1f36 100644
--- a/app/views/user/confirm.rhtml
+++ b/app/views/user/confirm.html.erb
diff --git a/app/views/user/contact.rhtml b/app/views/user/contact.html.erb
index 333b72334..6d23dd1ed 100644
--- a/app/views/user/contact.rhtml
+++ b/app/views/user/contact.html.erb
@@ -6,7 +6,7 @@
<%= foi_error_messages_for :contact %>
-<% form_for :contact do |f| %>
+<%= form_for :contact do |f| %>
<div class="form_note">
<h1><%= _("Contact {{recipient}}", :recipient => h(@recipient_user.name)) %></h1>
diff --git a/app/views/user/no_cookies.rhtml b/app/views/user/no_cookies.html.erb
index c291367f2..c291367f2 100644
--- a/app/views/user/no_cookies.rhtml
+++ b/app/views/user/no_cookies.html.erb
diff --git a/app/views/user/rate_limited.rhtml b/app/views/user/rate_limited.html.erb
index d52deebab..54a4e0461 100644
--- a/app/views/user/rate_limited.rhtml
+++ b/app/views/user/rate_limited.html.erb
@@ -2,7 +2,7 @@
<h1><%=@title%></h1>
-<p><%= _("You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}.", :max_requests_per_user_per_day => Configuration::max_requests_per_user_per_day, :can_make_another_request => distance_of_time_in_words(Time.now, @next_request_permitted_at))%></p>
+<p><%= _("You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}.", :max_requests_per_user_per_day => AlaveteliConfiguration::max_requests_per_user_per_day, :can_make_another_request => distance_of_time_in_words(Time.now, @next_request_permitted_at))%></p>
<p><%= _("There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please <a href='{{help_contact_path}}'>get in touch</a>.", :help_contact_path => help_contact_path) %></p>
diff --git a/app/views/user/river.rhtml b/app/views/user/river.html.erb
index 9618e0aa8..9618e0aa8 100644
--- a/app/views/user/river.rhtml
+++ b/app/views/user/river.html.erb
diff --git a/app/views/user/set_crop_profile_photo.rhtml b/app/views/user/set_crop_profile_photo.html.erb
index eed0304d2..fea7ccab8 100644
--- a/app/views/user/set_crop_profile_photo.rhtml
+++ b/app/views/user/set_crop_profile_photo.html.erb
@@ -9,7 +9,7 @@
<div id="set_crop_profile_photo">
-<% form_tag 'set_photo', :id => 'set_crop_profile_photo_form', :multipart => true do %>
+<%= form_tag 'set_photo', :id => 'set_crop_profile_photo_form', :multipart => true do %>
<table>
<tr>
diff --git a/app/views/user/set_draft_profile_photo.rhtml b/app/views/user/set_draft_profile_photo.html.erb
index 757498249..b4bdd80f3 100644
--- a/app/views/user/set_draft_profile_photo.rhtml
+++ b/app/views/user/set_draft_profile_photo.html.erb
@@ -8,7 +8,7 @@
<div id="set_draft_profile_photo">
-<% form_tag 'set_photo', :id => 'set_draft_profile_photo_form', :multipart => true do %>
+<%= 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>
<%= file_field_tag :file, :size => 35, :id => 'file_1' %>
@@ -45,7 +45,7 @@
<h2><%= _('OR remove the existing photo')%></h2>
- <% form_tag 'clear_photo', :id => 'clear_profile_photo_form', :multipart => true do %>
+ <%= form_tag 'clear_photo', :id => 'clear_profile_photo_form', :multipart => true do %>
<%= submit_tag _("Clear photo") %>
<% end %>
diff --git a/app/views/user/set_profile_about_me.rhtml b/app/views/user/set_profile_about_me.html.erb
index 4fe1047da..fb7de7e97 100644
--- a/app/views/user/set_profile_about_me.rhtml
+++ b/app/views/user/set_profile_about_me.html.erb
@@ -4,7 +4,7 @@
<%= foi_error_messages_for :about_me %>
-<% form_for :about_me do |f| %>
+<%= form_for :about_me do |f| %>
<div class="form_note">
<h1><%= _('Edit text about you')%></h1>
<p>
@@ -26,7 +26,7 @@
<%= _(' Include relevant links, such as to a campaign page, your blog or a
twitter account. They will be made clickable.
e.g.')%>
- <a href="https://twitter.com/<%= Configuration::twitter_username %>">https://twitter.com/<%= Configuration::twitter_username %></a>
+ <a href="https://twitter.com/<%= AlaveteliConfiguration::twitter_username %>">https://twitter.com/<%= AlaveteliConfiguration::twitter_username %></a>
</p>
</div>
diff --git a/app/views/user/show.rhtml b/app/views/user/show.html.erb
index a3dea619d..b92ffcff2 100644
--- a/app/views/user/show.rhtml
+++ b/app/views/user/show.html.erb
@@ -97,7 +97,7 @@
<% if not @is_you %>
<p id="user_not_logged_in">
- <%= raw(_('<a href="%s">Sign in</a> to change password, subscriptions and more ({{user_name}} only)',:user_name=>h(@display_user.name)) % [signin_url(:r => request.request_uri)]) %>
+ <%= raw(_('<a href="%s">Sign in</a> to change password, subscriptions and more ({{user_name}} only)',:user_name=>h(@display_user.name)) % [signin_url(:r => request.fullpath)]) %>
</p>
<% end %>
</div>
@@ -107,7 +107,7 @@
<% if @show_requests %>
<div id="user_profile_search">
- <% form_tag(show_user_url, :method => "get", :id=>"search_form") do %>
+ <%= form_tag(show_user_url, :method => "get", :id=>"search_form") do %>
<div>
<%= text_field_tag(:user_query, params[:user_query], {:title => "type your search term here" }) %>
<% if @is_you %>
@@ -181,12 +181,12 @@
<p><%= _("You're not following anything.")%></p>
<% else %>
<% if @track_things_grouped.size == 1 %>
- <% form_tag({:controller => 'track', :action => 'delete_all_type'}, :class => "feed_form") do %>
+ <%= form_tag({:controller => 'track', :action => 'delete_all_type'}, :class => "feed_form") do %>
<h3>
<%=TrackThing.track_type_description(@track_things[0].track_type)%>
<%= hidden_field_tag 'track_type', @track_things[0].track_type %>
<%= hidden_field_tag 'user', @display_user.id %>
- <%= hidden_field_tag 'r', request.request_uri %>
+ <%= hidden_field_tag 'r', request.fullpath %>
<% if @track_things.size > 1 %>
<%= submit_tag _('unsubscribe all') %>
<% end %>
@@ -195,12 +195,12 @@
<% end %>
<% for track_type, track_things in @track_things_grouped %>
<% if @track_things_grouped.size > 1 %>
- <% form_tag({:controller => 'track', :action => 'delete_all_type'}, :class => "feed_form") do %>
+ <%= form_tag({:controller => 'track', :action => 'delete_all_type'}, :class => "feed_form") do %>
<h3>
<%=TrackThing.track_type_description(track_type)%>
<%= hidden_field_tag 'track_type', track_type %>
<%= hidden_field_tag 'user', @display_user.id %>
- <%= hidden_field_tag 'r', request.request_uri %>
+ <%= hidden_field_tag 'r', request.fullpath %>
<% if track_things.size > 1 %>
<%= submit_tag _('unsubscribe all')%>
<% end %>
@@ -211,11 +211,11 @@
<ul>
<% for track_thing in track_things %>
<li>
- <% form_tag({:controller => 'track', :action => 'update', :track_id => track_thing.id}, :class => "feed_form") do %>
+ <%= form_tag({:controller => 'track', :action => 'update', :track_id => track_thing.id}, :class => "feed_form") do %>
<div>
<%= 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 } %>
+ <%= hidden_field_tag 'r', request.fullpath, { :id => 'r_' + track_thing.id.to_s } %>
<%= submit_tag _('unsubscribe') %>
</div>
<% end %>
diff --git a/app/views/user/sign.rhtml b/app/views/user/sign.html.erb
index 6a1979155..6a1979155 100644
--- a/app/views/user/sign.rhtml
+++ b/app/views/user/sign.html.erb
diff --git a/app/views/user/signchangeemail.rhtml b/app/views/user/signchangeemail.html.erb
index 0f8b76bc5..7308179f4 100644
--- a/app/views/user/signchangeemail.rhtml
+++ b/app/views/user/signchangeemail.html.erb
@@ -4,7 +4,7 @@
<div id="change_email">
-<% form_tag({:action => "signchangeemail"}, {:id => "signchangeemail_form"}) do %>
+<%= form_tag({:action => "signchangeemail"}, {:id => "signchangeemail_form"}) do %>
<%= foi_error_messages_for :signchangeemail %>
<div class="form_note">
diff --git a/app/views/user/signchangeemail_confirm.rhtml b/app/views/user/signchangeemail_confirm.html.erb
index bfedbac2d..bfedbac2d 100644
--- a/app/views/user/signchangeemail_confirm.rhtml
+++ b/app/views/user/signchangeemail_confirm.html.erb
diff --git a/app/views/user/signchangepassword.rhtml b/app/views/user/signchangepassword.html.erb
index edb980b9f..51bcb466d 100644
--- a/app/views/user/signchangepassword.rhtml
+++ b/app/views/user/signchangepassword.html.erb
@@ -4,7 +4,7 @@
<div id="change_password">
-<% form_tag({:action => "signchangepassword"}, {:id => "signchangepassword_form"}) do %>
+<%= form_tag({:action => "signchangepassword"}, {:id => "signchangepassword_form"}) do %>
<%= foi_error_messages_for :user %>
<div class="form_note">
diff --git a/app/views/user/signchangepassword_confirm.rhtml b/app/views/user/signchangepassword_confirm.html.erb
index 63b6515cd..63b6515cd 100644
--- a/app/views/user/signchangepassword_confirm.rhtml
+++ b/app/views/user/signchangepassword_confirm.html.erb
diff --git a/app/views/user/signchangepassword_send_confirm.rhtml b/app/views/user/signchangepassword_send_confirm.html.erb
index 84ee28f07..850237c34 100644
--- a/app/views/user/signchangepassword_send_confirm.rhtml
+++ b/app/views/user/signchangepassword_send_confirm.html.erb
@@ -2,7 +2,7 @@
<div id="change_password">
-<% form_tag({:action => "signchangepassword"}, {:id => "signchangepassword_form"}) do %>
+<%= form_tag({:action => "signchangepassword"}, {:id => "signchangepassword_form"}) do %>
<%= foi_error_messages_for :signchangepassword %>
<div class="form_note">
diff --git a/app/views/user/signin_successful.rhtml b/app/views/user/signin_successful.html.erb
index 675701d74..675701d74 100644
--- a/app/views/user/signin_successful.rhtml
+++ b/app/views/user/signin_successful.html.erb
diff --git a/app/views/user/wall.rhtml b/app/views/user/wall.html.erb
index 190cc0a6d..190cc0a6d 100644
--- a/app/views/user/wall.rhtml
+++ b/app/views/user/wall.html.erb
diff --git a/app/views/user/wrong_user.rhtml b/app/views/user/wrong_user.html.erb
index 30256a639..30256a639 100644
--- a/app/views/user/wrong_user.rhtml
+++ b/app/views/user/wrong_user.html.erb
diff --git a/app/views/user/wrong_user_unknown_email.rhtml b/app/views/user/wrong_user_unknown_email.html.erb
index c59c56941..c59c56941 100644
--- a/app/views/user/wrong_user_unknown_email.rhtml
+++ b/app/views/user/wrong_user_unknown_email.html.erb
diff --git a/app/views/user_mailer/already_registered.rhtml b/app/views/user_mailer/already_registered.text.erb
index 32c2c7e63..32c2c7e63 100644
--- a/app/views/user_mailer/already_registered.rhtml
+++ b/app/views/user_mailer/already_registered.text.erb
diff --git a/app/views/user_mailer/changeemail_already_used.rhtml b/app/views/user_mailer/changeemail_already_used.text.erb
index 1d74dda35..1d74dda35 100644
--- a/app/views/user_mailer/changeemail_already_used.rhtml
+++ b/app/views/user_mailer/changeemail_already_used.text.erb
diff --git a/app/views/user_mailer/changeemail_confirm.rhtml b/app/views/user_mailer/changeemail_confirm.text.erb
index c73e9486b..c73e9486b 100644
--- a/app/views/user_mailer/changeemail_confirm.rhtml
+++ b/app/views/user_mailer/changeemail_confirm.text.erb
diff --git a/app/views/user_mailer/confirm_login.rhtml b/app/views/user_mailer/confirm_login.text.erb
index fa86dc2b1..fa86dc2b1 100644
--- a/app/views/user_mailer/confirm_login.rhtml
+++ b/app/views/user_mailer/confirm_login.text.erb