diff options
Diffstat (limited to 'app')
28 files changed, 432 insertions, 237 deletions
diff --git a/app/assets/images/next-step-facebook.png b/app/assets/images/next-step-facebook.png Binary files differnew file mode 100644 index 000000000..c01fa6ced --- /dev/null +++ b/app/assets/images/next-step-facebook.png diff --git a/app/assets/images/next-step-twitter.png b/app/assets/images/next-step-twitter.png Binary files differnew file mode 100644 index 000000000..e79255bd6 --- /dev/null +++ b/app/assets/images/next-step-twitter.png diff --git a/app/assets/stylesheets/responsive/_global_style.scss b/app/assets/stylesheets/responsive/_global_style.scss index af25fb0b0..ef755c01e 100644 --- a/app/assets/stylesheets/responsive/_global_style.scss +++ b/app/assets/stylesheets/responsive/_global_style.scss @@ -116,7 +116,7 @@ dt + dd { } /* Notices to the user (usually on action completion) */ -#notice, #error { +#notice, #error, .warning { font-size:1em; border-radius:3px; margin:1em 0; @@ -136,7 +136,7 @@ dt + dd { background-color: lighten(#62b356, 23%); } -#error { +#error, .warning { background-color: lighten(#b05460, 23%); } @@ -225,6 +225,11 @@ div.pagination { } +.pretitle { + margin-bottom: -0.5em; + color: #666; +} + /* Search result highlighting */ .highlight { background:#FF0; diff --git a/app/assets/stylesheets/responsive/_lists_layout.scss b/app/assets/stylesheets/responsive/_lists_layout.scss index 69237ae91..6a874e8fe 100644 --- a/app/assets/stylesheets/responsive/_lists_layout.scss +++ b/app/assets/stylesheets/responsive/_lists_layout.scss @@ -81,4 +81,8 @@ } } - +/* .make-request-quick-button displays in the typeahead search results in the 'make request' process */ +.make-request-quick-button { + margin-bottom: 1em; + margin-top: -0.5em; +} diff --git a/app/assets/stylesheets/responsive/_new_request_layout.scss b/app/assets/stylesheets/responsive/_new_request_layout.scss index a8b24e1b1..55c72b8e3 100644 --- a/app/assets/stylesheets/responsive/_new_request_layout.scss +++ b/app/assets/stylesheets/responsive/_new_request_layout.scss @@ -165,5 +165,40 @@ div.batch_public_body_toggle { } +/* Request sent page */ +.request-sent-message { + margin-top: 1em; + h1 { + margin-bottom: 1em; + } +} +.request-sent-message__row { + @include grid-row($behavior: nest); +} +.request-sent-message__column-1 { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:8); + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 36.813em; + } + } +} + +.request-sent-message__column-2 { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:4); + @include ie8{ + padding-left: 0.9375em; + } + @include lte-ie7 { + width: 17.438em; + } + } +} diff --git a/app/assets/stylesheets/responsive/_new_request_style.scss b/app/assets/stylesheets/responsive/_new_request_style.scss index 86e17cbfe..e07ecb55c 100644 --- a/app/assets/stylesheets/responsive/_new_request_style.scss +++ b/app/assets/stylesheets/responsive/_new_request_style.scss @@ -61,3 +61,32 @@ color: #0000EE; font-size: 0.9em; } + +/* Request sent page */ +.request-sent-message { + border-bottom: 1px solid #e9e9e9; + font-size: 1em; + h1 { + } +} + +.request-sent-message__column-1 { + h2 { + font-size: 1em; + } +} + +.what-next { + background-color: #e6e8d6; + background-color: rgba(255,255,255, 0.4); + padding: 0.5em 1.5em 1.5em; + margin-bottom: 1.5em; +} + +.what-next__list { + list-style: none outside none; + padding-left: 0; + li { + margin-bottom: 0.5em; + } +} diff --git a/app/assets/stylesheets/responsive/_signin_layout.scss b/app/assets/stylesheets/responsive/_signin_layout.scss index 44999d31b..5a0e0057f 100644 --- a/app/assets/stylesheets/responsive/_signin_layout.scss +++ b/app/assets/stylesheets/responsive/_signin_layout.scss @@ -6,7 +6,7 @@ #left_half { @include grid-column(12); @include respond-min( $main_menu-mobile_menu_cutoff ){ - @include grid-column($columns:5,$float:left); + @include grid-column($columns:7,$float:left); @include ie8{ padding-right: 0.9375em; } @@ -19,7 +19,7 @@ #right_half { @include grid-column(12); @include respond-min( $main_menu-mobile_menu_cutoff ){ - @include grid-column($columns:5,$float:right); + @include grid-column($columns:4,$float:right); @include ie8{ padding-left: 0.9375em; } @@ -29,20 +29,6 @@ } } -#middle_strip { - @include grid-column(12); - @include respond-min( $main_menu-mobile_menu_cutoff ){ - @include grid-column($columns:2,$float:left); - @include ie8{ - padding-left: 0.9375em; - padding-right: 0.9375em; - } - @include lte-ie7 { - width: 7.438em; - } - } -} - #sign_together{ @include grid-row($behavior: nest); } diff --git a/app/assets/stylesheets/responsive/_signin_style.scss b/app/assets/stylesheets/responsive/_signin_style.scss index 2bd2802b4..918392365 100644 --- a/app/assets/stylesheets/responsive/_signin_style.scss +++ b/app/assets/stylesheets/responsive/_signin_style.scss @@ -15,14 +15,19 @@ font-size:1.2em; } -p#sign_in_reason, p#superuser_message { +#sign_in_reason, #superuser_message { font-size:2em; font-weight:bold; line-height:1em; } -p#superuser_message { +#superuser_message { font-size:1.2em; } - +.sign-in-wrapper { + margin-top: 1.5em; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + margin-top: 0; + } +} diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb index cfb6f240d..d188f109d 100644 --- a/app/controllers/admin_public_body_controller.rb +++ b/app/controllers/admin_public_body_controller.rb @@ -23,6 +23,11 @@ class AdminPublicBodyController < AdminController def new @public_body = PublicBody.new + + I18n.available_locales.each do |locale| + @public_body.translations.build(:locale => locale) + end + if params[:change_request_id] @change_request = PublicBodyChangeRequest.find(params[:change_request_id]) end @@ -60,6 +65,11 @@ class AdminPublicBodyController < AdminController def edit @public_body = PublicBody.find(params[:id]) + + I18n.available_locales.each do |locale| + @public_body.translations.find_or_initialize_by_locale(locale) + end + if params[:change_request_id] @change_request = PublicBodyChangeRequest.find(params[:change_request_id]) end diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 2c8abbaf4..438bbfd3f 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -9,6 +9,8 @@ require 'open-uri' class GeneralController < ApplicationController + MAX_RESULTS = 500 + # New, improved front page! def frontpage medium_cache @@ -124,38 +126,45 @@ class GeneralController < ApplicationController end end + @page = get_search_page_from_params + # Query each type separately for separate display (TODO: we are calling # perform_search multiple times and it clobbers per_page for each one, # so set as separate var) requests_per_page = params[:requests_per_page] ? params[:requests_per_page].to_i : 25 - @this_page_hits = @total_hits = @xapian_requests_hits = @xapian_bodies_hits = @xapian_users_hits = 0 + # 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 + + @total_hits = @xapian_requests_hits = @xapian_bodies_hits = @xapian_users_hits = 0 if @requests @xapian_requests = perform_search([InfoRequestEvent], @query, @sortby, 'request_collapse', requests_per_page) @requests_per_page = @per_page - @this_page_hits += @xapian_requests.results.size @xapian_requests_hits = @xapian_requests.results.size @xapian_requests_total_hits = @xapian_requests.matches_estimated @total_hits += @xapian_requests.matches_estimated @request_for_spelling = @xapian_requests + @max_requests = (@xapian_requests.matches_estimated > MAX_RESULTS) ? MAX_RESULTS : @xapian_requests.matches_estimated end if @bodies @xapian_bodies = perform_search([PublicBody], @query, @sortby, nil, 5) @bodies_per_page = @per_page - @this_page_hits += @xapian_bodies.results.size @xapian_bodies_hits = @xapian_bodies.results.size @xapian_bodies_total_hits = @xapian_bodies.matches_estimated @total_hits += @xapian_bodies.matches_estimated @request_for_spelling = @xapian_bodies + @max_bodies = (@xapian_bodies.matches_estimated > MAX_RESULTS) ? MAX_RESULTS : @xapian_bodies.matches_estimated end if @users @xapian_users = perform_search([User], @query, @sortby, nil, 5) @users_per_page = @per_page - @this_page_hits += @xapian_users.results.size @xapian_users_hits = @xapian_users.results.size @xapian_users_total_hits = @xapian_users.matches_estimated @total_hits += @xapian_users.matches_estimated @request_for_spelling = @xapian_users + @max_users = (@xapian_users.matches_estimated > MAX_RESULTS) ? MAX_RESULTS : @xapian_users.matches_estimated end # Spelling and highight words are same for all three queries diff --git a/app/helpers/public_body_helper.rb b/app/helpers/public_body_helper.rb new file mode 100644 index 000000000..d8a5d57b5 --- /dev/null +++ b/app/helpers/public_body_helper.rb @@ -0,0 +1,35 @@ +module PublicBodyHelper + + # Public: The reasons a request can't be made to a PublicBody + # The returned reasons are ordered by priority. For example, if the body no + # longer exists there is no reason to ask for its contact details if we don't + # have an email for it. + # + # public_body - Instance of a PublicBody + # + # Returns an Array + def public_body_not_requestable_reasons(public_body) + reasons = [] + + if public_body.defunct? + reasons.push _('This authority no longer exists, so you cannot make a request to it.') + end + + if public_body.not_apply? + reasons.push _('Freedom of Information law does not apply to this authority, so you cannot make a request to it.') + end + + unless public_body.has_request_email? + # Make the authority appear requestable to encourage users to help find + # the authroty'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" + + reasons.push(msg) + end + + reasons.compact + end + +end diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 8d455e488..814057ef4 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -748,7 +748,6 @@ public # This is a long stop - even with UK public interest test extensions, 40 # days is a very long time. def date_very_overdue_after - last_sent = last_event_forming_initial_request if self.public_body.is_school? # schools have 60 working days maximum (even over a long holiday) Holiday.due_date_from(self.date_initial_request_last_sent_at, AlaveteliConfiguration::special_reply_very_late_after_days, AlaveteliConfiguration::working_or_calendar_days) diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 6c2e0d04b..c023b436c 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -64,6 +64,7 @@ class PublicBody < ActiveRecord::Base } translates :name, :short_name, :request_email, :url_name, :notes, :first_letter, :publication_scheme + accepts_nested_attributes_for :translations # Default fields available for importing from CSV, in the format # [field_name, 'short description of field (basic html allowed)'] @@ -151,12 +152,11 @@ class PublicBody < ActiveRecord::Base translations end - def translated_versions=(translation_attrs) + def translations_attributes=(translation_attrs) def empty_translation?(attrs) - attrs_with_values = attrs.select{ |key, value| value != '' and key != 'locale' } + attrs_with_values = attrs.select{ |key, value| value != '' and key.to_s != 'locale' } attrs_with_values.empty? end - if translation_attrs.respond_to? :each_value # Hash => updating translation_attrs.each_value do |attrs| next if empty_translation?(attrs) @@ -166,6 +166,13 @@ class PublicBody < ActiveRecord::Base t.save! end else # Array => creating + warn "[DEPRECATION] PublicBody#translations_attributes= " \ + "will no longer accept an Array as of release 0.22. " \ + "Use Hash arguments instead. See " \ + "spec/models/public_body_spec.rb and " \ + "app/views/admin_public_body/_form.html.erb for more " \ + "details." + translation_attrs.each do |attrs| next if empty_translation?(attrs) new_translation = PublicBody::Translation.new(attrs) @@ -175,6 +182,12 @@ class PublicBody < ActiveRecord::Base end end + def translated_versions=(translation_attrs) + warn "[DEPRECATION] PublicBody#translated_versions= will be replaced " \ + "by PublicBody#translations_attributes= as of release 0.22" + self.translations_attributes = translation_attrs + end + def set_default_publication_scheme # Make sure publication_scheme gets the correct default value. # (This would work automatically, were publication_scheme not a translated attribute) @@ -222,39 +235,38 @@ class PublicBody < ActiveRecord::Base return self.has_tag?('defunct') end - # Can an FOI (etc.) request be made to this body, and if not why not? + # Can an FOI (etc.) request be made to this body? def is_requestable? - if self.defunct? - return false - end - if self.not_apply? - return false - end - if self.request_email.nil? - return false - end - return !self.request_email.empty? && self.request_email != 'blank' + has_request_email? && !defunct? && !not_apply? end + # Strict superset of is_requestable? def is_followupable? - if self.request_email.nil? - return false - end - return !self.request_email.empty? && self.request_email != 'blank' + has_request_email? + end + + def has_request_email? + !request_email.blank? && request_email != 'blank' end + # Also used as not_followable_reason def not_requestable_reason if self.defunct? return 'defunct' elsif self.not_apply? return 'not_apply' - elsif self.request_email.nil? or self.request_email.empty? or self.request_email == 'blank' + elsif !has_request_email? return 'bad_contact' else - raise "requestable_failure_reason called with type that has no reason" + raise "not_requestable_reason called with type that has no reason" end end + def special_not_requestable_reason? + self.defunct? || self.not_apply? + end + + class Version def last_edit_comment_for_html_display @@ -336,33 +348,29 @@ class PublicBody < ActiveRecord::Base # Use tags to describe what type of thing this is def type_of_authority(html = false) - types = [] - first = true - for tag in self.tags + types = tags.each_with_index.map do |tag, index| if PublicBodyCategory.get().by_tag().include?(tag.name) desc = PublicBodyCategory.get().singular_by_tag()[tag.name] - if first - # terrible that Ruby/Rails doesn't have an equivalent of ucfirst - # (capitalize shockingly converts later characters to lowercase) - desc = desc[0,1].capitalize + desc[1,desc.size] - first = false + + if index.zero? + desc = desc.sub(/\S/) { |m| Unicode.upcase(m) } end + if html # TODO: this should call proper route helpers, but is in model sigh desc = '<a href="/body/list/' + tag.name + '">' + desc + '</a>' end - types.push(desc) + + desc end end - if types.size > 0 - ret = types[0, types.size - 1].join(", ") - if types.size > 1 - ret = ret + " and " - end - ret = ret + types[-1] - return ret.html_safe + + types.compact! + + if types.any? + types.to_sentence(:last_word_connector => ' and ').html_safe else - return _("A public authority") + _("A public authority") end end diff --git a/app/views/admin_public_body/_form.html.erb b/app/views/admin_public_body/_form.html.erb index 2da13ab01..c765c116e 100644 --- a/app/views/admin_public_body/_form.html.erb +++ b/app/views/admin_public_body/_form.html.erb @@ -4,66 +4,27 @@ <div id="div-locales"> <ul class="locales nav nav-tabs"> - <% I18n.available_locales.each_with_index do |locale, i| %> - <li><a href="#div-locale-<%=locale.to_s%>" data-toggle="tab" ><%=locale_name(locale.to_s) || _("Default locale")%></a></li> - <% end %> + <% @public_body.translations.each do |translation| %> + <li> + <a href="#div-locale-<%= translation.locale.to_s %>" data-toggle="tab"> + <%= locale_name(translation.locale.to_s) || _("Default locale") %> + </a> + </li> + <% end %> </ul> + <div class="tab-content"> -<% - for locale in I18n.available_locales do - if locale==I18n.default_locale # The default locale is submitted as part of the bigger object... - prefix = 'public_body' - object = @public_body - else # ...but additional locales go "on the side" - prefix = "public_body[translated_versions][]" - object = @public_body.new_record? ? - PublicBody::Translation.new : - @public_body.find_translation_by_locale(locale.to_s) || PublicBody::Translation.new - end -%> - <%= fields_for prefix, object do |t| %> - <div class="tab-pane" id="div-locale-<%=locale.to_s%>"> - <div class="control-group"> - <%= t.hidden_field :locale, :value => locale.to_s %> - <label for="<%= form_tag_id(t.object_name, :name, locale) %>" class="control-label">Name</label> - <div class="controls"> - <%= t.text_field :name, :id => form_tag_id(t.object_name, :name, locale), :class => "span4" %> - </div> - </div> - <div class="control-group"> - <label for="<%= form_tag_id(t.object_name, :short_name, locale) %>", class="control-label"><%=_("Short name")%></label> - <div class="controls"> - <%= t.text_field :short_name, :id => form_tag_id(t.object_name, :short_name, locale), :class => "span2" %> - <p class="help-block"><%=_("Only put in abbreviations which are really used, otherwise leave blank. Short or long name is used in the URL – don't worry about breaking URLs through renaming, as the history is used to redirect")%></p> - </div> - </div> - <div class="control-group"> - <label for="<%= form_tag_id(t.object_name, :request_email, locale) %>" class="control-label"><%=_("Request email")%></label> - <div class="controls"> - <%= t.text_field :request_email, :id => form_tag_id(t.object_name, :request_email, locale), :class => "span3" %> - <p class="help-block"><%=_("set to <strong>blank</strong> (empty string) if can't find an address; these emails are <strong>public</strong> as anyone can view with a CAPTCHA")%></p> - </div> - </div> - <div class="control-group"> - <label for="<%= form_tag_id(t.object_name, :publication_scheme, locale) %>" class="control-label"><%=_("Publication scheme URL")%></label> - <div class="controls"> - <%= t.text_field :publication_scheme, :size => 60, :id => form_tag_id(t.object_name, :publication_scheme, locale), :class => "span3" %> - </div> - </div> - <div class="control-group"> - <label for="<%= form_tag_id(t.object_name, :notes, locale) %>" class="control-label"><%=_("Public notes")%></label> - <div class="controls"> - <%= t.text_area :notes, :rows => 3, :id => form_tag_id(t.object_name, :notes, locale), :class => "span6" %> - <p class="help-block"> - HTML, for users to consider when making FOI requests to the authority - </p> - </div> - </div> - </div> -<% - end - end -%> + <% @public_body.translations.each do |translation| %> + <% if translation.locale.to_s == I18n.default_locale.to_s %> + <%= fields_for('public_body', @public_body) do |t| %> + <%= render :partial => 'locale_fields', :locals => { :t => t, :locale => translation.locale } %> + <% end %> + <% else %> + <%= f.fields_for(:translations, translation, :child_index => translation.locale) do |t| %> + <%= render :partial => 'locale_fields' , :locals => { :t => t, :locale => translation.locale } %> + <% end %> + <% end %> + <% end %> </div> </div> diff --git a/app/views/admin_public_body/_locale_fields.html.erb b/app/views/admin_public_body/_locale_fields.html.erb new file mode 100644 index 000000000..cbe008fe2 --- /dev/null +++ b/app/views/admin_public_body/_locale_fields.html.erb @@ -0,0 +1,49 @@ + +<div class="tab-pane" id="div-locale-<%=locale.to_s%>"> + <div class="control-group"> + <%= t.hidden_field :locale, :value => locale.to_s %> + <label for="<%= form_tag_id(t.object_name, :name, locale) %>" class="control-label">Name</label> + <div class="controls"> + <%= t.text_field :name, :id => form_tag_id(t.object_name, :name, locale), :class => "span4" %> + </div> + </div> + + <div class="control-group"> + <label for="<%= form_tag_id(t.object_name, :short_name, locale) %>" class="control-label"><%=_("Short name")%></label> + <div class="controls"> + <%= t.text_field :short_name, :id => form_tag_id(t.object_name, :short_name, locale), :class => "span2" %> + <p class="help-block"> + <%=_("Only put in abbreviations which are really used, otherwise leave blank. Short or long name is used in the URL – don't worry about breaking URLs through renaming, as the history is used to redirect")%> + </p> + </div> + </div> + + <div class="control-group"> + <label for="<%= form_tag_id(t.object_name, :request_email, locale) %>" class="control-label"><%=_("Request email")%></label> + <div class="controls"> + <%= t.text_field :request_email, :id => form_tag_id(t.object_name, :request_email, locale), :class => "span3" %> + <p class="help-block"> + <%=_("set to <strong>blank</strong> (empty string) if can't find an address; these emails are <strong>public</strong> as anyone can view with a CAPTCHA")%> + </p> + </div> + </div> + + <div class="control-group"> + <label for="<%= form_tag_id(t.object_name, :publication_scheme, locale) %>" class="control-label"><%=_("Publication scheme URL")%></label> + <div class="controls"> + <%= t.text_field :publication_scheme, :size => 60, :id => form_tag_id(t.object_name, :publication_scheme, locale), :class => "span3" %> + </div> + </div> + + <div class="control-group"> + <label for="<%= form_tag_id(t.object_name, :notes, locale) %>" class="control-label"><%=_("Public notes")%></label> + <div class="controls"> + <%= t.text_area :notes, :rows => 3, :id => form_tag_id(t.object_name, :notes, locale), :class => "span6" %> + <p class="help-block"> + HTML, for users to consider when making FOI requests to the authority + </p> + </div> + </div> + +</div> + diff --git a/app/views/admin_public_body/import_csv.html.erb b/app/views/admin_public_body/import_csv.html.erb index 4b14226d1..4b481e895 100644 --- a/app/views/admin_public_body/import_csv.html.erb +++ b/app/views/admin_public_body/import_csv.html.erb @@ -70,16 +70,25 @@ Another One,another@example.com,Otro organismo,a_tag "Add new tags to existing ones". </p> - <p><%= submit_tag 'Dry run' %> <%= submit_tag 'Upload' %></p> + <div class="form-actions"> + <p> + <%= submit_tag 'Dry run', :class => 'btn btn-success' %> + <%= submit_tag 'Upload', :class => 'btn btn-warning' %> + </p> + </div> <% end %> <hr> -<p>Standard tags: - <% for category, description in PublicBodyCategory.get().by_tag() %> - <% if category != "other" %> - <strong><%= category %></strong>=<%= description %>; - <% end %> +<div id="standard-tags"> + <h2>Standard tags:</h2> + + <ul> + <% PublicBodyCategory.get().by_tag().each do |category, description| %> + <% if category != "other" %> + <li><strong><%= category %></strong>=<%= description %></li> + <% end %> <% end %> - </p> + </ul> +</div> diff --git a/app/views/general/search.html.erb b/app/views/general/search.html.erb index 96c91b791..c5ff8e9fd 100644 --- a/app/views/general/search.html.erb +++ b/app/views/general/search.html.erb @@ -1,7 +1,5 @@ <% @show_tips = @xapian_requests.nil? || (@total_hits == 0) %> -<% @include_request_link_in_authority_listing = true %> - <%= render :partial => 'localised_datepicker' %> <% if @query.nil? %> @@ -157,11 +155,13 @@ <div class="results_block"> <% for result in @xapian_bodies.results %> - <%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %> + <%= render :partial => 'public_body/body_listing_single', + :locals => { :public_body => result[:model], + :request_link => true } %> <% end %> </div> - <%= will_paginate WillPaginate::Collection.new(@page, @bodies_per_page, @xapian_bodies.matches_estimated) %> + <%= will_paginate WillPaginate::Collection.new(@page, @bodies_per_page, @max_bodies) %> </div> <% elsif @variety_postfix == 'bodies' %> <p><%= raw(_('<a href="{{browse_url}}">Browse all</a> or <a href="{{add_url}}">ask us to add one</a>.', :browse_url => list_public_bodies_default_path.html_safe, :add_url => (help_requesting_path + '#missing_body').html_safe)) %></p> @@ -180,7 +180,7 @@ <%= render :partial => 'user/user_listing_single', :locals => { :display_user => result[:model] } %> <% end %> </div> - <%= will_paginate WillPaginate::Collection.new(@page, @users_per_page, @xapian_users.matches_estimated) %> + <%= will_paginate WillPaginate::Collection.new(@page, @users_per_page, @max_users) %> </div> <% end %> @@ -200,7 +200,7 @@ <% end %> </div> - <%= will_paginate WillPaginate::Collection.new(@page, @requests_per_page, @xapian_requests.matches_estimated) %> + <%= will_paginate WillPaginate::Collection.new(@page, @requests_per_page, @max_requests) %> </div> <% end %> <% end %> diff --git a/app/views/public_body/_body_listing_single.html.erb b/app/views/public_body/_body_listing_single.html.erb index 91a07d09c..b343c20e1 100644 --- a/app/views/public_body/_body_listing_single.html.erb +++ b/app/views/public_body/_body_listing_single.html.erb @@ -1,6 +1,10 @@ -<% if @highlight_words.nil? - @highlight_words = [] - end %> +<% + if @highlight_words.nil? + @highlight_words = [] + end + + request_link = false unless defined?(request_link) +%> <div class="body_listing"> <span class="head"> @@ -16,23 +20,28 @@ <% end %> <br> <% end %> - </span> + </span> <span class="bottomline"> <%= n_('{{count}} request made.', '{{count}} requests made.', public_body.info_requests.size, :count => public_body.info_requests.size) %> - <% if !public_body.is_requestable? && public_body.not_requestable_reason != 'bad_contact' %> - <% if public_body.not_requestable_reason == 'defunct' %> - <%= _('Defunct.') %> - <% end %> - <% else %> - <% if !@include_request_link_in_authority_listing.nil? %> - <%= link_to _("Make your own request"), public_body_path(public_body) %>. - <% end %> - <% end %> <br> <span class="date_added"> <%= _("Added on {{date}}", :date => simple_date(public_body.created_at)) %>. </span> + <br> + <% if public_body.special_not_requestable_reason? %> + <% if public_body.not_requestable_reason == 'not_apply' %> + <%= _('FOI law does not apply to this authority.')%> + <% elsif public_body.not_requestable_reason == 'defunct' %> + <%= _('Defunct.')%> + <% end %> + <% end %> </span> + + <% if request_link && !public_body.special_not_requestable_reason? %> + <div class="make-request-quick-button"> + <%= link_to _("Make a request"), new_request_to_body_path(:url_name => public_body.url_name), :class => "link_button_green" %> + </div> + <% end %> </div> diff --git a/app/views/public_body/_search_ahead.html.erb b/app/views/public_body/_search_ahead.html.erb index b5632bccd..b06ed5efa 100644 --- a/app/views/public_body/_search_ahead.html.erb +++ b/app/views/public_body/_search_ahead.html.erb @@ -7,7 +7,9 @@ <% 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] } %> + <%= 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"} %> diff --git a/app/views/public_body/show.html.erb b/app/views/public_body/show.html.erb index 403216c6c..e7c5fa2b6 100644 --- a/app/views/public_body/show.html.erb +++ b/app/views/public_body/show.html.erb @@ -39,36 +39,22 @@ <% end %> </p> - <% 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 %> - <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? %> + <%= @public_body.notes_as_html.html_safe %> + <% 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><%= _('You can only request information about the environment from this authority.')%></p> <% 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> </div> diff --git a/app/views/public_body/view_email.html.erb b/app/views/public_body/view_email.html.erb index 5f4bc95f4..399caaa61 100644 --- a/app/views/public_body/view_email.html.erb +++ b/app/views/public_body/view_email.html.erb @@ -24,7 +24,7 @@ </p> <p> - <% if @public_body.is_requestable? || @public_body.not_requestable_reason != 'bad_contact' %> + <% if @public_body.has_request_email? %> <%= raw(_('If the address is wrong, or you know a better address, please <a href="{{url}}">contact us</a>.', :url => help_contact_path.html_safe)) %> <% else %> <%= raw(_(' If you know the address to use, then please <a href="{{url}}">send it to us</a>. diff --git a/app/views/request/_request_sent.html.erb b/app/views/request/_request_sent.html.erb index 5ce6f5317..3525ba2be 100644 --- a/app/views/request/_request_sent.html.erb +++ b/app/views/request/_request_sent.html.erb @@ -1,19 +1,62 @@ -<div id="notice"> - <p> - <%= _("Your {{law_used_full}} request has been <strong>sent on its way</strong>!", - :law_used_full => @info_request.law_used_full) %> - </p> +<div id="content"> + <div class="request-sent-message" id="notice"> + <h1> + <%= _("Your {{law_used_full}} request has been sent", + :law_used_full => @info_request.law_used_full) %> + </h1> + <div class="request-sent-message__row"> + <div class="request-sent-message__column-1"> + <p class="subtitle"> + <%= _("<strong>We will email you</strong> when there is a response, or after " \ + "{{late_number_of_days}} working days if the authority still hasn't " \ + "replied by then.", + :late_number_of_days => AlaveteliConfiguration.reply_late_after_days) %> + </p> - <p> - <%= _("<strong>We will email you</strong> when there is a response, or after " \ - "{{late_number_of_days}} working days if the authority still hasn't " \ - "replied by then.", - :late_number_of_days => AlaveteliConfiguration.reply_late_after_days) %> - </p> + <h2><%= _("Share your request") %></h2> - <p> - <%= _("If you write about this request (for example in a forum or a blog) " \ - "please link to this page, and add an annotation below telling people " \ - "about your writing.") %> - </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.title }'", + :related => _('alaveteli_foi:The software that runs {{site_name}}', :site_name => site_name) + }.to_query %> + + <%= 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 %> + + <h2><%= _("Keep your request up to date") %></h2> + <p> + <%= _('If you write about this request ' \ + '(for example in a forum or a blog) ' \ + 'please link to this page, and <a href="{{url}}">add an ' \ + 'annotation</a> below telling people ' \ + 'about your writing.', :url => new_comment_url(:url_title => @info_request.url_title).html_safe) %> + </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 _("View other requests to {{public_body}}", :public_body => @info_request.public_body.name), public_body_path(@info_request.public_body) %> + </li> + <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/request/followup_bad.html.erb b/app/views/request/followup_bad.html.erb index ea2400c5d..38a7549b2 100644 --- a/app/views/request/followup_bad.html.erb +++ b/app/views/request/followup_bad.html.erb @@ -1,32 +1,31 @@ <% if @incoming_message.nil? || !@incoming_message.valid_to_reply_to? %> - <% @title = _("Unable to send follow up message to {{username}}",:username=>OutgoingMailer.name_for_followup(@info_request, nil)) %> + <% @title = _("Unable to send follow up message to {{username}}", :username => OutgoingMailer.name_for_followup(@info_request, nil)) %> <% else %> - <% @title = _("Unable to send a reply to {{username}}",:username=>OutgoingMailer.name_for_followup(@info_request, @incoming_message)) %> + <% @title = _("Unable to send a reply to {{username}}", :username => OutgoingMailer.name_for_followup(@info_request, @incoming_message)) %> <% end %> -<h1><%=@title%></h1> +<h1><%= @title %></h1> <% if @reason == 'not_apply' %> <!-- we should never get here, but just in case give a sensible message --> - <p><%= _('Freedom of Information law no longer applies to') %> <%=h @info_request.public_body.name %>. + <p><%= _('Freedom of Information law no longer applies to {{public_body_name}}.', :public_body_name => @info_request.public_body.name) %> <%= _('From the request page, try replying to a particular message, rather than sending a general followup. If you need to make a general followup, and know an email which will go to the right place, please <a href="{{url}}">send it to us</a>.', :url => help_contact_path.html_safe) %> </p> <% elsif @reason == 'defunct' %> <!-- we should never get here, but just in case give a sensible message --> - <p><%=h @info_request.public_body.name %> <%= _('no longer exists. If you are trying to make - From the request page, try replying to a particular message, rather than sending + <p><%= _('{{public_body_name}} no longer exists. From the request page, try replying to a particular message, rather than sending a general followup. If you need to make a general followup, and know - an email which will go to the right place, please <a href="{{url}}">send it to us</a>.', :url => help_contact_path.html_safe) %> + an email which will go to the right place, please <a href="{{url}}">send it to us</a>.', :url => help_contact_path.html_safe, :public_body_name => @info_request.public_body.name) %> </p> <% elsif @reason == 'bad_contact' %> - <p><%= _('We do not have a working {{law_used_full}} address for {{public_body_name}}.',:law_used_full=>h(@info_request.law_used_full),:public_body_name=>h(@info_request.public_body.name)) %> <%= _('You may be able to find + <p><%= _('We do not have a working {{law_used_full}} address for {{public_body_name}}.', :law_used_full => @info_request.law_used_full, :public_body_name => @info_request.public_body.name) %> <%= _('You may be able to find one on their website, or by phoning them up and asking. If you manage to find one, then please <a href="{{url}}">send it to us</a>.', :url => help_contact_path.html_safe) %> </p> <% elsif @reason == 'external' %> - <p><%= _("Followups cannot be sent for this request, as it was made externally, and published here by {{public_body_name}} on the requester's behalf.", :public_body_name => h(@info_request.public_body.name)) %> + <p><%= _("Followups cannot be sent for this request, as it was made externally, and published here by {{public_body_name}} on the requester's behalf.", :public_body_name => @info_request.public_body.name) %> </p> <% else %> <% raise _("unknown reason ") + @reason %> diff --git a/app/views/request/new.html.erb b/app/views/request/new.html.erb index 51224129e..688d9e87b 100644 --- a/app/views/request/new.html.erb +++ b/app/views/request/new.html.erb @@ -99,6 +99,12 @@ </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> diff --git a/app/views/request/select_authority.html.erb b/app/views/request/select_authority.html.erb index 134648264..9a5d565b6 100644 --- a/app/views/request/select_authority.html.erb +++ b/app/views/request/select_authority.html.erb @@ -18,9 +18,12 @@ <%= form_tag select_authority_path, { :id => 'search_form', :method => 'get' } do %> <div> <p> - <%= _(%Q(First, type in the <strong>name of the UK public authority</strong> you'd - like information from. <strong>By law, they have to respond</strong> - (<a href="{{url}}">why?</a>).), :url => (help_about_path(:anchor => 'whybother_them')).html_safe) %> + <%= _(%Q(First, type in the <strong>name of the public authority</strong> you'd + like information from.)) %> + <% if AlaveteliConfiguration.authority_must_respond %> + <%= _(%Q(<strong>By law, they have to respond</strong> (<a href="{{url}}">why?</a>).), + :url => (help_about_path(:anchor => 'whybother_them')).html_safe) %> + <% end %> </p> <%= text_field_tag :query, diff --git a/app/views/user/_signin.html.erb b/app/views/user/_signin.html.erb index e86791aaf..f63c289df 100644 --- a/app/views/user/_signin.html.erb +++ b/app/views/user/_signin.html.erb @@ -9,27 +9,30 @@ <p> <label class="form_label" for="user_signin_email"><%= _('Your e-mail:')%></label> - <%= text_field 'user_signin', 'email', { :size => 20, :tabindex => 10 } %> + <%= text_field 'user_signin', 'email', { :size => 20, :tabindex => 60 } %> </p> <p> <label class="form_label" for="user_signin_password"><%= _('Password:')%></label> - <%= password_field 'user_signin', 'password', { :size => 15, :tabindex => 20, :autocomplete => 'off' } %> + <%= password_field 'user_signin', 'password', { :size => 15, :tabindex => 70, :autocomplete => 'off' } %> </p> <p class="form_note"> - <%= link_to _('Forgotten your password?'), signchangepassword_path(:pretoken => h(params[:token])), :tabindex => 30 %> + <%= link_to _('Forgotten your password?'), signchangepassword_path(:pretoken => h(params[:token])), :tabindex => 80 %> </p> <p class="form_checkbox"> - <%= check_box_tag 'remember_me', "1", false, :tabindex => 40 %> - <label for="remember_me"><%= _('Remember me</label> (keeps you signed in longer; - do not use on a public computer) ')%></p> + <%= check_box_tag 'remember_me', "1", false, :tabindex => 90 %> + + <label for="remember_me"> + <%= _('Remember me (keeps you signed in longer; do not use on a public computer)') %> + </label> + </p> <div class="form_button"> <%= hidden_field_tag 'token', params[:token], {:id => 'signin_token' } %> <%= hidden_field_tag :modal, params[:modal], {:id => 'signin_modal' } %> - <%= submit_tag _('Sign in'), :tabindex => 50 %> + <%= submit_tag _('Sign in'), :tabindex => 100 %> </div> <% end %> diff --git a/app/views/user/_signup.html.erb b/app/views/user/_signup.html.erb index ec6541881..801d2abe0 100644 --- a/app/views/user/_signup.html.erb +++ b/app/views/user/_signup.html.erb @@ -5,35 +5,36 @@ <!--<h2><%= _('If you\'re new to {{site_name}}', :site_name=>site_name)%></h2>--> + + <p> - <label class="form_label" for="user_signup_email"><%= _('Your e-mail:')%></label> - <%= text_field 'user_signup', 'email', { :size => 20, :tabindex => 60 } %> + <label class="form_label" for="user_signup_name"> <%= _('Your name:')%></label> + <%= text_field 'user_signup', 'name', { :size => 20, :tabindex => 10, :autocomplete => "off" } %> </p> <div class="form_item_note"> - <%= _('We will not reveal your email address to anybody unless you or - the law tell us to (<a href="{{url}}">details</a>). ', :url => help_privacy_path) %> + <%= _('Your <strong>name will appear publicly</strong> + (<a href="{{why_url}}">why?</a>) + on this website and in search engines. + <a href="{{help_url}}">Thinking of using a pseudonym?</a>', :why_url => (help_privacy_path+"#public_request").html_safe, :help_url => (help_privacy_path+"#real_name").html_safe) %> </div> <p> - <label class="form_label" for="user_signup_name"> <%= _('Your name:')%></label> - <%= text_field 'user_signup', 'name', { :size => 20, :tabindex => 70, :autocomplete => "off" } %> + <label class="form_label" for="user_signup_email"><%= _('Your e-mail:')%></label> + <%= text_field 'user_signup', 'email', { :size => 20, :tabindex => 20 } %> </p> <div class="form_item_note"> - <%= _('Your <strong>name will appear publicly</strong> - (<a href="{{why_url}}">why?</a>) - on this website and in search engines. If you - are thinking of using a pseudonym, please - <a href="{{help_url}}">read this first</a>.', :why_url => (help_privacy_path+"#public_request").html_safe, :help_url => (help_privacy_path+"#real_name").html_safe) %> + <%= _('We will not reveal your email address to anybody unless <a href="{{url}}">you or + the law tell us to</a>. ', :url => help_privacy_path) %> </div> <p> <label class="form_label" for="user_signup_password"> <%= _('Password:')%></label> - <%= password_field 'user_signup', 'password', { :size => 15, :tabindex => 80, :autocomplete => "off" } %> + <%= password_field 'user_signup', 'password', { :size => 15, :tabindex => 30, :autocomplete => "off" } %> </p> <p> - <label class="form_label" for="user_signup_password_confirmation"> <%= _('Password: (again)')%></label> - <%= password_field 'user_signup', 'password_confirmation', { :size => 15, :tabindex => 90, :autocomplete => "off" } %> + <label class="form_label" for="user_signup_password_confirmation"> <%= _('Confirm password:')%></label> + <%= password_field 'user_signup', 'password_confirmation', { :size => 15, :tabindex => 40, :autocomplete => "off" } %> </p> <% if @request_from_foreign_country %> @@ -43,7 +44,7 @@ <div class="form_button"> <%= hidden_field_tag 'token', params[:token], {:id => 'signup_token' } %> <%= hidden_field_tag :modal, params[:modal], {:id => 'signup_modal' } %> - <%= submit_tag _('Sign up'), :tabindex => 100 %> + <%= submit_tag _('Sign up'), :tabindex => 50 %> </div> <% end %> diff --git a/app/views/user/sign.html.erb b/app/views/user/sign.html.erb index 5536e6c73..394c42a47 100644 --- a/app/views/user/sign.html.erb +++ b/app/views/user/sign.html.erb @@ -24,26 +24,25 @@ <div id="sign_together"> <% if !@post_redirect.nil? %> - <p id="sign_in_reason"> + <h1 id="sign_in_reason"> <% if @post_redirect.reason_params[:web].empty? %> - <%= _('Please sign in or make a new account.') %> + <%= _('Please create an account or sign in') %> <% else %> - <%= _('{{reason}}, please sign in or make a new account.', :reason => @post_redirect.reason_params[:web]) %> + <%= _('{{reason}}, create an account or sign in', :reason => @post_redirect.reason_params[:web]) %> <% end %> - </p> + </h1> <% end %> <div id="left_half"> - <h1><%= _('Sign up') %></h1> + <h2><%= _('Create a new account') %></h2> <%= render :partial => 'signup' %> </div> - <div id="middle_strip"> - <%= _('- or -') %> - </div> - <div id="right_half"> - <h1><%= _('Sign in') %></h1> + <div class="sign-in-wrapper"> + <p class="pretitle"><%= _('Got an account?') %></p> + <h2><%= _('Sign in') %></h2> <%= render :partial => 'signin', :locals => { :sign_in_as_existing_user => false } %> + </div> </div> <div style="clear:both"></div> |