aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/admin_public_body/show.html.erb
blob: 8262287d50c85fd502a84e5b1c68ab278eab1653 (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
84
85
86
87
88
89
90
<% @title = _("Public authority – {{name}}", :name => h(@public_body.name)) %>

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

<table class="table table-striped table-condensed">
  <tbody>
    <% @public_body.for_admin_column do |name, value, type, column_name| %>
      <tr>
        <td>
          <b><%=name%></b>
        </td>
        <td>
          <% if ['home_page', 'publication_scheme', 'disclosure_log'].include? column_name %>
            <%= link_to(h(value), value)  %>
          <% elsif column_name == 'request_email' %>
            <%= link_to(h(value), "mailto:#{value}")  %>
              <% unless @public_body.is_requestable? %>
                <%=_("not requestable due to: {{reason}}", :reason => h(@public_body.not_requestable_reason))%><% if @public_body.is_followupable? %>; <%=_("but followupable")%><% end %>
              <% end %>
          <% else %>
              <%=h value %>
          <% end %>
        </td>
      </tr>
    <% end %>
    <tr>
      <td>
        <b><%=_("Calculated home page")%></b>
      </td>
      <td>
        <% unless @public_body.calculated_home_page.nil? %>
          <%= link_to(h(@public_body.calculated_home_page), @public_body.calculated_home_page) %>
        <% else %>
          <%=_("*unknown*")%>
        <% end %>
      </td>
    </tr>
    <tr>
      <td>
        <b><%=_("Tags")%></b>
      </td>
      <td>
        <%= render :partial => 'tags', :locals => { :body => @public_body} %>
      </td>
    </tr>
  </tbody>
</table>
<%= link_to _("Edit"), admin_body_edit_path(@public_body), :class => "btn btn-primary" %>
<% unless @public_body.url_name.nil? %>
  <%=link_to _("Public page"), public_body_path(@public_body), :class => "btn" %>
<% else %>
  <%=_("Public page not available")%>
<% end %>
<hr>
<h2>History</h2>
<%# There may be an option to versions() to specify order, but I can't find it. TB 2009-03-09 %>
<% versions = @public_body.reverse_sorted_versions; versions.each_with_index do |historic_public_body, i| %>
  <div class="row">
    <div class="span2">
      <b>
        <%= _("Version {{version}}", :version => historic_public_body.version)%>
      </b>
    </div>
    <div class="span4">
      <%= I18n.l(historic_public_body.updated_at, :format => "%e %B %Y %H:%M:%S") %>
      (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(historic_public_body.updated_at)) %>)
    </div>
    <% if i == versions.length - 1 %>
      <div class="span6">
        <%=_("This is the first version.")%>
      </div>
    <% else %>
      <div class="span6">
        <p>“<%= h(historic_public_body.last_edit_comment) %>”</p>
        <ul>
          <% historic_public_body.compare(versions[i+1]) do |change| %>
            <li><%= _("{{thing_changed}} was changed from <code>{{from_value}}</code> to <code>{{to_value}}</code>", :thing_changed => change[:name], :from_value => (change[:from] or "-"), :to_value => (change[:to] or "-")) %></li>
          <% end %>
        </ul>
      </div>
    <% end %>
  </div>
<% end %>
<hr>
<h2>Requests</h2>
<%= render :partial => 'admin_request/some_requests', :locals => { :info_requests => @info_requests } %>
<%= will_paginate(@info_requests, :class => "paginator") %>
<hr>
<h2>Track things</h2>
<%= render :partial => 'admin_track/some_tracks', :locals => { :track_things => @public_body.track_things, :include_destroy => true } %>