diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/info_request.rb | 9 | ||||
-rw-r--r-- | app/views/body/show.rhtml | 9 | ||||
-rw-r--r-- | app/views/request/_request_listing.rhtml | 16 | ||||
-rw-r--r-- | app/views/request/list.rhtml | 25 | ||||
-rw-r--r-- | app/views/user/show.rhtml | 13 |
5 files changed, 32 insertions, 40 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 31086c0f8..8eab0cb23 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -17,7 +17,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.19 2008-01-02 16:04:53 francis Exp $ +# $Id: info_request.rb,v 1.20 2008-01-02 18:14:40 francis Exp $ require 'digest/sha1' @@ -141,6 +141,13 @@ class InfoRequest < ActiveRecord::Base info_request_event.info_request = self info_request_event.save! end + + # Text from the the initial request, for use in summary display + def initial_request_text + excerpt = outgoing_messages[0].body + excerpt.sub!(/Dear .+,/, "") + return excerpt + end end diff --git a/app/views/body/show.rhtml b/app/views/body/show.rhtml index e8332949b..25692bcd3 100644 --- a/app/views/body/show.rhtml +++ b/app/views/body/show.rhtml @@ -2,10 +2,7 @@ <h1><%=@title%></h1> -<p>Freedom of Information requests made to this body:</p> -<ul> -<% for info_request in @public_body.info_requests %> -<li><%= info_request_link(info_request) %></li> -<% end %> -</ul> +<p class="subtitle">Recent Freedom of Information requests to this public body</p> + +<%= render :partial => 'request/request_listing', :locals => { :info_requests => @public_body.info_requests.sort { |a,b| b.created_at <=> a.created_at } } %> diff --git a/app/views/request/_request_listing.rhtml b/app/views/request/_request_listing.rhtml new file mode 100644 index 000000000..76dd6cb3b --- /dev/null +++ b/app/views/request/_request_listing.rhtml @@ -0,0 +1,16 @@ + +<% for info_request in info_requests %> + <p class="request_listing"> + <%= request_link(info_request) %> + <br> + <%=h excerpt(info_request.initial_request_text, "", 300) %> + <br> + + <span class="request_listing_bottomline"> + Requested from <%= public_body_link(info_request.public_body) %> + by <%= user_link(info_request.user) %> + on <%= simple_date(info_request.created_at) %> + </span> + </p> +<% end %> + diff --git a/app/views/request/list.rhtml b/app/views/request/list.rhtml index b898e83f5..d5d9f248d 100644 --- a/app/views/request/list.rhtml +++ b/app/views/request/list.rhtml @@ -2,28 +2,5 @@ <h1><%=@title%></h1> -<table id="list_requests"> - <tr> - <th>Public body</th> - <th>Title</th> - <th>Requester</th> - <th>Created</th> - - </tr> - -<% for info_request in @info_requests %> - <tr class="<%= cycle('odd', 'even') %>"> - <td><%= public_body_link_short(info_request.public_body) %></td> - <td><%= request_link(info_request) %></td> - <td><%= user_link(info_request.user) %></td> - <td><%= simple_date(info_request.created_at) %></td> - </tr> -<% end %> - -</table> - -<p> -<%= will_paginate(@info_requests) %> -</p> - +<%= render :partial => 'request_listing', :locals => { :info_requests => @info_requests } %> diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index 66ecc0da8..e8df205b6 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -12,15 +12,10 @@ <p>This person has made no Freedom of Information requests using this site.</p> <% else %> - <p>Freedom of Information requests made by this person:</p> - <ul> - <% for info_request in display_user.info_requests.sort { |a,b| b.created_at <=> a.created_at } %> - <li> - <%= info_request_link(info_request) %> - on <%= simple_date(info_request.created_at) %> - </li> - <% end %> - </ul> + <p>This person has made <%=pluralize(display_user.info_requests.size, "Freedom of Information request") %> + using this site.</p> + + <%= render :partial => 'request/request_listing', :locals => { :info_requests => display_user.info_requests.sort { |a,b| b.created_at <=> a.created_at } } %> <% end %> <% end %> |