aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/assets/stylesheets/responsive/_public_body_layout.scss49
-rw-r--r--app/assets/stylesheets/responsive/_public_body_style.scss35
-rw-r--r--app/controllers/public_body_controller.rb3
-rw-r--r--app/models/track_thing.rb3
-rw-r--r--app/views/public_body/show.html.erb148
5 files changed, 160 insertions, 78 deletions
diff --git a/app/assets/stylesheets/responsive/_public_body_layout.scss b/app/assets/stylesheets/responsive/_public_body_layout.scss
index 39d42e213..bed6b56c7 100644
--- a/app/assets/stylesheets/responsive/_public_body_layout.scss
+++ b/app/assets/stylesheets/responsive/_public_body_layout.scss
@@ -8,3 +8,52 @@
@include grid-column(12);
margin-top: 0.5em;
}
+
+.authority__header {
+ margin-bottom: 1em;
+ padding-bottom: 1em;
+ @include grid-column(12);
+}
+
+.authority__body {
+ .request_left,
+ .request_right {
+ float: none;
+ width: auto;
+ }
+ .desc {
+ padding-left: 0;
+ }
+ .request_listing .bottomline {
+ padding-bottom: 0.5em;
+ }
+}
+
+.authority__body__foi-results {
+ @include grid-column(12);
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ @include grid-column(8);
+ }
+}
+
+.authority__body__sidebar {
+ @include grid-column(12);
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ @include grid-column(4);
+ }
+}
+
+.authority__header__action-bar {
+ font-size: 0;
+ padding: 8px 0;
+}
+
+.action-bar__make-request,
+.action-bar__follow,
+.action-bar__follow-button,
+.action-bar__follower-count {
+ display: inline-block;
+ vertical-align: top;
+ font-size: 16px;
+ margin-right: 1em;
+}
diff --git a/app/assets/stylesheets/responsive/_public_body_style.scss b/app/assets/stylesheets/responsive/_public_body_style.scss
index 4040198b3..3876ef40a 100644
--- a/app/assets/stylesheets/responsive/_public_body_style.scss
+++ b/app/assets/stylesheets/responsive/_public_body_style.scss
@@ -1,24 +1,27 @@
/* Style for public body pages */
.back-to-results {
- .message {
- margin-top: 0.5em;
- padding: 0.5em 0.8em;
- background-color: #fff;
- background-color: rgba(0,0,0,0.1);
- }
+ .message {
+ margin-top: 0.5em;
+ padding: 0.5em 0.8em;
+ background-color: #fff;
+ background-color: rgba(0,0,0,0.1);
+ }
}
-.public-body-name-prefix {
- color:#888;
- font-size: 1.3em;
- position: relative;
- top: 1em;
+.authority__header {
+ border-bottom: 1px solid #e9e9e9;
}
-#follow_count {
- font-weight: bold;
- font-size: 3em;
- position: relative;
- top: 0.25em;
+.authority__header__action-bar {
+ border-top: 1px solid #e9e9e9;
+}
+
+.authority__body__sidebar {
+ h2 {
+ font-size: 1.2em;
+ }
+ h3 {
+ font-size: 1em;
+ }
}
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index 2e540d198..cc3d0b64a 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -58,6 +58,9 @@ class PublicBodyController < ApplicationController
flash.keep(:search_params)
@track_thing = TrackThing.create_track_for_public_body(@public_body)
+ if @user
+ @existing_track = TrackThing.find_existing(@user, @track_thing)
+ end
@feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
respond_to do |format|
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index 5819876ff..cd90c4a9e 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -231,8 +231,7 @@ class TrackThing < ActiveRecord::Base
{ # Website
:verb_on_page => _("Follow requests to {{public_body_name}}",
:public_body_name => public_body.name),
- :verb_on_page_already => _("You are already following requests to {{public_body_name}}",
- :public_body_name => public_body.name),
+ :verb_on_page_already => _("Following"),
# Email
:title_in_email => _("{{foi_law}} requests to '{{public_body_name}}'",
:foi_law => public_body.law_only_short,
diff --git a/app/views/public_body/show.html.erb b/app/views/public_body/show.html.erb
index e7c5fa2b6..d9b89ea1d 100644
--- a/app/views/public_body/show.html.erb
+++ b/app/views/public_body/show.html.erb
@@ -1,65 +1,96 @@
<% @title = h(@public_body.name) + _(" - view and make Freedom of Information requests") %>
-<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 id="header_right">
- <h2><%= _('Follow this authority')%></h2>
-
- <% follower_count = TrackThing.count(:all, :conditions => ["public_body_id = ?", @public_body.id]) %>
- <p>
- <%= n_("{{count}} person is following this authority",
- "{{count}} people are following this authority",
- follower_count,
- :count => content_tag(:span, follower_count, :id => "follow_count")) %>
- </p>
- <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'sidebar' } %>
- <%= render :partial => 'track/rss_feed', :locals => { :track_thing => @track_thing, :location => 'sidebar' } %>
- <%= render :partial => 'more_info', :locals => { :public_body => @public_body } %>
+<% 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 id="header_left">
- <p class="public-body-name-prefix"><%= _("Freedom of information requests to") %></p>
- <h1><%=h(@public_body.name)%></h1>
-
- <p class="subtitle">
+<div class="authority__header">
+ <h1><%=h(@public_body.name)%></h1>
+ <p class="authority__header__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 !@user.nil? && @user.admin_page_links? %>
(<%= link_to _("admin"), admin_body_path(@public_body) %>)
<% end %>
+ </p>
+
+ <div id="stepwise_make_request">
+ <% if @public_body.has_notes? %>
+ <p class="authority__header__notes">
+ <%= @public_body.notes_as_html.html_safe %>
</p>
+ <% end %>
- <div id="stepwise_make_request">
- <% if @public_body.has_notes? %>
- <%= @public_body.notes_as_html.html_safe %>
- <% end %>
+ <% 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 %>
- <% if @public_body.is_requestable? %>
- <% if @public_body.eir_only? %>
- <p><%= _('You can only request information about the environment from this authority.')%></p>
+ <%= link_to _("Make a request to this authority"),
+ new_request_to_body_path(:url_name => @public_body.url_name),
+ :class => "link_button_green" %>
+ <% else %>
+ <p class="authority__header__notes">
+ <%= public_body_not_requestable_reasons(@public_body).first %>
+ </p>
+ <% end %>
+ </div>
+
+ <% if @public_body.info_requests.size > 0 %>
+ <div class="authority__header__stats">
+ <%= n_('{{count}} request',
+ '{{count}} requests',
+ @public_body.info_requests.size,
+ :count => @public_body.info_requests.size) %>
+ </div>
+ <% end %>
+ <div class="authority__header__action-bar">
+ <div class="action-bar__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 %>
- <%= link_to _("Make a request to this authority"),
- new_request_to_body_path(:url_name => @public_body.url_name),
- :class => "link_button_green" %>
- <% else %>
- <p><%= public_body_not_requestable_reasons(@public_body).first %></p>
- <% end %>
+ <div class="action-bar__follow">
+ <% follower_count = TrackThing.count(:all, :conditions => ["public_body_id = ?", @public_body.id]) %>
+ <div class="action-bar__follow-button">
+ <% if @existing_track %>
+ <%= @track_thing.params[:verb_on_page_already] %>
+ <%= (link_to _("(unsubscribe)"), {:controller => 'track', :action => 'update', :track_id => @existing_track.id, :track_medium => "delete", :r => request.fullpath}) %>
+ <% else %>
+ <div class="feed_link">
+ <%= link_to _("Follow"), do_track_path(@track_thing), :class => "link_button_green" %>
+ </div>
+ <% end %>
+
+ </div>
+ <div class="action-bar__follower-count">
+ <%= n_("{{count}} follower",
+ "{{count}} followers",
+ follower_count,
+ :count => content_tag(:span, follower_count, :id => "follow_count")) %>
+ </div>
</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 @public_body.info_requests.size == 0 %>
<% 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>
@@ -71,20 +102,10 @@
<% 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 %>
- <%= @page_desc %>
+ <% if @public_body.eir_only? %>
+ <%= pluralize(@public_body.info_requests.size, "Environmental Information Regulations request made using this site") %>
+ <% end %>
+ <%= @page_desc %>
</h2>
<a name="results"></a>
@@ -94,7 +115,6 @@
<% end %>
<% end %>
- <div style="clear:both">&nbsp;</div>
<% if !@xapian_requests.nil? %>
<% for result in @xapian_requests.results %>
@@ -121,4 +141,12 @@
<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 class="authority__body__sidebar">
+ <% if @public_body.info_requests.size > 4 %>
+ <%= render :partial => 'request/request_filter_form' %>
+ <% end %>
+ <%= render :partial => 'more_info', :locals => { :public_body => @public_body } %>
+ </div>
+
</div>