aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/admin_public_body/show.rhtml
blob: cee306988bb634d2a7eaed3ce2893ee051ed8782 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<% @title = "Public authority - " + h(@public_body.name) %>

<h1><%=@title%></h1>

<p>
<% 
   columns = PublicBody.content_columns + [] # force dup
   columns.delete_if {|c| ['last_edit_comment'].include?(c.name)}

   for column in columns %>
  <b><%= column.human_name %>:</b> 
  <% if ['home_page', 'publication_scheme', 'disclosure_log'].include? column.name %>
    <%= link_to(h(@public_body.send(column.name)), @public_body.send(column.name))  %>
  <% elsif column.name == 'request_email' %>
    <%= link_to(h(@public_body.send(column.name)), "mailto:#{@public_body.send(column.name)}")  %>
      <% if !@public_body.is_requestable? %>
          (not requestable due to: <%=h @public_body.not_requestable_reason %><% if @public_body.is_followupable? %>; but followupable<% end %>)
      <% end %>
  <% else %>
      <%=h @public_body.send(column.name) %>
  <% end %>
  <br/>
<% end %>
<b>Calculated home page:</b> 
<% if !@public_body.calculated_home_page.nil? %>
    <%= link_to(h(@public_body.calculated_home_page), @public_body.calculated_home_page) %>
<% else %>
    *unknown*
<% end %>
<br/><b>Tags:</b> <%= render :partial => 'tags', :locals => { :body => @public_body} %>
<br/>
</p>

<p>
    <%=
        # url_name can be missing if the name hasn't been set for this locale
        if !@public_body.url_name.nil?
            link_to 'Public page', main_url(public_body_url(@public_body))
        else
            'Public page not available'
        end
    %>
    | <%= link_to 'Edit', '../edit/' + @public_body.id.to_s %>
</p>

<h2>History</h2>
<table border="1">
<tr>
<th>Updated at</th>
<% 
    history_columns = PublicBody.content_columns + [] # force dup
    history_columns.delete_if {|c| ['created_at', 'updated_at', 'first_letter', 'api_key'].include?(c.name)}
    for column in history_columns %>
  <th><%= column.human_name %></th>
<% end %>
</tr>
<%# There may be an option to versions() to specify order, but I can't find it. TB 2009-03-09 %>
<% for historic_public_body in @public_body.reverse_sorted_versions %>
      <tr class="<%= cycle('odd', 'even') %>">
      <td><%=h historic_public_body.updated_at %></td>
    <% for column in history_columns %>
      <% 
        value = h(historic_public_body.send(column.name))
        if column.name == 'last_edit_comment'
            value = historic_public_body.last_edit_comment_for_html_display
        end
        # Highlight entries which have changed since previous version
        changed = (!['version', 'last_edit_editor', 'last_edit_comment'].include?(column.name)) && ((historic_public_body.send(column.name) != @public_body.sorted_versions[historic_public_body.version - 2].send(column.name)) || (historic_public_body.version == 1)) %>
      <td <%= changed ? ' class="entry_changed" '.html_safe: '' %> >
      <%=value%>
      </td>
    <% end %>
    </tr>
<% end %>
</table>

<h2>Requests</h2>
<%= render :partial => 'admin_request/some_requests', :locals => { :info_requests => @public_body.info_requests } %>

<h2>Track things</h2>
<%= render :partial => 'admin_track/some_tracks', :locals => { :track_things => @public_body.track_things } %>