diff options
author | francis <francis> | 2008-08-29 21:40:55 +0000 |
---|---|---|
committer | francis <francis> | 2008-08-29 21:40:55 +0000 |
commit | c7f944a54134b4a05953b8dea0a43c6a70543512 (patch) | |
tree | d5bc3b4d160d520ebb2c55d582689ef83a1b938e | |
parent | cdc10e26133a5d55dec5458f364ebc117be8d316 (diff) |
Fiddle with display of attachments (so more like GMail, and gives room for view as HTML link later)
-rw-r--r-- | app/models/incoming_message.rb | 5 | ||||
-rw-r--r-- | app/views/request/_bubble.rhtml | 38 | ||||
-rw-r--r-- | public/images/icon_application_octet-stream_large.png | bin | 3604 -> 3184 bytes | |||
-rw-r--r-- | public/images/icon_message_delivery-status_large.png | bin | 0 -> 3184 bytes | |||
-rw-r--r-- | public/images/icon_unknown.png | bin | 0 -> 3604 bytes | |||
-rw-r--r-- | public/stylesheets/main.css | 24 |
6 files changed, 49 insertions, 18 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index a2a23b094..0d4a07d00 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -19,7 +19,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: incoming_message.rb,v 1.136 2008-08-29 19:59:13 francis Exp $ +# $Id: incoming_message.rb,v 1.137 2008-08-29 21:40:55 francis Exp $ # TODO # Move some of the (e.g. quoting) functions here into rblib, as they feel @@ -76,7 +76,8 @@ $file_extension_to_mime_type = { "bmp" => 'image/bmp', "html" => 'text/html', # XXX add htm "vcf" => 'text/x-vcard', - "zip" => 'application/zip' + "zip" => 'application/zip', + "delivery-status" => 'message/delivery-status' } # XXX doesn't have way of choosing default for inverse map - might want to add # one when you need it diff --git a/app/views/request/_bubble.rhtml b/app/views/request/_bubble.rhtml index f3f053522..b44ea692e 100644 --- a/app/views/request/_bubble.rhtml +++ b/app/views/request/_bubble.rhtml @@ -1,20 +1,28 @@ <div class="correspondence_text"> <% if not attachments.nil? and attachments.size > 0 %> - <p> <% attachments.each do |a| %> - <% attachment_url = get_attachment_url(:id => incoming_message.info_request_id, - :incoming_message_id => incoming_message.id, :part => a.url_part_number, :file_name => a.display_filename) %> - <% img_filename = "icon_" + a.content_type.sub('/', '_') + "_large.png" - full_filename = File.join(File.dirname(__FILE__), "../../../public/images", img_filename) - if File.exist?(full_filename) %> - <a href="<%=attachment_url%>"><img class="attachment_image" alt="Attachment" src="/images/<%=img_filename%>"></a> - <% else %> - Attachment: - <% end %> - <%= link_to a.display_filename, attachment_url %> - <!-- (<%= a.content_type %>) --> - <br> + <div class="attachments"> + <hr class="top"> + <% attachments.each do |a| %> + <p class="attachment"> + <% attachment_url = get_attachment_url(:id => incoming_message.info_request_id, + :incoming_message_id => incoming_message.id, :part => a.url_part_number, :file_name => a.display_filename) %> + <% img_filename = "icon_" + a.content_type.sub('/', '_') + "_large.png" + full_filename = File.join(File.dirname(__FILE__), "../../../public/images", img_filename) + if File.exist?(full_filename) %> + <a href="<%=attachment_url%>"><img class="attachment_image" alt="Attachment" src="/images/<%=img_filename%>"></a> + <% else %> + <a href="<%=attachment_url%>"><img class="attachment_image" alt="Attachment" src="/images/icon_unknown.png"></a> + <% end %> + <strong><%= h a.display_filename %></strong> + <!-- <%= link_to h(a.display_filename), attachment_url %> --> + <br> + <%= a.body.size / 1024 %>K + <%= link_to "Download", attachment_url %> + <!-- (<%= a.content_type %>) --> + </p> <% end %> - </p> + <hr class="bottom"> + </div> <% end %> <p><%= body %></p> - </div>
\ No newline at end of file + </div> diff --git a/public/images/icon_application_octet-stream_large.png b/public/images/icon_application_octet-stream_large.png Binary files differindex 992c646c0..a239862e1 100644 --- a/public/images/icon_application_octet-stream_large.png +++ b/public/images/icon_application_octet-stream_large.png diff --git a/public/images/icon_message_delivery-status_large.png b/public/images/icon_message_delivery-status_large.png Binary files differnew file mode 100644 index 000000000..a239862e1 --- /dev/null +++ b/public/images/icon_message_delivery-status_large.png diff --git a/public/images/icon_unknown.png b/public/images/icon_unknown.png Binary files differnew file mode 100644 index 000000000..992c646c0 --- /dev/null +++ b/public/images/icon_unknown.png diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index e20cdaf35..0bed7084b 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -675,7 +675,29 @@ div[id|="comment"] { } /*.event_bubble { margin: 3em 0 0 0; font-size: 0.9em;}*/ -a img.attachment_image {border: 0px;} +.attachments { + border-color: #010101; + border-width: 1px; + margin: 0 0 1em 0; +} +.attachment { + clear: both; +} +a img.attachment_image { + float: left; + border: 0px; + vertical-align: middle; + margin: 0 0.2em 0.2em 0; +} +.attachments hr.top { + margin: 0 0 1em 0; + clear: both; +} +.attachments hr.bottom { + margin: 1em 0 0 0; + clear: both; +} + .describe_state_form, #followup |