aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/request_controller.rb11
-rw-r--r--app/helpers/config_helper.rb4
-rw-r--r--app/views/layouts/default.rhtml24
-rw-r--r--app/views/layouts/no_chrome.rhtml47
-rw-r--r--app/views/user/signin_successful.rhtml6
-rw-r--r--config/general.yml-example3
6 files changed, 81 insertions, 14 deletions
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
diff --git a/app/helpers/config_helper.rb b/app/helpers/config_helper.rb
index 80f2deed2..b0381a2f5 100644
--- a/app/helpers/config_helper.rb
+++ b/app/helpers/config_helper.rb
@@ -2,4 +2,8 @@ module ConfigHelper
def site_name
MySociety::Config.get('SITE_NAME', 'Alaveteli')
end
+
+ def force_registration_on_new_request
+ MySociety::Config.get('FORCE_REGISTRATION_ON_NEW_REQUEST', false)
+ end
end \ No newline at end of file
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml
index 391f2df15..a8a135676 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.rhtml
@@ -49,6 +49,28 @@
</head>
<body>
+ <!-- XXX: move to a separate file -->
+ <% if force_registration_on_new_request && !@user %>
+ <%= javascript_include_tag 'jquery.fancybox-1.3.4.pack' %>
+ <script>
+ $(document).ready(function() {
+ $("#make-request-link").fancybox({
+ 'modal': false,
+ 'width': 800,
+ 'height': 500,
+ 'type': 'iframe',
+ 'href': '/en/profile/sign_in?modal=1',
+ 'onClosed': function() {
+ // modal_signin_successful variable set by modal dialog box
+ if (typeof modal_signin_successful != 'undefined' ) {
+ window.location.href = '<%= select_authority_url %>';
+ }
+ }
+ });
+ });
+ </script>
+ <% end %>
+
<% # code for popup advert for a campaign etc.
=begin
<div id="everypage" class="jshide">
@@ -87,7 +109,7 @@
<div id="topnav">
<ul id="navigation">
<li><%= link_to _("Home"), frontpage_url %></li>
- <li><%= link_to _("Make request"), select_authority_url %></li>
+ <li><%= link_to _("Make request"), select_authority_url, :id => 'make-request-link' %></li>
<li><%= link_to _("View requests"), request_list_successful_url %></li>
<li><%= link_to _("View authorities"), list_public_bodies_default %></li>
<% if @user %>
diff --git a/app/views/layouts/no_chrome.rhtml b/app/views/layouts/no_chrome.rhtml
index 8225aec75..c314dfbd3 100644
--- a/app/views/layouts/no_chrome.rhtml
+++ b/app/views/layouts/no_chrome.rhtml
@@ -1,14 +1,39 @@
-<div class="entirebody">
- <div id="content">
- <% if flash[:notice] %>
- <div id="notice"><%= flash[:notice] %></div>
- <% end %>
- <% if flash[:error] %>
- <div id="error"><%= flash[:error] %></div>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="<%= I18n.locale %>">
+ <head>
+ <title>
+ <% if @title %>
+ <%=@title%> - <%= site_name %>
+ <% else %>
+ <%= site_name %> - <%= _('Make and browse Freedom of Information (FOI) requests') %>
<% end %>
+ </title>
+
+ <script type="text/javascript" src="/javascripts/jquery.js"></script>
+
+ <%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet" %>
+ <!--[if LT IE 7]>
+ <style type="text/css">@import url("/stylesheets/ie6.css");</style>
+ <![endif]-->
+ <!--[if LT IE 7]>
+ <style type="text/css">@import url("/stylesheets/ie6-custom.css");</style>
+ <![endif]-->
+ <%= stylesheet_link_tag 'custom', :title => "Main", :rel => "stylesheet" %>
+ </head>
+ <body>
+ <div class="entirebody">
+ <div id="content">
+ <% if flash[:notice] %>
+ <div id="notice"><%= flash[:notice] %></div>
+ <% end %>
+ <% if flash[:error] %>
+ <div id="error"><%= flash[:error] %></div>
+ <% end %>
- <div id="<%= controller.controller_name + "_" + controller.action_name %>" class="controller_<%= controller.controller_name %>">
- <%= yield :layout %>
+ <div id="<%= controller.controller_name + "_" + controller.action_name %>" class="controller_<%= controller.controller_name %>">
+ <%= yield :layout %>
+ </div>
+ </div>
</div>
- </div>
-</div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/views/user/signin_successful.rhtml b/app/views/user/signin_successful.rhtml
index 38aebb846..762bfa763 100644
--- a/app/views/user/signin_successful.rhtml
+++ b/app/views/user/signin_successful.rhtml
@@ -1,7 +1,9 @@
<%= _("You're in. <a href=\"#\" id=\"send-request\">Continue sending your request</a>") %>
-<script>
+<script>
+ parent.modal_signin_successful = true;
+
$("#send-request").click(function() {
- onSuccessfulLogin(); return false;
+ parent.$.fancybox.close(); return false;
});
</script> \ No newline at end of file
diff --git a/config/general.yml-example b/config/general.yml-example
index 3537cd792..e2652c848 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -36,6 +36,9 @@ FRONTPAGE_PUBLICBODY_EXAMPLES: 'tgq'
# URL of theme to install (when running rails-post-deploy script)
THEME_URL: 'git://github.com/mysociety/whatdotheyknow-theme.git'
+# Whether a user needs to sign in to start the New Request process
+FORCE_REGISTRATION_ON_NEW_REQUEST: false
+
## Incoming email
# Your email domain, e.g. 'foifa.com'