diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/general.js | 2 | ||||
-rw-r--r-- | app/assets/stylesheets/responsive/_header_layout.scss | 16 | ||||
-rw-r--r-- | app/assets/stylesheets/responsive/_header_style.scss | 6 | ||||
-rw-r--r-- | app/assets/stylesheets/responsive/_public_body_layout.scss | 8 | ||||
-rw-r--r-- | app/assets/stylesheets/responsive/_public_body_style.scss | 33 | ||||
-rw-r--r-- | app/assets/stylesheets/responsive/_search_layout.scss | 8 | ||||
-rw-r--r-- | app/assets/stylesheets/responsive/_search_style.scss | 83 | ||||
-rw-r--r-- | app/assets/stylesheets/responsive/_utils.scss | 15 | ||||
-rw-r--r-- | app/controllers/public_body_controller.rb | 10 | ||||
-rw-r--r-- | app/helpers/public_body_helper.rb | 7 | ||||
-rw-r--r-- | app/views/general/_responsive_topnav.html.erb | 13 | ||||
-rw-r--r-- | app/views/request/_request_filter_form.html.erb | 2 |
12 files changed, 145 insertions, 58 deletions
diff --git a/app/assets/javascripts/general.js b/app/assets/javascripts/general.js index 002eef760..856f4c6d4 100644 --- a/app/assets/javascripts/general.js +++ b/app/assets/javascripts/general.js @@ -34,12 +34,12 @@ $(document).ready(function() { box.width(location.length + " em"); box.find('input').val(location).attr('size', location.length + " em"); box.show(); - box.find('input').select(); box.position({ my: "right center", at: "left bottom", of: this, collision: "fit" }); + box.find('input').select(); return false; }); diff --git a/app/assets/stylesheets/responsive/_header_layout.scss b/app/assets/stylesheets/responsive/_header_layout.scss index b3103e3a9..7c7bdfe97 100644 --- a/app/assets/stylesheets/responsive/_header_layout.scss +++ b/app/assets/stylesheets/responsive/_header_layout.scss @@ -131,25 +131,25 @@ } form{ @include grid-row; - padding-right: 1em; + padding: 1em 1em 0; @include lte-ie7 { display: inline; } + @include respond-min( $main_menu-mobile_menu_cutoff ){ + padding-top: 0; + } } input{ - @include grid-column($columns:9); - margin:0; + @include grid-column($columns:10); + margin-right:0; @include lte-ie7 { width: 10.063em; } } - label{ + button[type="submit"]{ @include prefix-postfix-base; - @include grid-column($columns:3,$float:left); + @include grid-column($columns:2,$float:right); border:none; - img{ - max-width: 100%; - } @include lte-ie7 { width: 2.125em; } diff --git a/app/assets/stylesheets/responsive/_header_style.scss b/app/assets/stylesheets/responsive/_header_style.scss index 9008a73a7..ec1e8ea5c 100644 --- a/app/assets/stylesheets/responsive/_header_style.scss +++ b/app/assets/stylesheets/responsive/_header_style.scss @@ -2,3 +2,9 @@ #navigation { border-bottom: 1px solid #e9e9e9; } + +#navigation_search { + button[type="submit"] { + background:image-url('/assets/search.png') transparent no-repeat center center; + } +} diff --git a/app/assets/stylesheets/responsive/_public_body_layout.scss b/app/assets/stylesheets/responsive/_public_body_layout.scss index 7a9637bc9..2afd67ffb 100644 --- a/app/assets/stylesheets/responsive/_public_body_layout.scss +++ b/app/assets/stylesheets/responsive/_public_body_layout.scss @@ -64,10 +64,4 @@ } -.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 748f6218b..79ee4764a 100644 --- a/app/assets/stylesheets/responsive/_public_body_style.scss +++ b/app/assets/stylesheets/responsive/_public_body_style.scss @@ -35,42 +35,9 @@ } -.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/_search_layout.scss b/app/assets/stylesheets/responsive/_search_layout.scss index 48dd0c6a7..93a94f951 100644 --- a/app/assets/stylesheets/responsive/_search_layout.scss +++ b/app/assets/stylesheets/responsive/_search_layout.scss @@ -57,3 +57,11 @@ #advanced-search-tips{ @include grid-column(12); } + +.list-filter-item { + .title { + display: inline; + font-size: 1em; + font-weight: normal; + } +} diff --git a/app/assets/stylesheets/responsive/_search_style.scss b/app/assets/stylesheets/responsive/_search_style.scss index dfd40fc67..94ec1cf88 100644 --- a/app/assets/stylesheets/responsive/_search_style.scss +++ b/app/assets/stylesheets/responsive/_search_style.scss @@ -51,4 +51,87 @@ input.use-datepicker[type=text] { } } +.list-filter-item { + ul { + list-style: none outside none; + margin: 0; + padding: 0; + } + li { + display: inline-block; + } +} + + +#list-filter { + margin-bottom: 3em; +} +#filter_requests_form label.title { + display: block; + width: auto; + margin-bottom: 0.3em; +} + +.filter-request-types { + display: block; + margin-bottom: 1em; + @include respond-min( 20em ){ + display: inline-block; + } + ul { + border: 1px solid #ccc; + border-radius: 3px; + width: 100%; + font-size: 0; + border-bottom: 0; + @include respond-min( 20em ){ + border-right: 0; + } + @include respond-min( 44em ){ + border-bottom: 1px solid #ccc; + } + } + li { + width: 100%; + @include respond-min( 20em ){ + width: 50%; + } + @include respond-min( 44em ){ + width: auto; + } + } + a, span { + width: 100%; + text-align: center; + display: block; + font-size: 14px; + padding: 0.5em 0.75em; + border-bottom: 1px solid #ccc; + text-decoration: none; + @include respond-min( 20em ){ + display: inline-block; + border-right: 1px solid #ccc; + border-bottom: 0; + &:nth-child(1), + &:nth-child(2) { + border-bottom: 1px solid #ccc; + } + } + + @include respond-min( 44em ){ + &:nth-child(n) { + border-bottom: 0; + } + } + } + span { + font-weight: bold; + background-color: #f4f4f4; + //older browsers will just see a flat background, new browsers will see an indent + -webkit-box-shadow: inset 0 2px 5px 1px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 2px 5px 1px rgba(0, 0, 0, 0.1); + -o-box-shadow: inset 0 2px 5px 1px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 2px 5px 1px rgba(0, 0, 0, 0.1); + } +} diff --git a/app/assets/stylesheets/responsive/_utils.scss b/app/assets/stylesheets/responsive/_utils.scss index 68884fa7a..e19201475 100644 --- a/app/assets/stylesheets/responsive/_utils.scss +++ b/app/assets/stylesheets/responsive/_utils.scss @@ -33,3 +33,18 @@ $lte-ie7: false !default; @content; } } + +// Hide content visually, but keep it available to screen readers +// source: http://a11yproject.com/posts/how-to-hide-content/ +.visually-hidden { + // http://developer.yahoo.com/blogs/ydn/posts/2012/10/clip-your-hidden-content-for-better-accessibility/ + position: absolute !important; + clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ + clip: rect(1px, 1px, 1px, 1px); + padding:0 !important; + border:0 !important; + height: 1px !important; + width: 1px !important; + overflow: hidden; +} +body:hover .visually-hidden a, body:hover .visually-hidden input, body:hover .visually-hidden button { display: none !important; } diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index cc3d0b64a..854e79a19 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -9,9 +9,17 @@ require 'confidence_intervals' require 'tempfile' class PublicBodyController < ApplicationController + + MAX_RESULTS = 500 # TODO: tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL def show long_cache + @page = get_search_page_from_params + requests_per_page = 25 + # Later pages are very expensive to load + if @page > MAX_RESULTS / requests_per_page + raise ActiveRecord::RecordNotFound.new("Sorry. No pages after #{MAX_RESULTS / requests_per_page}.") + end if MySociety::Format.simplify_url_part(params[:url_name], 'body') != params[:url_name] redirect_to :url_name => MySociety::Format.simplify_url_part(params[:url_name], 'body'), :status => :moved_permanently return @@ -45,7 +53,7 @@ class PublicBodyController < ApplicationController # TODO: really should just use SQL query here rather than Xapian. sortby = "described" begin - @xapian_requests = perform_search([InfoRequestEvent], query, sortby, 'request_collapse') + @xapian_requests = perform_search([InfoRequestEvent], query, sortby, 'request_collapse', requests_per_page) if (@page > 1) @page_desc = " (page " + @page.to_s + ")" else diff --git a/app/helpers/public_body_helper.rb b/app/helpers/public_body_helper.rb index 332e93284..57c90a9ba 100644 --- a/app/helpers/public_body_helper.rb +++ b/app/helpers/public_body_helper.rb @@ -38,12 +38,13 @@ module PublicBodyHelper # # Returns a string def type_of_authority(public_body) - types = public_body.tags.each_with_index.map do |tag, index| + first = true + types = public_body.tags.each.map do |tag| if PublicBodyCategory.get().by_tag().include?(tag.name) desc = PublicBodyCategory.get().singular_by_tag()[tag.name] - - if index.zero? + if first desc = desc.sub(/\S/) { |m| Unicode.upcase(m) } + first = false end link_to(desc, list_public_bodies_path(tag.name)) end diff --git a/app/views/general/_responsive_topnav.html.erb b/app/views/general/_responsive_topnav.html.erb index 0ece0da9a..cb8151467 100644 --- a/app/views/general/_responsive_topnav.html.erb +++ b/app/views/general/_responsive_topnav.html.erb @@ -21,11 +21,16 @@ </li> <li id="navigation_search"> - <form id="navigation_search_form" method="post" action="<%= search_redirect_path %>"> - <label for="navigation_search_button"> - <img src="/assets/search.png" alt="Search:"> + <form id="navigation_search_form" method="post" action="<%= search_redirect_path %>" role="search"> + <label class="visually-hidden" for="navigation_search_button"> + <%= _("Search") %> </label> - <%= text_field_tag 'query', params[:query], { :id => "navigation_search_button", :title => "type your search term here" } %> + <%= text_field_tag 'query', params[:query], { :id => "navigation_search_button", :type => "search", :placeholder => _("Search"), :title => _("type your search term here") } %> + <button type="submit"> + <span class="visually-hidden"> + <%= _("Submit Search") %> + </span> + </button> </form> </li> </ul> diff --git a/app/views/request/_request_filter_form.html.erb b/app/views/request/_request_filter_form.html.erb index 19961ddfc..549ddb32c 100644 --- a/app/views/request/_request_filter_form.html.erb +++ b/app/views/request/_request_filter_form.html.erb @@ -14,7 +14,7 @@ <%= link_to label, url_for(:controller => "request", :action => "list", :view => status) + "?" + request.query_string + '#results' %> <% end %> <% else %> - <%= label %> + <span><%= label %></span> <% end %> </li> <% end %> |