diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/layouts/no_chrome.rhtml | 47 | ||||
-rw-r--r-- | app/views/request/new.rhtml | 38 | ||||
-rw-r--r-- | app/views/request/preview.rhtml | 33 | ||||
-rw-r--r-- | app/views/user/signin_successful.rhtml | 6 |
4 files changed, 53 insertions, 71 deletions
diff --git a/app/views/layouts/no_chrome.rhtml b/app/views/layouts/no_chrome.rhtml index 2c6463bdc..8225aec75 100644 --- a/app/views/layouts/no_chrome.rhtml +++ b/app/views/layouts/no_chrome.rhtml @@ -1,39 +1,14 @@ -<!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') %> +<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 %> - </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> - </div> + <div id="<%= controller.controller_name + "_" + controller.action_name %>" class="controller_<%= controller.controller_name %>"> + <%= yield :layout %> </div> - </body> -</html> + </div> +</div> diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml index e8dd395a4..6105fe344 100644 --- a/app/views/request/new.rhtml +++ b/app/views/request/new.rhtml @@ -9,6 +9,43 @@ }); </script> +<% if !@user %> +<%= javascript_include_tag 'jquery.fancybox-1.3.4.pack' %> +<%= javascript_include_tag 'jquery.form' %> +<script> + function onSuccessfulLogin() { + $.fancybox.close(); + $("#write_form").ajaxFormUnbind(); + $("#write_form").submit(); + } + + function interceptFormSubmit(form_id) { + $(form_id).ajaxForm({ + success: function(responseText) { + $("#fancybox-content").html(responseText); + interceptFormSubmits(); + } + }); + }; + + function interceptFormSubmits() { + interceptFormSubmit("#signin_form"); + interceptFormSubmit("#signup_form"); + }; + + $(document).ready(function() { + $("#write_form").ajaxForm({ + success: function(responseText) { + $.fancybox({ + 'content': responseText, + 'onComplete': interceptFormSubmits + }); + } + }); + }); +</script> +<% end %> + <% @title = _("Make an {{law_used_short}} request to '{{public_body_name}}'",:law_used_short=>h(@info_request.law_used_short),:public_body_name=>h(@info_request.public_body.name)) %> <% if @existing_request %> @@ -130,6 +167,7 @@ <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> <%= hidden_field_tag(:submitted_new_request, 1 ) %> <%= hidden_field_tag(:preview, 1 ) %> + <%= hidden_field_tag(:modal, 1 ) %> <%= submit_tag _("Preview your public request") %> </div> diff --git a/app/views/request/preview.rhtml b/app/views/request/preview.rhtml index 38cbf24f0..45b6a3dc1 100644 --- a/app/views/request/preview.rhtml +++ b/app/views/request/preview.rhtml @@ -1,24 +1,3 @@ -<% if !@user %> -<%= javascript_include_tag 'jquery.fancybox-1.3.4.pack' %> -<script> - $(document).ready(function() { - $("#submit_button").fancybox({ - 'modal': false, - 'width': 960, - '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' ) { - $("#hidden_submit_button").click(); - } - } - }); - }); -</script> -<% end %> - <% @title = "Preview new " + h(@info_request.law_used_short) + " request to '" + h(@info_request.public_body.name) + "'" %> <% form_for(:info_request, @info_request, :html => { :id => 'preview_form' } ) do |f| %> @@ -59,19 +38,11 @@ <%= hidden_field_tag(:submitted_new_request, 1) %> <%= hidden_field_tag(:preview, 0 ) %> <%= submit_tag _("Edit this request"), :name => 'reedit', :id => 'reedit_button' %> - <%= submit_tag _("Send request"), :name => 'submit', :id => 'submit_button' %> - - <!-- Since FancyBox is intercepting the click event to display the modal login form, - and I can't find a way of accessing the underlying default behaviour of the button, - we hide another submit button without FancyBox, to be called programatically. - Feels hacky. --> - <div style="visibility: hidden"> - <%= submit_tag _("Send request"), :name => 'submit', :id => 'hidden_submit_button' %> - </div> + <%= submit_tag _("Send request"), :name => 'submit', :id => 'submit_button' %> </p> <% if !@info_request.tag_string.empty? %> <p><strong><%= _('Tags:') %></strong> <%=h @info_request.tag_string %></p> <% end %> -<% end %> +<% end %>
\ No newline at end of file diff --git a/app/views/user/signin_successful.rhtml b/app/views/user/signin_successful.rhtml index 49eea277f..ca5978a8d 100644 --- a/app/views/user/signin_successful.rhtml +++ b/app/views/user/signin_successful.rhtml @@ -4,10 +4,8 @@ You're in. <a href="#" id="send-request">Continue sending your request</a> -<script> - parent.modal_signin_successful = true; - +<script> $("#send-request").click(function() { - parent.$.fancybox.close(); return false; + onSuccessfulLogin(); return false; }); </script>
\ No newline at end of file |