Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to the latest Alaveteli #114

Merged
merged 1 commit into from
Jul 2, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 83 additions & 62 deletions lib/views/public_body/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ simple_data = [
[_("Unresolved"), unresolved]
]
%>
<div id="main_content">

<% if flash[:search_params] %>
<div class="back-to-results">
<div class="message">
<%= link_to select_authority_path(flash[:search_params]) do %>
<%= _('« Back to search results') %>
<% end %>
</div>
</div>
<% end %>

<div class="authority__header">
<div id="header_right">
<h2 class="stats-chart__header"><%= _("Request outcomes") %></h2>
<div id="stats_chart" data-stats="<%= simple_data.to_json %>">
Expand All @@ -35,50 +46,59 @@ simple_data = [
</div>

<div id="header_left">
<p class="public-body-name-prefix"><%= _("Freedom of information requests to") %></p>
<h1><%=h(@public_body.name)%></h1>

<p class="subtitle">
<%=@public_body.type_of_authority(true)%><% if not @public_body.short_name.empty? %>,
<%= _('also called {{public_body_short_name}}', :public_body_short_name => h(@public_body.short_name))%><% end %>
<% if [email protected]? && @user.admin_page_links? %>
(<%= link_to _("admin"), admin_body_show_path(@public_body) %>)
<% end %>
</p>
<h1><%= h(@public_body.name) %></h1>
<p class="authority__header__subtitle">
<%= type_of_authority(@public_body) %><% unless @public_body.short_name.empty? %>,
<%= _('also called {{public_body_short_name}}', :public_body_short_name => h(@public_body.short_name)) %>
<% end %>

<% if @public_body.is_requestable? || @public_body.not_requestable_reason == 'bad_contact' %>
<% if @public_body.has_notes? %>
<p><%= @public_body.notes_as_html.html_safe %></p>
<% end %>
<% if @public_body.eir_only? %>
<p><%= _('You can only request information about the environment from this authority.')%></p>
<% end %>
<% else %>
<% if @public_body.not_requestable_reason == 'not_apply' %>
<p><%= _('Freedom of Information law does not apply to this authority, so you cannot make
a request to it.')%></p>
<% elsif @public_body.not_requestable_reason == 'defunct' %>
<p><%= _('This authority no longer exists, so you cannot make a request to it.')%></p>
<% else %>
<p><%= _('For an unknown reason, it is not possible to make a request to this authority.')%></p>
<% end %>
<% end %>
<% if @user && @user.admin_page_links? %>
(<%= link_to _("admin"), admin_body_path(@public_body) %>)
<% end %>
</p>

<% if @public_body.has_notes? || @public_body.eir_only? || @public_body.special_not_requestable_reason? %>
<div id="stepwise_make_request">
<% if @public_body.is_requestable? || @public_body.not_requestable_reason == 'bad_contact' %>
<%= link_to _("Make a request to this authority"), new_request_to_body_path(:url_name => @public_body.url_name), :class => "link_button_green" %>
<% elsif @public_body.has_notes? %>
<%= @public_body.notes_as_html.html_safe %>
<% end %>
<% if @public_body.has_notes? %>
<p class="authority__header__notes">
<%= @public_body.notes_as_html.html_safe %>
</p>
<% end %>

<% if @public_body.override_request_email %>
<p>
<%= _("<strong>Note:</strong> Because we're testing, requests are being sent to {{email}} rather than to the actual authority.", :email => @public_body.override_request_email) %>
</p>
<% if @public_body.is_requestable? %>
<% if @public_body.eir_only? %>
<p class="authority__header__notes">
<%= _('You can only request information about the environment from this authority.')%>
</p>
<% end %>
<% elsif @public_body.special_not_requestable_reason? %>
<p class="authority__header__notes">
<%= public_body_not_requestable_reasons(@public_body).first %>
</p>
<% end %>
</div>
<% end %>

<% if @number_of_visible_requests > 0 %>
<div class="authority__header__stats">
<%= n_('{{count}} request',
'{{count}} requests',
@number_of_visible_requests,
:count => @number_of_visible_requests) %>
</div>
<% end %>

<div id="stepwise_make_request">
<% if @public_body.is_requestable? || @public_body.not_requestable_reason == 'bad_contact' %>
<%= link_to _("Make a request to this authority"), new_request_to_body_path(:url_name => @public_body.url_name), :class => "link_button_green" %>
<% elsif @public_body.has_notes? %>
<%= @public_body.notes_as_html.html_safe %>
<% end %>
</div>
</div>
</div>

<div class="authority__header">
<div class="public-body__details">

<div>
Expand Down Expand Up @@ -158,9 +178,11 @@ simple_data = [
<li><%= link_to _("Ask us to update FOI email"), new_change_request_path(:body => @public_body.url_name) %></li>
</div>
</div>
</div>

<div id="foi_results_section">
<% if @public_body.info_requests.size == 0 %>
<div class="authority__body">
<div class="authority__body__foi-results">
<% if @number_of_visible_requests.zero? %>
<% if @public_body.is_requestable? or @public_body.not_requestable_reason != 'defunct' %>
<% if @public_body.eir_only? %>
<h2><%= _('Environmental Information Regulations requests made using this site') %></h2>
Expand All @@ -171,33 +193,20 @@ simple_data = [
<% end %>
<% end %>
<% else %>
<h2 class="foi_results">
<% if @public_body.eir_only? %>
<%= pluralize(@public_body.info_requests.size, "Environmental Information Regulations request made using this site") %>
<% else %>
<% if @public_body.info_requests.size > 4 %>
<%= n_('Search within the {{count}} Freedom of Information requests to {{public_body_name}}', 'Search within the {{count}} Freedom of Information requests made to {{public_body_name}}', @public_body.info_requests.size, :count => @public_body.info_requests.size, :public_body_name => @public_body.name) %>
<% else %>
<%= n_('{{count}} Freedom of Information request to {{public_body_name}}',
'{{count}} Freedom of Information requests to {{public_body_name}}',
@public_body.info_requests.size,
:count => @public_body.info_requests.size,
:public_body_name => @public_body.name) %>
<% end %>
<% end %>
<% unless @page_desc.blank? %>
<h2 class="foi_results">
<%= @page_desc %>
</h2>
</h2>
<% end %>
<a name="results"></a>

<% if @public_body.info_requests.size > 4 %>
<% if @number_of_visible_requests > 4 %>
<%= render :partial => 'request/request_filter_form' %>
<% end %>
<% end %>

<div style="clear:both">&nbsp;</div>
<% if !@xapian_requests.nil? %>

<% for result in @xapian_requests.results %>
<% if @xapian_requests %>
<% @xapian_requests.results.each do |result| %>
<%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model] } %>
<% end %>

Expand All @@ -221,7 +230,19 @@ simple_data = [
<p> <%= _('The search index is currently offline, so we can\'t show the Freedom of Information requests that have been made to this authority.')%></p>
<% end %>
</div>
</div>

<!--[if lte IE 8]><%= javascript_include_tag "excanvas.min.js" %><![endif]-->
<%= javascript_include_tag "stats-authority" %>
<div class="authority__body__sidebar">
<% if @number_of_visible_requests > 4 %>
<%= render :partial => 'request/request_search_form' %>
<% end %>

<%= render :partial => 'more_info', :locals => { :public_body => @public_body } %>

<%= render :partial => 'track/tracking_links',
:locals => { :track_thing => @track_thing,
:existing_track => @existing_track,
:own_request => false,
:location => 'sidebar' } %>
</div>

</div>