diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin_raw_email_controller.rb | 37 | ||||
-rw-r--r-- | app/controllers/admin_request_controller.rb | 28 | ||||
-rw-r--r-- | app/views/admin_general/index.html.erb | 4 | ||||
-rw-r--r-- | app/views/admin_incoming_message/_actions.html.erb (renamed from app/views/admin_request/_incoming_message_actions.html.erb) | 2 | ||||
-rw-r--r-- | app/views/admin_incoming_message/edit.html.erb | 2 | ||||
-rw-r--r-- | app/views/admin_raw_email/show.html.erb (renamed from app/views/admin_request/show_raw_email.html.erb) | 2 | ||||
-rw-r--r-- | app/views/admin_request/show.html.erb | 2 |
7 files changed, 43 insertions, 34 deletions
diff --git a/app/controllers/admin_raw_email_controller.rb b/app/controllers/admin_raw_email_controller.rb new file mode 100644 index 000000000..cfff2d0b6 --- /dev/null +++ b/app/controllers/admin_raw_email_controller.rb @@ -0,0 +1,37 @@ +# app/controllers/admin_raw_email_controller.rb: +# Controller for managing raw emails from the admin interface. +# +# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. +# Email: hello@mysociety.org; WWW: http://www.mysociety.org/ + +class AdminRawEmailController < AdminController + + def show + @raw_email = RawEmail.find(params[:id]) + # For the holding pen, try to guess where it should be ... + @holding_pen = false + if (@raw_email.incoming_message.info_request == InfoRequest.holding_pen_request && !@raw_email.incoming_message.empty_from_field?) + @holding_pen = true + + # 1. Use domain of email to try and guess which public body it + # is associated with, so we can display that. + email = @raw_email.incoming_message.from_email + domain = PublicBody.extract_domain_from_email(email) + + if domain.nil? + @public_bodies = [] + else + @public_bodies = PublicBody.find(:all, :order => "name", + :conditions => [ "lower(request_email) like lower('%'||?||'%')", domain ]) + end + + # 2. Match the email address in the message without matching the hash + @info_requests = InfoRequest.guess_by_incoming_email(@raw_email.incoming_message) + + # 3. Give a reason why it's in the holding pen + last_event = InfoRequestEvent.find_by_incoming_message_id(@raw_email.incoming_message.id) + @rejected_reason = last_event.params[:rejected_reason] || "unknown reason" + end + end + +end diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 6d6bf56e5..4869ea778 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -175,34 +175,6 @@ class AdminRequestController < AdminController redirect_to admin_request_url(info_request) end - def show_raw_email - @raw_email = RawEmail.find(params[:id]) - # For the holding pen, try to guess where it should be ... - @holding_pen = false - if (@raw_email.incoming_message.info_request == InfoRequest.holding_pen_request && !@raw_email.incoming_message.empty_from_field?) - @holding_pen = true - - # 1. Use domain of email to try and guess which public body it - # is associated with, so we can display that. - email = @raw_email.incoming_message.from_email - domain = PublicBody.extract_domain_from_email(email) - - if domain.nil? - @public_bodies = [] - else - @public_bodies = PublicBody.find(:all, :order => "name", - :conditions => [ "lower(request_email) like lower('%'||?||'%')", domain ]) - end - - # 2. Match the email address in the message without matching the hash - @info_requests = InfoRequest.guess_by_incoming_email(@raw_email.incoming_message) - - # 3. Give a reason why it's in the holding pen - last_event = InfoRequestEvent.find_by_incoming_message_id(@raw_email.incoming_message.id) - @rejected_reason = last_event.params[:rejected_reason] || "unknown reason" - end - end - def download_raw_email @raw_email = RawEmail.find(params[:id]) diff --git a/app/views/admin_general/index.html.erb b/app/views/admin_general/index.html.erb index ba9396ceb..0991ea2f5 100644 --- a/app/views/admin_general/index.html.erb +++ b/app/views/admin_general/index.html.erb @@ -37,9 +37,9 @@ <tr> <td> <% if message.get_body_for_quoting.strip.size == 0 %> - <%= link_to "(no body)", admin_request_show_raw_email_path(message.raw_email_id) %> + <%= link_to "(no body)", admin_raw_email_path(message.raw_email_id) %> <% else %> - <%= link_to excerpt(message.get_body_for_quoting, "", :radius => 60), admin_request_show_raw_email_path(message.raw_email_id) %> + <%= link_to excerpt(message.get_body_for_quoting, "", :radius => 60), admin_raw_email_path(message.raw_email_id) %> <% end %> </td> <td class="span2"> diff --git a/app/views/admin_request/_incoming_message_actions.html.erb b/app/views/admin_incoming_message/_actions.html.erb index 672ce3ae2..5541f2819 100644 --- a/app/views/admin_request/_incoming_message_actions.html.erb +++ b/app/views/admin_incoming_message/_actions.html.erb @@ -47,7 +47,7 @@ <div class="control-group"> <label class="control-label">Inspect email</label> <div class="controls"> - <%= link_to "View raw email", admin_request_show_raw_email_path(incoming_message.raw_email_id), :class => "btn" %> + <%= link_to "View raw email", admin_raw_email_path(incoming_message.raw_email_id), :class => "btn" %> </div> </div> <% end %> diff --git a/app/views/admin_incoming_message/edit.html.erb b/app/views/admin_incoming_message/edit.html.erb index 1088edcab..210d3bbd6 100644 --- a/app/views/admin_incoming_message/edit.html.erb +++ b/app/views/admin_incoming_message/edit.html.erb @@ -1,5 +1,5 @@ <%= render :partial => 'intro', :locals => {:incoming_message => @incoming_message } %> -<%= render :partial => 'admin_request/incoming_message_actions', :locals => { :incoming_message => @incoming_message } %> +<%= render :partial => 'actions', :locals => { :incoming_message => @incoming_message } %> <fieldset class="form-horizontal"> <legend>Prominence</legend> <%= form_tag admin_incoming_update_path(@incoming_message), :class => "form form-inline" do %> diff --git a/app/views/admin_request/show_raw_email.html.erb b/app/views/admin_raw_email/show.html.erb index da22b6069..83c81b8fb 100644 --- a/app/views/admin_request/show_raw_email.html.erb +++ b/app/views/admin_raw_email/show.html.erb @@ -52,7 +52,7 @@ </p> <div> - <%= render :partial => 'incoming_message_actions', :locals => { :incoming_message => @raw_email.incoming_message } %> + <%= render :partial => 'admin_incoming_message/actions', :locals => { :incoming_message => @raw_email.incoming_message } %> </div> <h2>Raw email</h2> diff --git a/app/views/admin_request/show.html.erb b/app/views/admin_request/show.html.erb index 2ca4f5733..b21dcc05e 100644 --- a/app/views/admin_request/show.html.erb +++ b/app/views/admin_request/show.html.erb @@ -297,7 +297,7 @@ <thead> <tr> <td colspan="2" class="well"> - <%= render :partial => 'incoming_message_actions', :locals => { :incoming_message => incoming_message } %> + <%= render :partial => 'admin_incoming_message/actions', :locals => { :incoming_message => incoming_message } %> </td> </tr> </thead> |