From 9925d8f83864dc740d9b284a9e472d422dba12fb Mon Sep 17 00:00:00 2001 From: David Cabo Date: Tue, 26 Jul 2011 22:07:30 +0200 Subject: Adapting New Request flow to new wireframes: added type ahead search when creating new requests --- app/controllers/request_controller.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 472f18f6e..b6111b087 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -736,5 +736,17 @@ class RequestController < ApplicationController return end end + + # Type ahead search + def search_typeahead + # Since acts_as_xapian doesn't support the Partial match flag, we work around it + # by making the last work a wildcard, which is quite the same + query = params[:q] + '*' + + query = query.split(' ').join(' OR ') # XXX: HACK for OR instead of default AND! + @xapian_requests = perform_search([InfoRequestEvent], query, 'relevant', 'request_collapse', 5) + + render :partial => "request/search_ahead.rhtml" + end end -- cgit v1.2.3 From 755ac9e6e8cc194d771ee59d7fe815fe72454a85 Mon Sep 17 00:00:00 2001 From: David Cabo Date: Tue, 2 Aug 2011 03:50:04 +0200 Subject: implementing new request wireframes: new page to select authority to write to --- app/controllers/request_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index f36fae463..d39b78f36 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -22,6 +22,10 @@ class RequestController < ApplicationController rescue MissingSourceFile, NameError end + def select_authority + medium_cache + end + def show medium_cache @locale = self.locale_from_params() @@ -66,7 +70,7 @@ class RequestController < ApplicationController @last_info_request_event_id = @info_request.last_event_id_needing_description @new_responses_count = @info_request.events_needing_description.select {|i| i.event_type == 'response'}.size -1 + # Sidebar stuff # ... requests that have similar imporant terms behavior_cache :tag => ['similar', @info_request.id] do -- cgit v1.2.3 From a63e598b9e0ddfa7ac695b1be41aaace6c0eb628 Mon Sep 17 00:00:00 2001 From: David Cabo Date: Thu, 11 Aug 2011 03:50:10 +0200 Subject: Move log-in point to before Preview and fix modal sign-in and sign-up redirects --- app/controllers/request_controller.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index d39b78f36..88fb9be6c 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -276,6 +276,15 @@ class RequestController < ApplicationController return end + if !authenticated?( + :web => _("To send your FOI request"), + :email => _("Then your FOI request to {{public_body_name}} will be sent.",:public_body_name=>@info_request.public_body.name), + :email_subject => _("Confirm your FOI request to ") + @info_request.public_body.name + ) + # do nothing - as "authenticated?" has done the redirect to signin page for us + return + end + # Show preview page, if it is a preview if params[:preview].to_i == 1 message = "" @@ -298,15 +307,6 @@ class RequestController < ApplicationController return end - if !authenticated?( - :web => _("To send your FOI request"), - :email => _("Then your FOI request to {{public_body_name}} will be sent.",:public_body_name=>@info_request.public_body.name), - :email_subject => _("Confirm your FOI request to ") + @info_request.public_body.name - ) - # do nothing - as "authenticated?" has done the redirect to signin page for us - return - end - @info_request.user = authenticated_user # This automatically saves dependent objects, such as @outgoing_message, in the same transaction @info_request.save! -- cgit v1.2.3 From d9948091967123ca7e9d986d6ebaf4b6226b27f3 Mon Sep 17 00:00:00 2001 From: David Cabo Date: Tue, 23 Aug 2011 02:28:03 +0200 Subject: Add sign-in at beginning of New Request process (configurable) --- app/controllers/request_controller.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index dadbb0cbd..ffdcbe62c 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -23,6 +23,17 @@ class RequestController < ApplicationController end def select_authority + # Check whether we force the user to sign in right at the start, or we allow her + # to start filling the request anonymously + if force_registration_on_new_request && !authenticated?( + :web => _("To send your FOI request"), + :email => _("Then you'll be allowed to send FOI requests."), + :email_subject => _("Confirm your email address") + ) + # do nothing - as "authenticated?" has done the redirect to signin page for us + return + end + medium_cache end -- cgit v1.2.3 From 6f46c15f6290e286ffa7b12ace40e4983c6641a3 Mon Sep 17 00:00:00 2001 From: David Cabo Date: Tue, 23 Aug 2011 02:32:40 +0200 Subject: Move compulsory sign-in step after Preview page, where it was originally --- app/controllers/request_controller.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index ffdcbe62c..6e562d97d 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -287,15 +287,6 @@ class RequestController < ApplicationController return end - if !authenticated?( - :web => _("To send your FOI request"), - :email => _("Then your FOI request to {{public_body_name}} will be sent.",:public_body_name=>@info_request.public_body.name), - :email_subject => _("Confirm your FOI request to ") + @info_request.public_body.name - ) - # do nothing - as "authenticated?" has done the redirect to signin page for us - return - end - # Show preview page, if it is a preview if params[:preview].to_i == 1 message = "" @@ -318,6 +309,15 @@ class RequestController < ApplicationController return end + if !authenticated?( + :web => _("To send your FOI request"), + :email => _("Then your FOI request to {{public_body_name}} will be sent.",:public_body_name=>@info_request.public_body.name), + :email_subject => _("Confirm your FOI request to ") + @info_request.public_body.name + ) + # do nothing - as "authenticated?" has done the redirect to signin page for us + return + end + @info_request.user = authenticated_user # This automatically saves dependent objects, such as @outgoing_message, in the same transaction @info_request.save! -- cgit v1.2.3