aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2008-04-03 16:09:37 +0000
committerfrancis <francis>2008-04-03 16:09:37 +0000
commit8adf1deda3ff762bc92f668d3ace9bd04a833496 (patch)
tree4a2a36da886c1a975facd05177a5f03b943b32a7
parentbfe37487389fce1b334db5506040453956137981 (diff)
Forgot to add timeline template.
-rw-r--r--app/views/admin/timeline.rhtml67
1 files changed, 67 insertions, 0 deletions
diff --git a/app/views/admin/timeline.rhtml b/app/views/admin/timeline.rhtml
new file mode 100644
index 000000000..444f321cf
--- /dev/null
+++ b/app/views/admin/timeline.rhtml
@@ -0,0 +1,67 @@
+<% @title = "Timeline" %>
+
+<h1><%=h @events_title%></h1>
+
+<p><a href="?">Week</a>
+| <a href="?month=1">Month</a>
+| <a href="?all=1">All time</a></p>
+
+<% last_date = nil %>
+<% for event in @events %>
+ <% if last_date != event.created_at.to_date %>
+ <% if last_date.nil? %>
+ <p>
+ <% end %>
+ <h3><%= simple_date(event.created_at) %></h3>
+ <p>
+ <% else %>
+ <br>
+ <% end %>
+ <% last_date = event.created_at.to_date %>
+
+
+ '<%= link_to h(event.info_request.title), main_url(request_url(event.info_request)) %>'
+ <% if event.event_type == 'edit' %>
+ was edited by administrator <%=h event.params[:editor] %>.
+ <% for p in ['title', 'prominence', 'described_state', 'awaiting_description']
+ if event.params[p.to_sym] != event.params[('old_'+p).to_sym]
+ %> Changed <%=p%> from '<%=h event.params[('old_'+p).to_sym]%>' to '<%=h event.params[p.to_sym] %>'. <%
+ end
+ end
+ %>
+ <% elsif event.event_type == 'edit_outgoing' %>
+ <% outgoing_messages = OutgoingMessage.find(:all, event.params[:outgoing_message_id].to_i) %>
+ had outgoing message edited by administrator <%=h event.params[:editor] %>.
+ <% if outgoing_messages.size > 0 %>
+ <% outgoing_message = outgoing_messages[0] %>
+ <% for p in ['body']
+ if event.params[p.to_sym] != event.params[('old_'+p).to_sym]
+ %> Changed <%=p%> from '<%=h event.params[('old_'+p).to_sym]%>' to '<%=h event.params[p.to_sym] %>'. <%
+ end
+ end
+ %>
+ <% else %>
+ Missing outgoing message, internal error.
+ <% end %>
+ <% elsif event.event_type == 'response' %>
+ <% incoming_message = event.incoming_message %>
+ received
+ <%= link_to 'a response',
+ main_url(show_response_url(:id => incoming_message.info_request.id, :incoming_message_id => incoming_message.id, :only_path => true)) %>
+
+ from <%=h event.info_request.public_body.name %>.
+ <% elsif event.event_type == 'sent' %>
+ was initially sent to <%=h event.params[:email]%> at <%=h event.info_request.public_body.name %>.
+ <% elsif event.event_type == 'resent' %>
+ had the request resent to <%=h event.params[:email]%> at <%=h event.info_request.public_body.name %>.
+ <% elsif event.event_type == 'followup_sent' %>
+ had a follow up message sent to <%=h event.info_request.public_body.name %>.
+ <% else %>
+ had '<%=event.event_type%>' done to it, parameters <%=h event.params_yaml%>.
+ <% end %>
+<% end %>
+<% if not @events.empty? %>
+</p>
+<% end %>
+
+