diff options
-rw-r--r-- | app/controllers/admin_controller.rb | 9 | ||||
-rw-r--r-- | app/controllers/application_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 6 | ||||
-rw-r--r-- | app/models/info_request.rb | 16 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 6 | ||||
-rw-r--r-- | app/views/help/requesting.rhtml | 8 | ||||
-rw-r--r-- | app/views/request/show.rhtml | 6 | ||||
-rw-r--r-- | config/environment.rb | 5 | ||||
-rw-r--r-- | config/initializers/fast_gettext.rb | 2 |
9 files changed, 52 insertions, 8 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 004d460c5..75658f6de 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -10,7 +10,8 @@ require 'fileutils' class AdminController < ApplicationController layout "admin" - before_filter :assign_http_auth_user + before_filter :authenticate + USER_NAME, PASSWORD = "sadminiz", "w5x^H^<{J231s3" protect_from_forgery # See ActionController::RequestForgeryProtection for details # action to take if expecting an authenticity token and one isn't received @@ -44,5 +45,11 @@ class AdminController < ApplicationController expire_for_request(info_request) end end + private + def authenticate + authenticate_or_request_with_http_basic do |user_name, password| + user_name == USER_NAME && password == PASSWORD + end + end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 91754e2ba..d4c70ed1e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -30,7 +30,7 @@ class ApplicationController < ActionController::Base helper_method :site_name, :locale_from_params def site_name # XXX should come from database: - site_name = "WhatDoTheyKnow" + site_name = "Informata Zyrtare" return site_name end diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 6b1373e07..0c02effa7 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -404,6 +404,12 @@ class RequestController < ApplicationController redirect_to respond_to_last_url(@info_request) elsif @info_request.calculate_status == 'gone_postal' redirect_to respond_to_last_url(@info_request) + "?gone_postal=1" + elsif @info_request.calculate_status == 'deadline_extended' + flash[:notice] = "Authority has requested extension of the deadline." + redirect_to unhappy_url(@info_request) + elsif @info_request.calculate_status == 'wrong_response' + flash[:notice] = "Oh no! Sorry to hear that your request was wrong. Here is what to do now." + redirect_to unhappy_url(@info_request) elsif @info_request.calculate_status == 'internal_review' flash[:notice] = "<p>Thank you! Hopefully your wait isn't too long.</p><p>You should get a response within 20 days, or be told if it will take longer (<a href=\"" + unhappy_url(@info_request) + "#internal_review\">details</a>).</p>" redirect_to request_url(@info_request) diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 3441a73f7..5ce2be2df 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -57,6 +57,8 @@ class InfoRequest < ActiveRecord::Base 'waiting_response', 'waiting_clarification', 'gone_postal', + 'deadline_extended', + 'wrong_response', 'not_held', 'rejected', # this is called 'refused' in UK FOI law and the user interface, but 'rejected' internally for historic reasons 'successful', @@ -511,6 +513,9 @@ public # waiting_response_very_overdue def calculate_status return 'waiting_classification' if self.awaiting_description + # if deadline_extended expired do waiting_response_overdue + return 'waiting_response_overdue' if + self.described_state == "deadline_extended" && Time.now.strftime("%Y-%m-%d") > self.date_deadline_extended.strftime("%Y-%m-%d") return described_state unless self.described_state == "waiting_response" # Compare by date, so only overdue on next day, not if 1 second late return 'waiting_response_very_overdue' if @@ -608,7 +613,7 @@ public # last_event_forming_initial_request. There may be more obscure # things, e.g. fees, not properly covered. def date_response_required_by - return Holiday.due_date_from(self.date_initial_request_last_sent_at, 20) + return Holiday.due_date_from(self.date_initial_request_last_sent_at, 7) end # This is a long stop - even with UK public interest test extensions, 40 # days is a very long time. @@ -622,7 +627,10 @@ public return Holiday.due_date_from(self.date_initial_request_last_sent_at, 40) end end - + # deadline_extended + def date_deadline_extended + return Holiday.due_date_from(self.date_initial_request_last_sent_at, 15) + end # Where the initial request is sent to def recipient_email return self.public_body.request_email @@ -761,6 +769,10 @@ public "Waiting clarification." elsif status == 'gone_postal' "Handled by post." + elsif status == 'deadline_extended' + "Deadline extended." + elsif status == 'wrong_response' + "Wrong Response." elsif status == 'internal_review' "Awaiting internal review." elsif status == 'error_message' diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index 1b22fa547..64f602fbe 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -62,6 +62,8 @@ class InfoRequestEvent < ActiveRecord::Base 'waiting_response', 'waiting_clarification', 'gone_postal', + 'deadline_extended', + 'wrong_response', 'not_held', 'rejected', 'successful', @@ -288,6 +290,10 @@ class InfoRequestEvent < ActiveRecord::Base return "Clarification required" elsif status == 'gone_postal' return "Handled by post" + elsif status == 'deadline_extended' + return "Deadline Extended" + elsif status == 'wrong_response' + return "Wrong Response" elsif status == 'not_held' return "Information not held" elsif status == 'rejected' diff --git a/app/views/help/requesting.rhtml b/app/views/help/requesting.rhtml index 034bb31e5..dc70f3f89 100644 --- a/app/views/help/requesting.rhtml +++ b/app/views/help/requesting.rhtml @@ -140,6 +140,14 @@ are breaking the law.</p> </dd> +<dt id="deadline_extended">Deadline extended <a href="#deadline_extended">#</a> </dt> + +<dd> +<p>By law, public authorities must needs <strong>more time</strong> for request ... (TO DO) +</p> + + +</dd> <dt id="no_response">What if I never get a response?<a href="#no_response">#</a> </dt> <dd> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index ab8e3f93d..af1d1b6d2 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -86,6 +86,12 @@ <%= _('The request was <strong>refused</strong> by') %> <%= public_body_link(@info_request.public_body) %>. <% elsif @status == 'successful' %> <%= _('The request was <strong>successful</strong>.') %> + <% elsif @status == 'deadline_extended' %> + Currently <strong>deadline extended</strong> from <%= public_body_link(@info_request.public_body) %>, + they must respond promptly and normally no later than <strong><%= simple_date(@info_request.date_deadline_extended) %></strong> + (<%= link_to "details", "/help/requesting#deadline_extended" %>). + <% elsif @status == 'wrong_response' %> + <%= public_body_link(@info_request.public_body) %> has replied but the response <strong>does not correspond to the request</strong>. <% elsif @status == 'partially_successful' %> <%= _('The request was <strong>partially successful</strong>.') %> <% elsif @status == 'waiting_clarification' %> diff --git a/config/environment.rb b/config/environment.rb index 4b2c97f1a..77d212f2f 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -114,14 +114,13 @@ if (MySociety::Config.get("DOMAIN", "") != "") end # fallback locale and available locales -I18n.default_locale = :en -available_locales = MySociety::Config.get('AVAILABLE_LOCALES', 'en') +I18n.default_locale = :sq +available_locales = MySociety::Config.get('AVAILABLE_LOCALES', 'sq en sr') FastGettext.default_available_locales = available_locales.split(/ /) # Load monkey patches and other things from lib/ require 'tmail_extensions.rb' require 'activesupport_cache_extensions.rb' -require 'public_body_categories.rb' require 'timezone_fixes.rb' require 'use_spans_for_errors.rb' require 'make_html_4_compliant.rb' diff --git a/config/initializers/fast_gettext.rb b/config/initializers/fast_gettext.rb index b01b129fa..4c000d97d 100644 --- a/config/initializers/fast_gettext.rb +++ b/config/initializers/fast_gettext.rb @@ -1,3 +1,3 @@ FastGettext.add_text_domain 'app', :path => 'locale', :type => :po -FastGettext.default_available_locales = ['en','es'] #all you want to allow +FastGettext.default_available_locales = ['sq','en','sr'] #all you want to allow FastGettext.default_text_domain = 'app' |