diff options
29 files changed, 907 insertions, 626 deletions
diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss index b063b0d77..91e509083 100644 --- a/app/assets/stylesheets/main.scss +++ b/app/assets/stylesheets/main.scss @@ -185,11 +185,9 @@ margin:18px 0 36px; } #stepwise_make_request { -color:#222; font-size:1.1em; text-align:left; -width:412px; -margin:0 14em 40px 0; +margin-bottom: 1em; } #stepwise_make_request_view_email { @@ -586,12 +584,25 @@ width:40%; width:26em; } +#request_form { +width: 63.6666%; +margin-right: 3%; +float: left; +} + #request_advice { float:right; -width:250px; +width:30.3333%; margin-top:1em; } +.advice-panel { + ul { + list-style: none outside none; + padding-left: 0 !important; + } +} + #select_authority_help { background-color: #FEF1F6; float: right; @@ -616,20 +627,18 @@ padding-top:0.5em; padding-bottom:1em; } +#request_header_subject { + .form_item_note { + margin-top: 0.5em; + } +} + #request_form label,label.form_label { -display:block; -float:left; -clear:none; -width:100px; -text-align:left; -margin:2px 0 0; -padding:0 10px 0 0; + display: block; } .form_item_note,.form_note { -width:34em; -margin-left:110px; -font-size:1em; + } .form_item_note { @@ -637,7 +646,7 @@ margin-top:-1em; } .form_button { -margin:0 0 0 9em; +margin:0; } p#sign_in_reason, p#superuser_message { @@ -653,7 +662,6 @@ p#superuser_message { clear:none; margin-bottom:1em; float:none; -margin-top:20px; width:auto; } @@ -675,8 +683,16 @@ margin-left:25%; #signup .form_item_note,#signin .form_note { font-size:0.9em; -margin-left:11.5em; -width:inherit; +margin-top: 0.5em; +} + +.sign-in-wrapper { + overflow: hidden; + padding: 1em 1.5em 1.5em; + background-color: #f4f4f4; + h2 { + margin-top: 0.2em; + } } div.controller_help dt a,div.controller_help h1 a,div#help_unhappy h1 a.hover_a { @@ -898,7 +914,6 @@ margin:0 1.2em 0 0.9em; #request_header_text,#request_search_ahead_results { font-size:0.9em; -margin-left:11em; } div.feed_link img,div.act_link img { @@ -907,34 +922,6 @@ vertical-align:middle; text-decoration:none; } -#follow_box { - - padding: 4px; -} - -#follow_box .feed_link { - text-align: center; -} - -#follow_count { - color: #93278F; - font-family: 'DeliciousBold', Arial, sans-serif; - font-weight: 700; - font-size: 60px; - line-height: 60px; - text-align: right; - float: left; - margin-top: -15px; - margin-right: 5px; -} -.follow_count { - clear:both; -} - -#follow_box h2 { - margin: 0; -} - h2,dt { font-size:1.8em; } @@ -995,21 +982,20 @@ width:245px; float:left; } +.authority__body__foi-results .request_right { +width:545px; +} + #request_header_text { -margin-left:110px; -width: 30em; border-radius:3px; -moz-border-radius:3px; -margin-top: 10px; +margin: 10px 10px 0; background-color:#D5FFD8; border-color:#1EFF38; border-style:solid; border-width:1px; padding:0.5em; - font-style: italic; - - } #request_header_text h3 { @@ -1272,13 +1258,19 @@ font-style:italic; color:#444; } -#sign_together h1 { -width:320px; -text-align:center; + +#sign_together { + #left_half { + width: 63.666%; + margin-right: 3%; + } + #right_half { + width: 33.333%; + } } -#sign_together .form_button { -margin-left:10.5em; +.pretitle { + margin-bottom: 0; } form input[type=text],form input[type=password] { @@ -1817,3 +1809,108 @@ text-decoration:none; color: #0000EE; font-size: 0.9em; } + +.back-to-results { + margin-top: 0.5em; +} + +.authority__header { + border-bottom: 1px solid #e9e9e9; + margin-bottom: 1em; +} + + +.authority__header__subtitle { + font-size: 1.2em; + color: #666; +} + +.authority__header__notes { + margin: 1em; +} + +.authority__body { + overflow: hidden; +} + +.authority__body__foi-results { + width: 63.666%; + float: left; + margin-right: 3%; +} + +.authority__body__sidebar { + width: 33.333%; + float: left; +} + +.authority__header__action-bar { + font-size: 0; + padding: 16px 0; + margin-top: 8px; + border-top: 1px solid #e9e9e9; +} + +.action-bar__make-request, +.action-bar__follow, +.action-bar__follow-button, +.action-bar__follower-count { + font-size: 16px; + display: inline-block; + margin:0 1em 0 0; + .feed_link { + padding: 0; + } +} + +.list-filter-item { + .title { + display: inline; + font-size: 1em; + font-weight: normal; + } +} + +.list-filter-item { + ul { + list-style: none outside none; + margin: 0; + padding: 0; + } + li { + display: inline-block; + &:after { + content:' | '; + display: inline-block; + color: #ccc; //Unsupported browsers will ignore the rgba declaration below + color: rgba(0,0,0,0.1); + } + &:last-child { + &:after { + content: ''; + } + } + + } +} + +.authority__body__sidebar__links { + a { + display: inline-block; + margin-bottom: 0.5em; + } +} + +#list-filter { + margin-bottom: 3em; +} + +#filter_requests_form label.title { + display: block; + width: auto; + margin-bottom: 0.3em; +} + +#notice.request-sent-message { + font-size: 1em; +} diff --git a/app/assets/stylesheets/responsive/_global_style.scss b/app/assets/stylesheets/responsive/_global_style.scss index ef755c01e..24cddc0d9 100644 --- a/app/assets/stylesheets/responsive/_global_style.scss +++ b/app/assets/stylesheets/responsive/_global_style.scss @@ -92,7 +92,7 @@ dt + dd { /* Links in sidebars usually only underlined on hover */ .feed_link,.act_link { - margin-bottom:10px; + a{ text-decoration:none; } @@ -191,15 +191,6 @@ form input[type=text],form input[type=password] { padding:0.5em; } -#preview_form ul { - margin:0; - padding:1px 32px 10px; -} - -#preview_form ul li { - margin:10px 0; -} - label small{ text-transform: none; } diff --git a/app/assets/stylesheets/responsive/_new_request_layout.scss b/app/assets/stylesheets/responsive/_new_request_layout.scss index 55c72b8e3..2ebba0813 100644 --- a/app/assets/stylesheets/responsive/_new_request_layout.scss +++ b/app/assets/stylesheets/responsive/_new_request_layout.scss @@ -3,8 +3,9 @@ /* /select_authority page */ #authority_selection { @include grid-column($columns: 12, $collapse: true); + @include respond-min( $main_menu-mobile_menu_cutoff ){ - @include grid-column($columns: 6, $collapse: true); + @include grid-column(8, $collapse: true); @include ie8{ padding-right: 0.9375em; } @@ -15,16 +16,27 @@ width: 80%; } } + .authority_search_ahead_results_container { + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-row($behavior: nest); + } + } + #authority_search_ahead_results, + .cant_find_results { + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column(12); + } + } } .new_info_request{ - @include grid-row($behavior: nest); + @include grid-row(); } #select_authority_help { - @include grid-column(12); + @include grid-column(12, $collapse: true); @include respond-min( $main_menu-mobile_menu_cutoff ) { - @include grid-column(6); + @include grid-column(4); @include ie8 { padding-right: 0.9375em; } @@ -32,14 +44,41 @@ width: 26.188em; } } + + /* Hide some elements of the public body that aren't appropriate in this + context */ + #list-filter, h2.foi_results, .public-body-name-prefix { + display: none; + } + + /* Compact request list for viewing in authority preview column */ + .request_left, #header_left { + @include grid-column(12, $collapse: true); + } + + .request_right { + @include grid-column(12, $collapse: true); + } + + span.desc { + background:none; + line-height:18px; + padding: 0; + } + + .typeahead_response { + @include grid-row($behavior: nest); + } + + } /* /new/[body_name] page */ #request_header { - @include grid-row; + @include grid-row($behavior: nest); /* Restrict width of form elements on wide screens */ - #request_header_body, #request_header_subject, #typeahead_response { + #request_header_body, #request_header_subject, #typeahead_response { @include grid-column(12); @include respond-min( $main_menu-mobile_menu_cutoff ){ @include grid-column($columns:8, $last-column:true); @@ -62,12 +101,19 @@ float: right; } -/* Advice sits on right hand side */ -#request_advice { +.request_body { + @include grid-row($behavior: nest); +} +#request_body_header { + @include grid-column(12); +} + +/* Advice sits on right hand side */ +#request_advice, .preview-advice { @include grid-column(12); @include respond-min( $main_menu-mobile_menu_cutoff ){ - @include grid-column($columns:4, $push: 8); + @include grid-column($columns:4, $push:8, $last-column:true); @include ie8{ padding-left: 0.9375em; } @@ -78,10 +124,9 @@ } #request_form { - @include grid-column(12); @include respond-min( $main_menu-mobile_menu_cutoff ){ - @include grid-column($columns:8, $pull: 4); + @include grid-column($columns:8, $pull:4); @include ie8{ padding-right: 0.9375em; } @@ -92,10 +137,28 @@ } -#preview_form { - @include grid-column(12); +#outgoing_message_body { + width: 100%; +} + +/* Message preview */ +.message-preview { + @include grid-row($behavior: nest); } +.preview-pane { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:8, $pull:4); + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 36.813em; + } + } + } + /* Batch request page*/ @@ -164,13 +227,27 @@ div.batch_public_body_toggle { margin-left: 110px; } - /* Request sent page */ .request-sent-message { margin-top: 1em; h1 { - margin-bottom: 1em; + font-size: 1.3em; + margin-top: 0; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + font-size: 2em; + margin-bottom: 1em; + } + } + + .share-link img { + display:block; + margin: 1em auto; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + display: inline-block; + margin: inherit; + } } + } .request-sent-message__row { @@ -179,8 +256,10 @@ div.batch_public_body_toggle { .request-sent-message__column-1 { @include grid-column(12); + margin-bottom: 1em; @include respond-min( $main_menu-mobile_menu_cutoff ){ @include grid-column($columns:8); + margin-bottom: 0; @include ie8{ padding-right: 0.9375em; } diff --git a/app/assets/stylesheets/responsive/_new_request_style.scss b/app/assets/stylesheets/responsive/_new_request_style.scss index e07ecb55c..55abdca31 100644 --- a/app/assets/stylesheets/responsive/_new_request_style.scss +++ b/app/assets/stylesheets/responsive/_new_request_style.scss @@ -29,15 +29,23 @@ #to_public_body { font-weight: bold; font-size: 1.3em; + margin-bottom: 0.5em; +} + +.to_public_body_label { + color: #777; + font-weight: normal; +} + +#request_header { + border-bottom: 1px solid #ccc; //Unsupported browsers will ignore the rgba declaration below + border-color: rgba(0,0,0,0.1); + margin-bottom: 2em; } #request_header_text { - border-radius:3px; - background-color: lighten(#62b356, 23%); - padding:0 1em; - margin-bottom: 1.5em; - margin-top: 1.5em; overflow: hidden; + font-size: 0.875em; h3 { font-size: 1em; } @@ -45,15 +53,54 @@ } #request_advice { + margin-bottom: 1.5em; + font-size: 0.875em; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + font-size: 1em; + } + .advice-panel { + margin-top: 1.5em; + } +} + +.advice-panel { + margin-bottom: 1.5em; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + margin-bottom: 0; + } ul { margin:0 auto; - + list-style: none outside none; + padding: 0; li { margin:0 0 1em; } } } +#request_search_ahead_results { + background-color: #f4f4f4; + padding: 1.5em; + margin-bottom: 1.5em; + h2 { + font-size: 1em; + font-weight: normal; + } +} + + +input#reedit_button { + background-color: transparent; + color: #2688dc; + text-decoration: underline; + &:hover, + &:active, + &:focus { + color: #333333; + } + border: none; +} + /* Batch request page */ diff --git a/app/assets/stylesheets/responsive/_public_body_layout.scss b/app/assets/stylesheets/responsive/_public_body_layout.scss index 39d42e213..7a9637bc9 100644 --- a/app/assets/stylesheets/responsive/_public_body_layout.scss +++ b/app/assets/stylesheets/responsive/_public_body_layout.scss @@ -8,3 +8,66 @@ @include grid-column(12); margin-top: 0.5em; } + +.authority__header { + @include respond-min( $main_menu-mobile_menu_cutoff ){ + margin-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: 16px 0; + margin-top: 8px; +} + +.action-bar__make-request, +.action-bar__follow, +.action-bar__follow-button, +.action-bar__follower-count { + vertical-align: top; + font-size: 16px; + margin: 1em 0; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + display: inline-block; + margin:0 1em 0 0; + } +} + + +.list-filter-item { + .title { + display: inline; + font-size: 1em; + font-weight: normal; + } +} diff --git a/app/assets/stylesheets/responsive/_public_body_style.scss b/app/assets/stylesheets/responsive/_public_body_style.scss index 4040198b3..748f6218b 100644 --- a/app/assets/stylesheets/responsive/_public_body_style.scss +++ b/app/assets/stylesheets/responsive/_public_body_style.scss @@ -1,24 +1,76 @@ /* 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); - } -} - -.public-body-name-prefix { - color:#888; - font-size: 1.3em; - position: relative; - top: 1em; -} - -#follow_count { - font-weight: bold; - font-size: 3em; - position: relative; - top: 0.25em; + .message { + margin-top: 0.5em; + padding: 0.5em 0.8em; + background-color: #fff; + background-color: rgba(0,0,0,0.1); + a { + text-decoration: none; + } + } +} + +.authority__header { + border-bottom: 1px solid #e9e9e9; +} + +.authority__header__subtitle { + font-size: 1.2em; + color: #666; +} + +.authority__header__action-bar { + border-top: 1px solid #e9e9e9; +} + +.authority__body__sidebar { + h2 { + font-size: 1.2em; + } + h3 { + font-size: 1em; + } +} + + +.list-filter-item { + ul { + list-style: none outside none; + margin: 0; + padding: 0; + } + li { + display: inline-block; + &:after { + content:' | '; + display: inline-block; + color: #ccc; //Unsupported browsers will ignore the rgba declaration below + color: rgba(0,0,0,0.1); + } + &:last-child { + &:after { + content: ''; + } + } + + } +} + +.authority__body__sidebar__links { + a { + display: inline-block; + margin-bottom: 0.5em; + } +} + +#list-filter { + margin-bottom: 3em; +} + +#filter_requests_form label.title { + display: block; + width: auto; + margin-bottom: 0.3em; } diff --git a/app/assets/stylesheets/responsive/_request_style.scss b/app/assets/stylesheets/responsive/_request_style.scss index c33688793..e6f36674a 100644 --- a/app/assets/stylesheets/responsive/_request_style.scss +++ b/app/assets/stylesheets/responsive/_request_style.scss @@ -3,7 +3,10 @@ div.correspondence { border: 1px solid #ccc; margin: 0 0 1em; - padding: 0.5em 1em 0 0.5em; + padding: 1em; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + padding: 1.5em; + } h2 { text-align:right; @@ -11,6 +14,20 @@ div.correspondence { } } +.preview_subject, +.preview_to { + font-weight: bold; + strong { + font-weight: normal; + display: block; + color: #777; + } +} + +.preview_subject { + margin-bottom: 1.5em; +} + div.comment_in_request { border: 1px dotted #ccc; margin:0 0 1em 3em; @@ -30,7 +47,7 @@ div.comment_in_request { margin-bottom: 1em; } -.correspondence_text,.comment_in_request_text { +.comment_in_request_text { margin:0 1.2em 0 0.9em; } 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/helpers/public_body_helper.rb b/app/helpers/public_body_helper.rb index cb4b71cb3..332e93284 100644 --- a/app/helpers/public_body_helper.rb +++ b/app/helpers/public_body_helper.rb @@ -21,7 +21,7 @@ module PublicBodyHelper unless public_body.has_request_email? # Make the authority appear requestable to encourage users to help find - # the authroty's email address + # the authority's email address msg = link_to _("Make a request to this authority"), new_request_to_body_path(:url_name => public_body.url_name), :class => "link_button_green" diff --git a/app/models/public_body_category.rb b/app/models/public_body_category.rb index c313e5734..198e8b737 100644 --- a/app/models/public_body_category.rb +++ b/app/models/public_body_category.rb @@ -49,11 +49,6 @@ class PublicBodyCategory < ActiveRecord::Base PublicBodyCategory.find_by_sql(sql) end - # Called from the old-style public_body_categories_[locale].rb data files - def self.add(locale, data_list) - CategoryAndHeadingMigrator.add_categories_and_headings_from_list(locale, data_list) - end - # Convenience methods for creating/editing translations via forms def find_translation_by_locale(locale) translations.find_by_locale(locale) 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/info_request_batch/_batch_sent.html.erb b/app/views/info_request_batch/_batch_sent.html.erb index 1bf51962f..b7d54d75c 100644 --- a/app/views/info_request_batch/_batch_sent.html.erb +++ b/app/views/info_request_batch/_batch_sent.html.erb @@ -1,18 +1,57 @@ -<div id="notice"> - <p> - <%= _("Your requests will be <strong>sent</strong> shortly!") %> - </p> +<div id="content"> + <div class="request-sent-message" id="notice"> + <h1> + <%= _("Your requests will be <strong>sent</strong> shortly!") %> + </h1> + <div class="request-sent-message__row"> + <div class="request-sent-message__column-1"> + <p class="subtitle"> + <%= _("<strong>We will email you</strong> when they have been sent. " \ + "We will also email you when there is a response to any of them, or " \ + "after {{late_number_of_days}} working days if the authorities still " \ + "haven't replied by then.", + :late_number_of_days => AlaveteliConfiguration::reply_late_after_days) %> + </p> - <p> - <%= _("<strong>We will email you</strong> when they have been sent. " \ - "We will also email you when there is a response to any of them, or " \ - "after {{late_number_of_days}} working days if the authorities still" \ - "haven't replied by then.", - :late_number_of_days => AlaveteliConfiguration::reply_late_after_days) %> - </p> + <h2><%= _("Share your batch request") %></h2> - <p> - <%= _("If you write about these requests (for example in a forum or a blog) " \ - "please link to this page.") %> - </p> + <%= link_to image_tag("next-step-twitter.png", + :alt => _("Tweet it"), + :width => "120", + :height => "37"), + "https://twitter.com/intent/tweet?" << { + :url => request.url, + :via => AlaveteliConfiguration.twitter_username, + :text => "'#{ @info_request_batch.title }'", + :related => _('alaveteli_foi:The software that runs {{site_name}}', :site_name => site_name) + }.to_query, :class => 'share-link' %> + + <%= link_to image_tag("next-step-facebook.png", + :alt => _("Share on Facebook"), + :width => "120", + :height => "37"), + "https://www.facebook.com/sharer/sharer.php?" << { + :u => request.url + }.to_query, :class => 'share-link' %> + + <h2><%= _("Keep your requests up to date") %></h2> + <p> + <%= _('If you write about these requests ' \ + '(for example in a forum or a blog) ' \ + 'please link to this page.') %> + </p> + </div> + <div class="request-sent-message__column-2"> + <div class="what-next"> + <h2><%= _("What next?") %></h2> + <ul class="what-next__list"> + <li> + <%= link_to _("Help us classify requests that haven't " \ + "been updated"), categorise_play_path %> + </li> + </ul> + </div> + </div> + </div> + </div> </div> diff --git a/app/views/public_body/_search_ahead.html.erb b/app/views/public_body/_search_ahead.html.erb index b06ed5efa..e1465bb15 100644 --- a/app/views/public_body/_search_ahead.html.erb +++ b/app/views/public_body/_search_ahead.html.erb @@ -1,16 +1,18 @@ <% if !@xapian_requests.nil? %> <% if @xapian_requests.results.size > 0 %> - <h3><%= _('Top search results:') %></h3> + <p><%= _('Matching authorities') %></p> <% else %> - <h3><%= _('No results found.') %></h3> + <p><%= _('No results found.') %></p> <% end %> - <div id="authority_search_ahead_results"> - <% for result in @xapian_requests.results %> - <%= render :partial => 'public_body/body_listing_single', - :locals => { :public_body => result[:model], - :request_link => true } %> - <% end %> - </div> - <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @xapian_requests.matches_estimated), :params => {:controller=>"request", :action => "select_authority"} %> + <div class="authority_search_ahead_results_container"> + <div id="authority_search_ahead_results"> + <% for result in @xapian_requests.results %> + <%= render :partial => 'public_body/body_listing_single', + :locals => { :public_body => result[:model], + :request_link => true } %> + <% end %> + </div> + <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @xapian_requests.matches_estimated), :params => {:controller=>"request", :action => "select_authority"} %> + </div> <% end %> diff --git a/app/views/public_body/show.html.erb b/app/views/public_body/show.html.erb index 8d90844c0..016c2460d 100644 --- a/app/views/public_body/show.html.erb +++ b/app/views/public_body/show.html.erb @@ -1,65 +1,87 @@ <% @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"> <%= type_of_authority(@public_body) %><% 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> + + <% if @public_body.has_notes? || @public_body.eir_only? || @public_body.special_not_requestable_reason? %> + <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 %> + <% 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 @public_body.is_requestable? %> - <% if @public_body.eir_only? %> - <p><%= _('You can only request information about the environment from this authority.')%></p> - <% end %> + <% 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 %> - <%= 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="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" %> + <% end %> + </div> + <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 %> + <%= (link_to _("Unsubscribe"), {:controller => 'track', :action => 'update', :track_id => @existing_track.id, :track_medium => "delete", :r => request.fullpath}, :class => "link_button_green") %> + <% 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> @@ -70,31 +92,18 @@ <% 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 %> - <%= render :partial => 'request/request_search_form', - :locals => { :after_form_fields => render(:partial => 'request/request_filter_form') } %> + <%= render :partial => 'request/request_filter_form' %> <% end %> <% end %> - <div style="clear:both"> </div> <% if !@xapian_requests.nil? %> <% for result in @xapian_requests.results %> @@ -121,4 +130,13 @@ <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_search_form' %> + <% end %> + <%= render :partial => 'more_info', :locals => { :public_body => @public_body } %> + <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'sidebar' } %> + </div> + </div> diff --git a/app/views/request/_request_filter_form.html.erb b/app/views/request/_request_filter_form.html.erb index 0983c8c57..19961ddfc 100644 --- a/app/views/request/_request_filter_form.html.erb +++ b/app/views/request/_request_filter_form.html.erb @@ -1,21 +1,23 @@ <div class="list-filter-item"> - <h3 class="title"><%= _("Showing") %></h3> <div class="filter-request-types"> + <ul> <% statuses = [["all", _("all requests")], ["successful", _("successful requests")], ["unsuccessful", _("unsuccessful requests")], ["awaiting", _("unresolved requests")]] %> <% statuses.each do |status, label| %> + <li> <% if params[:view] != status %> <% if params[:controller] == "public_body" %> <%= link_to label, url_for(:controller => "public_body", :action => "show", :view => status, :url_name => @public_body.url_name) + "?" + request.query_string + '#results' %> <% else %> - <%= link_to label, url_for(:controller => "request", :action => "list", :view => status) + "?" + request.query_string + '#results' %> + <%= link_to label, url_for(:controller => "request", :action => "list", :view => status) + "?" + request.query_string + '#results' %> <% end %> <% else %> <%= label %> <% end %> - <%= "|" unless statuses.last[0] == status %> + </li> <% end %> + </ul> </div> </div> diff --git a/app/views/request/_request_sent.html.erb b/app/views/request/_request_sent.html.erb index 3525ba2be..3bbf49446 100644 --- a/app/views/request/_request_sent.html.erb +++ b/app/views/request/_request_sent.html.erb @@ -24,7 +24,7 @@ :via => AlaveteliConfiguration.twitter_username, :text => "'#{ @info_request.title }'", :related => _('alaveteli_foi:The software that runs {{site_name}}', :site_name => site_name) - }.to_query %> + }.to_query, :class => 'share-link' %> <%= link_to image_tag("next-step-facebook.png", :alt => _("Share on Facebook"), @@ -32,7 +32,7 @@ :height => "37"), "https://www.facebook.com/sharer/sharer.php?" << { :u => request.url - }.to_query %> + }.to_query, :class => 'share-link' %> <h2><%= _("Keep your request up to date") %></h2> <p> diff --git a/app/views/request/_search_ahead.html.erb b/app/views/request/_search_ahead.html.erb index 4fbe06ebc..397973d49 100644 --- a/app/views/request/_search_ahead.html.erb +++ b/app/views/request/_search_ahead.html.erb @@ -1,9 +1,8 @@ <% unless @xapian_requests.nil? %> +<% if @xapian_requests.results.any? %> <div id="request_search_ahead_results"> - <% if @xapian_requests.results.any? %> <span class="close-button">X</span> - <h3><%= _("Possibly related requests:") %></h3> - + <h2><%= _("Possible related requests") %></h2> <% @xapian_requests.results.each do |result| %> <%= render :partial => 'request/request_listing_short_via_event', :locals => { :event => result[:model], @@ -15,6 +14,7 @@ <%= _("Search in their website for this information →") %> </a> </p> - <% end %> - </div> + + </div> + <% end %> <% end %> diff --git a/app/views/request/new.html.erb b/app/views/request/new.html.erb index 688d9e87b..486a89d45 100644 --- a/app/views/request/new.html.erb +++ b/app/views/request/new.html.erb @@ -19,11 +19,11 @@ // When following links in typeahead results, open new // tab/window $("#typeahead_response a").attr("target","_blank"); - + // Update the public body site search link $("#body-site-search-link").attr("href", "http://www.google.com/#q="+encodeURI($("#typeahead_search").val())+ "+site:<%= @info_request.public_body.calculated_home_page %>"); - + $('.close-button').click(function() { $(this).parent().hide() }); } }); @@ -31,184 +31,206 @@ }); </script> <% end %> + + + <% if @batch %> <% @title = _("Make an {{law_used_short}} request", :law_used_short=>h(@info_request.law_used_short)) %> <% else %> <% @title = _("Make an {{law_used_short}} request to '{{public_body_name}}'",:law_used_short=>h(@info_request.law_used_short),:public_body_name=>h(@info_request.public_body.name)) %> <% end %> - <h1><%= _('2. Ask for Information') %></h1> - - <% if @existing_request %> - <div class="errorExplanation" id="errorExplanation"><ul> - <li> - <%= _('{{existing_request_user}} already - created the same request on {{date}}. You can either view the <a href="{{existing_request}}">existing request</a>, - or edit the details below to make a new but similar request.',:existing_request_user=>user_or_you_capital_link(@existing_request.user), :date=>simple_date(@existing_request.created_at), :existing_request=>request_path(@existing_request)) %> - </li> - </ul></div> - <% end %> - <% if @existing_batch %> - <div class="errorExplanation" id="errorExplanation"><ul> - <li> - <%= _('You already created the same batch of requests on {{date}}. You can either view the <a href="{{existing_batch}}">existing batch</a>, or edit the details below to make a new but similar batch of requests.', :date=>simple_date(@existing_batch.created_at), :existing_batch=>info_request_batch_path(@existing_batch)) %> - </li> - </ul></div> - <% end %> - <%= foi_error_messages_for :info_request, :outgoing_message %> - <%= form_for(@info_request, :url => (@batch ? new_batch_path : new_request_path), :html => { :id => 'write_form' } ) do |f| %> - - <div id="request_header"> - <div id="request_header_body"> - <label class="form_label"><%= _('To:') %></label> - - <% if @batch %> - <span id="to_public_body"> - <%= _("Your selected authorities") %> - <span class="batch_public_body_toggle" data-hidetext="<%= _("(hide)") %>" data-showtext="<%= _("(show)") %>"><a class="toggle-message"></a></span> - </span> - - <div class="batch_public_body_list"> - <ul> - <% @public_bodies.each do |public_body| %> - <li><%= public_body.name %></li> - <% end %> - </ul> - </div> +<%= form_for(@info_request, :url => (@batch ? new_batch_path : new_request_path), :html => { :id => 'write_form' } ) do |f| %> + <div id="request_header"> + <div id="request_header_body"> + <h1><%= _('Make a request') %></h1> + + <% if @existing_request %> + <div class="errorExplanation" id="errorExplanation"> + <ul> + <li> + <%= _('{{existing_request_user}} already + created the same request on {{date}}. You can either view the <a href="{{existing_request}}">existing request</a>, + or edit the details below to make a new but similar request.',:existing_request_user=>user_or_you_capital_link(@existing_request.user), :date=>simple_date(@existing_request.created_at), :existing_request=>request_path(@existing_request)) %> + </li> + </ul> + </div> + <% end %> + + <% if @existing_batch %> + <div class="errorExplanation" id="errorExplanation"> + <ul> + <li> + <%= _('You already created the same batch of requests on {{date}}. You can either view the <a href="{{existing_batch}}">existing batch</a>, or edit the details below to make a new but similar batch of requests.', :date=>simple_date(@existing_batch.created_at), :existing_batch=>info_request_batch_path(@existing_batch)) %> + </li> + </ul> + </div> + <% end %> - <% else %> - <span id="to_public_body"> - <%=h(@info_request.public_body.name)%> - </span> - <% end %> + <%= foi_error_messages_for :info_request, :outgoing_message %> - <% unless @batch %> - <div class="form_item_note"> - <% if @info_request.public_body.info_requests.size > 0 %> - <%= _("Browse <a href='{{url}}'>other requests</a> to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_path(@info_request.public_body)) %> - <% else %> - <%= _("Browse <a href='{{url}}'>other requests</a> for examples of how to word your request.", :url=>request_list_url) %> - <% end %> - </div> - - <% if @info_request.public_body.has_notes? %> - <div id="request_header_text"> - <h3><%= _('Special note for this authority!') %></h3> - <p><%= @info_request.public_body.notes_as_html.html_safe %></p> - </div> - <% end %> - - <% if @info_request.public_body.override_request_email %> - <div class="warning"> - <%= _("<strong>Note:</strong> Because we're testing, requests are being sent to {{email}} rather than to the actual authority.", :email => @info_request.public_body.override_request_email) %> - </div> - <% end %> - - <% if @info_request.public_body.eir_only? %> - <h3><%= _('Please ask for environmental information only') %></h3> - - <p><%= _('The Freedom of Information Act <strong>does not apply</strong> to') %> <%=h(@info_request.public_body.name)%>. - <%= _('However, you have the right to request environmental - information under a different law') %> (<a href="/help/requesting#eir">explanation</a>). - <%= _('This covers a very wide spectrum of information about the state of - the <strong>natural and built environment</strong>, such as:') %> - - <ul> - <li><%= _('Air, water, soil, land, flora and fauna (including how these effect - human beings)') %></li> - <li><%= _('Information on emissions and discharges (e.g. noise, energy, - radiation, waste materials)') %></li> - <li><%= _('Human health and safety') %></li> - <li><%= _('Cultural sites and built structures (as they may be affected by the - environmental factors listed above)') %></li> - <li><%= _('Plans and administrative measures that affect these matters') %></li> - </ul> - - <p><%= _('Please only request information that comes under those categories, <strong>do not waste your - time</strong> or the time of the public authority by requesting unrelated information.') %></p> - <% end %> - <% end %> + <% if !AlaveteliConfiguration::override_all_public_body_request_emails.blank? %> + <div class="warning"> + <%= _("<strong>Note:</strong> Because we're testing, requests are being sent to {{email}} rather than to the actual authority.", :email => AlaveteliConfiguration::override_all_public_body_request_emails) %> </div> + <% end %> + + <% if @batch %> + <label class="form_label"><%= _('To:') %></label> + <span id="to_public_body"> + <%= _("Your selected authorities") %> + <span class="batch_public_body_toggle" data-hidetext="<%= _("(hide)") %>" data-showtext="<%= _("(show)") %>"><a class="toggle-message"></a></span> + </span> + + <div class="batch_public_body_list"> + <ul> + <% @public_bodies.each do |public_body| %> + <li><%= public_body.name %></li> + <% end %> + </ul> + </div> + <% else %> + <p id="to_public_body"><span class="to_public_body_label">To:</span> + <%=h(@info_request.public_body.name)%> + </p> + <% end %> - <div id="request_header_subject"> - <p> - <label class="form_label" for="typeahead_search"><%= _('Summary:') %></label> - <%= f.text_field :title, :size => 50, :id =>"typeahead_search" %> - </p> - <div class="form_item_note"> - (<%= _("a one line summary of the information you are requesting, \n\t\t\te.g.") %> - <%= render :partial => "summary_suggestion" %>) - </div> - </div> + <% unless @batch %> + <% if @info_request.public_body.has_notes? %> + <div id="request_header_text"> + <p><%= @info_request.public_body.notes_as_html.html_safe %></p> + </div> + <% end %> + <% end %> - <div id="typeahead_response"> - </div> </div> + </div> + + <% unless @batch %> + <% if @info_request.public_body.eir_only? %> + <div class="request_body"> + <div id="request_body_header"> + <h3><%= _('Please ask for environmental information only') %></h3> + + <p><%= _('The Freedom of Information Act <strong>does not apply</strong> to') %> <%=h(@info_request.public_body.name)%>. + <%= _('However, you have the right to request environmental + information under a different law') %> (<a href="/help/requesting#eir">explanation</a>). + <%= _('This covers a very wide spectrum of information about the state of + the <strong>natural and built environment</strong>, such as:') %> + </p> + <ul> + <li><%= _('Air, water, soil, land, flora and fauna (including how these effect + human beings)') %></li> + <li><%= _('Information on emissions and discharges (e.g. noise, energy, + radiation, waste materials)') %></li> + <li><%= _('Human health and safety') %></li> + <li><%= _('Cultural sites and built structures (as they may be affected by the + environmental factors listed above)') %></li> + <li><%= _('Plans and administrative measures that affect these matters') %></li> + </ul> + + <p><%= _('Please only request information that comes under those categories, <strong>do not waste your + time</strong> or the time of the public authority by requesting unrelated information.') %></p> + </div> + </div> + <% end %> + <% end %> + <div class="request_body"> <div id="request_advice"> + <% unless @batch %> + <p> + <% if @info_request.public_body.info_requests.size > 0 %> + <%= _("Browse <a href='{{url}}'>other requests</a> to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_path(@info_request.public_body)) %> + <% else %> + <%= _("Browse <a href='{{url}}'>other requests</a> for examples of how to word your request.", :url=>request_list_url) %> + <% end %> + </p> + <% end %> + + <% if !@user %> + <p> + <%= raw(_('Everything that you enter on this page, including <strong>your name</strong>, + will be <strong>displayed publicly</strong> on + this website <a href="{{url}}">forever</a>', :url => (help_privacy_path+"#public_request").html_safe)) %>. + </p> + <p> + <%= raw(_('<a href="{{url}}">Thinking of using a pseudonym?</a>.', :url => (help_privacy_path+"#real_name").html_safe)) %> + </p> + <% else %> + <p> + <%= raw(_('Everything that you enter on this page + will be <strong>displayed publicly</strong> on + this website forever (<a href="{{url}}">why?</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %> + </p> + <% end %> + + <p> + <%= raw(_("<strong> Can I request information about myself?</strong>\n" + + "\t\t\t<a href=\"{{url}}\">No!</a>", :url => (help_requesting_path+"#data_protection").html_safe)) %> + </p> + <div class="advice-panel"> <ul> - <li><%= _('Write your request in <strong>simple, precise language</strong>.') %></li> - <li><%= _('Ask for <strong>specific</strong> documents or information, this site is not suitable for general enquiries.') %></li> - <li><%= _('Keep it <strong>focused</strong>, you\'ll be more likely to get what you want (<a href="{{url}}">why?</a>).', :url => (help_requesting_path + '#focused').html_safe) %></li> + + <li><%= _('Write your request in <strong>simple, precise language</strong>.') %></li> + <li><%= _('Ask for <strong>specific</strong> documents or information, this site is not suitable for general enquiries.') %></li> + <li><%= _('<a href="{{url}}">Keep it <strong>focused</strong></a>, you\'ll be more likely to get what you want.', :url => (help_requesting_path + '#focused').html_safe) %></li> </ul> + </div> + </div> <div id="request_form"> - <%= fields_for :outgoing_message do |o| %> - <p> - <label class="form_label" for="outgoing_message_body"><%= _('Your request:') %></label> - <%= o.text_area :body, :rows => 20, :cols => 60 %> - </p> - <% end %> - - <% if !@user %> - <p class="form_note"> - - <%= raw(_('Everything that you enter on this page, including <strong>your name</strong>, - will be <strong>displayed publicly</strong> on - this website forever (<a href="{{url}}">why?</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %> - <%= raw(_('If you are thinking of using a pseudonym, - please <a href="{{url}}">read this first</a>.', :url => (help_privacy_path+"#real_name").html_safe)) %> - </p> - <% else %> - <p class="form_note"> - <%= raw(_('Everything that you enter on this page - will be <strong>displayed publicly</strong> on - this website forever (<a href="{{url}}">why?</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %> - </p> - <% end %> - <p class="form_note"> - <%= raw(_("<strong> Can I request information about myself?</strong>\n" + - "\t\t\t<a href=\"{{url}}\">No! (Click here for details)</a>", :url => (help_requesting_path+"#data_protection").html_safe)) %> + <div id="request_header_subject"> + <p> + <label class="form_label" for="typeahead_search"><%= _('Summary:') %></label> + <%= f.text_field :title, :size => 50, :id =>"typeahead_search" %> </p> - - <div class="form_button"> - <% if @batch %> - <% params[:public_body_ids].each do |public_body_id| %> - <%= hidden_field_tag("public_body_ids[]", public_body_id)%> - <% end %> - <% else %> - <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> - <% end %> - <%= hidden_field_tag(:submitted_new_request, 1 ) %> - <%= hidden_field_tag(:preview, 1 ) %> - <%= submit_tag _("Preview your public request") %> + <div class="form_item_note"> + <%= _("A one line summary of the information you are requesting, \n\t\t\te.g.") %> + <%= render :partial => "summary_suggestion" %> </div> + </div> + + <div id="typeahead_response"> + </div> + + <%= fields_for :outgoing_message do |o| %> + <p> + <label class="form_label" for="outgoing_message_body"><%= _('Your request:') %></label> + <%= o.text_area :body, :rows => 20, :cols => 60 %> + </p> + <% end %> + + <div class="form_button"> + <% if @batch %> + <% params[:public_body_ids].each do |public_body_id| %> + <%= hidden_field_tag("public_body_ids[]", public_body_id)%> + <% end %> + <% else %> + <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> + <% end %> + <%= hidden_field_tag(:submitted_new_request, 1 ) %> + <%= hidden_field_tag(:preview, 1 ) %> + <%= submit_tag _("Preview your public request") %> + </div> - <% if !@info_request.tag_string.empty? %> - <p class="form_note"> - <!-- <label class="form_label" for="info_request_tag_string"><%= _("Tags (separated by a space):") %></label> - <%= f.text_field :tag_string, :size => 50 %> --> + <% if !@info_request.tag_string.empty? %> + <p class="form_note"> + <!-- <label class="form_label" for="info_request_tag_string"><%= _("Tags (separated by a space):") %></label> + <%= f.text_field :tag_string, :size => 50 %> --> - <%= f.hidden_field(:tag_string) %> - <strong>Tags:</strong> <%=h @info_request.tag_string %> - </p> - <% end %> + <%= f.hidden_field(:tag_string) %> + <strong>Tags:</strong> <%=h @info_request.tag_string %> + </p> + <% end %> - </div> + </div> + </div> <% end %> + <% if @batch %> <%= javascript_include_tag 'new-request.js' %> <% end %> diff --git a/app/views/request/preview.html.erb b/app/views/request/preview.html.erb index ddd5ab30c..3a5b8ae87 100644 --- a/app/views/request/preview.html.erb +++ b/app/views/request/preview.html.erb @@ -5,58 +5,68 @@ <% end %> <%= form_for(@info_request, :url => (@batch ? new_batch_path : new_request_path), :html => { :id => 'preview_form' } ) do |f| %> - <h1><%= _('3. Now check your request') %></h1> - <ul> - <li><%= _('Check you haven\'t included any <strong>personal information</strong>.') %></li> - <li><%= raw(_('Your name, request and any responses will appear in <strong>search engines</strong> - (<a href="{{url}}">details</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %> - </li> - </ul> - - <%= fields_for :outgoing_message do |o| %> - - <div class="correspondence" id="outgoing-0"> - <p class="preview_subject"> - <strong><%= _('To:') %></strong> - <% if @batch %> - <%= _("Your selected authorities")%> - <% else %> - <%=h(@info_request.public_body.name)%> - <% end %> - <br><strong><%= _('Subject:') %></strong> <%= @info_request.email_subject_request %> - </p> - - <div class="correspondence_text"> - <p><%= @outgoing_message.get_body_for_html_display %></p> - <%= o.hidden_field(:body) %> - </div> + <h1><%= _('Preview your request') %></h1> + <div class="message-preview"> + <div class="preview-advice"> + <div class="advice-panel"> + <ul> + <li><%= _('Check you haven\'t included any <strong>personal information</strong>.') %></li> + <li><%= raw(_('Your name, request and any responses will appear in <strong>search engines</strong> + (<a href="{{url}}">details</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %> + </li> + <li><%= _('<a href="{{url}}">Do you want to request private information about yourself?</a>', :url => (help_requesting_path+"#data_protection").html_safe) %></li> + </ul> - <p class="event_actions"> - </p> + </div> </div> - <% end %> - - <p><%= _('<strong>Privacy note:</strong> If you want to request private information about - yourself then <a href="{{url}}">click here</a>.', :url => (help_requesting_path+"#data_protection").html_safe) %> - - <p> - <%= f.hidden_field(:title) %> - <% if @batch %> - <% params[:public_body_ids].each do |public_body_id| %> - <%= hidden_field_tag("public_body_ids[]", public_body_id)%> - <% end %> - <% else %> - <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> - <% end %> - <%= f.hidden_field(:tag_string) %> - <%= hidden_field_tag(:submitted_new_request, 1) %> - <%= hidden_field_tag(:preview, 0 ) %> - <%= submit_tag _("Edit this request"), :name => 'reedit', :id => 'reedit_button' %> - <%= submit_tag _("Send request"), :name => 'submit', :id => 'submit_button' %> - </p> - - <% if !@info_request.tag_string.empty? %> - <p><strong><%= _('Tags:') %></strong> <%=h @info_request.tag_string %></p> - <% end %> + <div class="preview-pane"> + <%= fields_for :outgoing_message do |o| %> + + <div class="correspondence" id="outgoing-0"> + <p class="preview_to"> + <strong><%= _('To') %></strong> + <% if @batch %> + <%= _("Your selected authorities")%> + <% else %> + <%=h(@info_request.public_body.name)%> + <% end %> + </p> + <p class="preview_subject"> + <strong><%= _('Subject') %></strong> <%= @info_request.email_subject_request %> + </p> + + <div class="correspondence_text"> + <p><%= @outgoing_message.get_body_for_html_display %></p> + <%= o.hidden_field(:body) %> + </div> + + <p class="event_actions"> + </p> + </div> + <% end %> + + + + <p> + <%= f.hidden_field(:title) %> + <% if @batch %> + <% params[:public_body_ids].each do |public_body_id| %> + <%= hidden_field_tag("public_body_ids[]", public_body_id)%> + <% end %> + <% else %> + <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> + <% end %> + <%= f.hidden_field(:tag_string) %> + <%= hidden_field_tag(:submitted_new_request, 1) %> + <%= hidden_field_tag(:preview, 0 ) %> + <%= submit_tag _("Edit your request"), :name => 'reedit', :id => 'reedit_button' %> + <%= submit_tag _("Send request"), :name => 'submit', :id => 'submit_button' %> + </p> + + <% if !@info_request.tag_string.empty? %> + <p><strong><%= _('Tags:') %></strong> <%=h @info_request.tag_string %></p> + <% end %> + </div> + </div> <% end %> diff --git a/app/views/request/select_authorities.html.erb b/app/views/request/select_authorities.html.erb index e16bcc191..cfbc21a28 100644 --- a/app/views/request/select_authorities.html.erb +++ b/app/views/request/select_authorities.html.erb @@ -1,5 +1,5 @@ -<% @title = _("Select the authorities to write to") %> -<h1><%= _('1. Select authorities') %></h1> +<% @title = _("Find the authorities to write to") %> +<h1><%= _('Find the authorities') %></h1> <p> <%= _("Search for the authorities you'd like information from:") %> diff --git a/app/views/request/select_authority.html.erb b/app/views/request/select_authority.html.erb index 9a5d565b6..7e27d97a8 100644 --- a/app/views/request/select_authority.html.erb +++ b/app/views/request/select_authority.html.erb @@ -10,9 +10,9 @@ }); </script> -<% @title = _("Select the authority to write to") %> +<% @title = _("Find an authority") %> -<h1 style="clear: left"><%= _('1. Select an authority') %></h1> +<h1><%= _('Find an authority') %></h1> <div id="authority_selection"> <%= form_tag select_authority_path, { :id => 'search_form', :method => 'get' } do %> diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb index d2096fd52..840639228 100644 --- a/config/initializers/alaveteli.rb +++ b/config/initializers/alaveteli.rb @@ -53,8 +53,6 @@ require 'theme' require 'xapian_queries' require 'date_quarter' require 'public_body_csv' -require 'category_and_heading_migrator' -require 'public_body_categories' require 'routing_filters' require 'alaveteli_text_masker' diff --git a/doc/CHANGES.md b/doc/CHANGES.md index dee11f6f7..40bab6ecf 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -1,31 +1,60 @@ # rails-3-develop ## Highlighted Features - +* Lots of improvements in the process of making a new + request (Martin Wright, Gareth Rees, Louise Crow): + * Removal of confusing AJAX results in `/select_authority`. + * Better layout of search/filtering options on the authority pages. + * Better layout of the authority pages on smaller screens. + * The dynamic list of possibly related requests for a new request + is now limited to requests to the same authority and capped at + three requests + * 'Create a new account' option now more prominent than 'Sign in' on `/sign_in` + * Better options for sharing your request on social media, and other + actions to take once the request is made. +* Some general security improvements: + * State changing admin actions are now restricted to PUT or POST methods + to protect against CSRF attacks, and now use more standard RESTful + routing (Louise Crow). + * Global request forgery protection is now used (Gareth Rees). + * Some standard security headers are added by default (Louise Crow). + * A TTL is enforced on session cookies (Louise Crow). * Added a new `AUTHORITY_MUST_RESPOND` configuration variable. Set this to `true` If authorities must respond by law. Set to `false` otherwise. It - defaults to `true`. At the moment this just tweaks some UI text. -* State changing admin actions are now restricted to PUT or POST methods - to protect against CSRF attacks, and now use more standard RESTful - routing. -* Global request forgery protection is now used -* The dynamic list of possibly related requests for a new request is now - limited to requests to the same authority and capped at three requests -* Some standard security headers are added by default + defaults to `true`. At the moment this just tweaks some UI text (Gareth Rees). * New rake task for cleaning theme translations - `rake - gettext:clean_theme` -* A TTL is enforced on session cookies + gettext:clean_theme` (Gareth Rees). * There's a new admin interface for adding public holidays for the site, - to be used in calculating request due dates. -* Autocomplete has been turned off on password fields + to be used in calculating request due dates. Documentation for using + this interface is available at + http://alaveteli.org/docs/installing/next_steps/#add-some-public-holidays (Louise Crow). * Some interface phrases have been grouped together for easier - translation + translation (Gareth Rees, Louise Crow). +* Now using the bootstrap js files from the bootstrap-sass gem. +* Confusing 'web analytics' section of admin pages removed (Henare Degan) +* Banned users can no longer update their profile (Gareth Rees). +* The code that removes email addresses and mobile phone numbers from + the public view of requests an responses has been refactored, and the + text that's used to replace the email addresses and phone numbers can + now be translated (Louise Crow). +* Fixed a bug with the CSV import of authorities which have the same + name in multiple locales (Louise Crow). ## Upgrade notes * Admin route names have been standardised so if you have overridden templates that refer to admin routes, check the original templates to see if these need to be changed. +* If you override the `app/views/user/_signin.html.erb` or + `app/view/user/_signup.html.erb` templates, check the tabindex order + is still sensible - the order of the elements on the page has changed + - signup now appears on the left. +* If you override the application stylesheets rather than adding to them + using a `custom.css` or `custom.scss` file, check that your + stylesheets still order elements correctly in the + `app/views/request/select_authority.html.erb`, + `app/views/public_body/show.html.erb` and + `app/views/request/new.html.erb`. # Version 0.20 diff --git a/lib/category_and_heading_migrator.rb b/lib/category_and_heading_migrator.rb deleted file mode 100644 index 402ea7204..000000000 --- a/lib/category_and_heading_migrator.rb +++ /dev/null @@ -1,91 +0,0 @@ -module CategoryAndHeadingMigrator - - # This module migrates data from public_body_categories_[locale].rb files - # into PublicBodyHeading and PublicBodyCategory models - - # Load all the data from public_body_categories_[locale].rb files. - def self.migrate_categories_and_headings - if PublicBodyCategory.count > 0 - puts "PublicBodyCategories exist already, not migrating." - else - @first_locale = true - I18n.available_locales.each do |locale| - begin - load "public_body_categories_#{locale}.rb" - rescue MissingSourceFile - end - @first_locale = false - end - end - end - - # Load the categories and headings for a locale - def self.add_categories_and_headings_from_list(locale, data_list) - # set the counter for headings loaded from this locale - @@locale_heading_display_order = 0 - current_heading = nil - data_list.each do |list_item| - if list_item.is_a?(Array) - # item is list of category data - add_category(list_item, current_heading, locale) - else - # item is heading name - current_heading = add_heading(list_item, locale, @first_locale) - end - end - end - - def self.add_category(category_data, heading, locale) - tag, title, description = category_data - category = PublicBodyCategory.find_by_category_tag(tag) - if category - add_category_in_locale(category, title, description, locale) - else - category = PublicBodyCategory.create(:category_tag => tag, - :title => title, - :description => description) - - # add the translation if this is not the default locale - # (occurs when a category is not defined in default locale) - unless category.translations.map { |t| t.locale }.include?(locale) - add_category_in_locale(category, title, description, locale) - end - end - heading.add_category(category) - end - - def self.add_category_in_locale(category, title, description, locale) - I18n.with_locale(locale) do - category.title = title - category.description = description - category.save - end - end - - def self.add_heading(name, locale, first_locale) - heading = nil - I18n.with_locale(locale) do - heading = PublicBodyHeading.find_by_name(name) - end - # For multi-locale installs, we assume that all public_body_[locale].rb files - # use the same headings in the same order, so we add translations to the heading - # that was in the same position in the list loaded from other public_body_[locale].rb - # files. - if heading.nil? && !@first_locale - heading = PublicBodyHeading.where(:display_order => @@locale_heading_display_order).first - end - - if heading - I18n.with_locale(locale) do - heading.name = name - heading.save - end - else - I18n.with_locale(locale) do - heading = PublicBodyHeading.create(:name => name) - end - end - @@locale_heading_display_order += 1 - heading - end -end diff --git a/lib/public_body_categories.rb b/lib/public_body_categories.rb deleted file mode 100644 index 3528e85b1..000000000 --- a/lib/public_body_categories.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Allow the PublicBodyCategory model to be addressed using the same syntax -# as the old PublicBodyCategories class without needing to rename everything, -# make sure we're not going to break any themes -class PublicBodyCategories - - def self.method_missing(method, *args, &block) - warn 'Use of PublicBodyCategories is deprecated and will be removed in release 0.21. Please use PublicBodyCategory instead.' - PublicBodyCategory.send(method, *args, &block) - end - -end diff --git a/spec/models/public_body_category_spec.rb b/spec/models/public_body_category_spec.rb index 96fe5686b..c16c9b8a1 100644 --- a/spec/models/public_body_category_spec.rb +++ b/spec/models/public_body_category_spec.rb @@ -9,35 +9,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe PublicBodyCategory do - describe 'when loading the data' do - it 'should use the display_order field to preserve the original data order' do - PublicBodyCategory.add(:en, [ - "Local and regional", - [ "local_council", "Local councils", "a local council" ], - "Miscellaneous", - [ "other", "Miscellaneous", "miscellaneous" ], - [ "aardvark", "Aardvark", "daft test"],]) - - headings = PublicBodyHeading.all - cat_group1 = headings[0].public_body_categories - cat_group1.count.should eq 1 - cat_group1[0].title.should eq "Local councils" - - cat_group2 = headings[1].public_body_categories - cat_group2.count.should eq 2 - cat_group2[0].title.should eq "Miscellaneous" - cat_group2[0].public_body_category_links.where( - :public_body_heading_id => headings[1].id). - first. - category_display_order.should eq 0 - - cat_group2[1].title.should eq "Aardvark" - cat_group2[1].public_body_category_links.where( - :public_body_heading_id => headings[1].id). - first. - category_display_order.should eq 1 - end - end context 'when validating' do diff --git a/spec/models/public_body_heading_spec.rb b/spec/models/public_body_heading_spec.rb index 9372e0a07..620f7da9c 100644 --- a/spec/models/public_body_heading_spec.rb +++ b/spec/models/public_body_heading_spec.rb @@ -10,26 +10,6 @@ require 'spec_helper' describe PublicBodyHeading do - context 'when loading the data' do - - before do - PublicBodyCategory.add(:en, [ - "Local and regional", - [ "local_council", "Local councils", "a local council" ], - "Miscellaneous", - [ "other", "Miscellaneous", "miscellaneous" ],]) - end - - it 'should use the display_order field to preserve the original data order' do - headings = PublicBodyHeading.all - headings[0].name.should eq 'Local and regional' - headings[0].display_order.should eq 0 - headings[1].name.should eq 'Miscellaneous' - headings[1].display_order.should eq 1 - end - - end - context 'when validating' do it 'should require a name' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 74a4891c2..93bcfa1ba 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,6 +18,7 @@ SimpleCov.start('rails') do add_filter 'lib/has_tag_string' add_filter 'lib/acts_as_xapian' add_filter 'lib/themes' + add_filter '.bundle' end Spork.prefork do diff --git a/spec/views/public_body/show.html.erb_spec.rb b/spec/views/public_body/show.html.erb_spec.rb index ce01d2e8b..6ebc39caa 100644 --- a/spec/views/public_body/show.html.erb_spec.rb +++ b/spec/views/public_body/show.html.erb_spec.rb @@ -44,7 +44,7 @@ describe "public_body/show" do it "should tell total number of requests" do render - response.should match "4 Freedom of Information requests" + response.should match "4 requests" end it "should cope with no results" do @@ -59,38 +59,6 @@ describe "public_body/show" do response.should match "The search index is currently offline" end - it "should link to Charity Commission site if we have numbers to do so" do - @pb.stub!(:has_tag?).and_return(true) - @pb.stub!(:get_tag_values).and_return(['98765', '12345']) - - render - response.should have_selector("div#header_right") do - have_selector "a", :href => /charity-commission.gov.uk.*RegisteredCharityNumber=98765$/ - end - response.should have_selector("div#header_right") do - have_selector "a", :href => /www.charity-commission.gov.uk.*RegisteredCharityNumber=12345$/ - end - end - - it "should link to Scottish Charity Regulator site if we have an SC number" do - @pb.stub!(:has_tag?).and_return(true) - @pb.stub!(:get_tag_values).and_return(['SC1234']) - - render - response.should have_selector("div#header_right") do - have_selector "a", :href => /www.oscr.org.uk.*id=SC1234$/ - end - end - - - it "should not link to Charity Commission site if we don't have number" do - render - response.should have_selector("div#header_right") do - have_selector "a", :href => /charity-commission.gov.uk/ - end - end - - end def mock_event |