diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/application_helper.rb | 42 | ||||
-rw-r--r-- | app/views/request/_request_listing_via_event.html.erb | 17 |
2 files changed, 43 insertions, 16 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 154697377..33525cb3d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -136,5 +136,47 @@ module ApplicationHelper nil end end + + def event_description(event) + body_link = public_body_link_absolute(event.info_request.public_body) + user_link = request_user_link_absolute(event.info_request) + date = simple_date(event.created_at) + case event.event_type + when 'sent' + _('Request sent to {{public_body_name}} by {{info_request_user}} on {{date}}.', + :public_body_name => body_link, + :info_request_user => user_link, + :date => date) + when 'followup_sent' + case event.calculated_state + when 'internal_review' + _('Internal review request sent to {{public_body_name}} by {{info_request_user}} on {{date}}.', + :public_body_name => body_link, + :info_request_user => user_link, + :date => date) + when 'waiting_response' + _('Clarification sent to {{public_body_name}} by {{info_request_user}} on {{date}}.', + :public_body_name => body_link, + :info_request_user => user_link, + :date => date) + else + _('Follow up sent to {{public_body_name}} by {{info_request_user}} on {{date}}.', + :public_body_name => body_link, + :info_request_user => user_link, + :date => date) + end + when 'response' + _('Response by {{public_body_name}} to {{info_request_user}} on {{date}}.', + :public_body_name => body_link, + :info_request_user => user_link, + :date => date) + when 'comment' + _('Request to {{public_body_name}} by {{info_request_user}}. Annotated by {{event_comment_user}} on {{date}}.', + :public_body_name => body_link, + :info_request_user => user_link, + :event_comment_user => user_link_absolute(event.comment.user), + :date => date) + end + end end diff --git a/app/views/request/_request_listing_via_event.html.erb b/app/views/request/_request_listing_via_event.html.erb index 3b0d6795a..20bc5b2c8 100644 --- a/app/views/request/_request_listing_via_event.html.erb +++ b/app/views/request/_request_listing_via_event.html.erb @@ -16,22 +16,7 @@ end %> <% end %> </span> <div class="requester"> - <% if event.event_type == 'sent' %> - <%= _('Request sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(event.info_request.public_body),:info_request_user=>request_user_link_absolute(event.info_request),:date=>simple_date(event.created_at )) %> - <% elsif event.event_type == 'followup_sent' %> - <%=event.display_status %> - <%= _('sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(event.info_request.public_body),:info_request_user=>request_user_link_absolute(event.info_request),:date=>simple_date(event.created_at )) %> - <% elsif event.event_type == 'response' %> - <%=event.display_status %> - <%= _('by {{public_body_name}} to {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(event.info_request.public_body),:info_request_user=>request_user_link_absolute(event.info_request),:date=>simple_date(event.created_at )) %> - <% elsif event.event_type == 'comment' %> - <%= _('Request to {{public_body_name}} by {{info_request_user}}. Annotated by {{event_comment_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(event.info_request.public_body),:info_request_user=>request_user_link_absolute(event.info_request),:event_comment_user=>user_link_absolute(event.comment.user),:date=>simple_date(event.created_at)) %> - <% else %> - <%# Events of other types will not be indexed: see InfoRequestEvent#indexed_by_search? - However, it can happen that we see other types of event transiently here in the period - between a change being made and the update-xapian-index job being run. %> - <!-- Event of type '<%= event.event_type %>', id=<%= event.id %> --> - <% end %> + <%= event_description(event) %> </div> <span class="bottomline icon_<%= event.info_request.calculate_status %>"> <strong> |