diff options
author | francis <francis> | 2007-12-14 13:24:04 +0000 |
---|---|---|
committer | francis <francis> | 2007-12-14 13:24:04 +0000 |
commit | 9bdc07ebd51d0fb77a703a6f6c1e968d87bc699d (patch) | |
tree | 62afeb41213f262fbcdf206353e5ec02fca99932 | |
parent | 5232b8d65a9cf5d5d1db20962f35b774c42dd204 (diff) |
Get redirects right for proxied admin URLs.
-rw-r--r-- | app/controllers/admin_public_body_controller.rb | 12 | ||||
-rw-r--r-- | app/helpers/link_to_helper.rb | 7 | ||||
-rw-r--r-- | app/views/layouts/admin.rhtml | 3 | ||||
-rw-r--r-- | todo.txt | 19 |
4 files changed, 19 insertions, 22 deletions
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb index bc2dd90fa..9803c1f65 100644 --- a/app/controllers/admin_public_body_controller.rb +++ b/app/controllers/admin_public_body_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: admin_public_body_controller.rb,v 1.4 2007-11-13 12:59:53 francis Exp $ +# $Id: admin_public_body_controller.rb,v 1.5 2007-12-14 13:24:04 francis Exp $ class AdminPublicBodyController < ApplicationController layout "admin" @@ -14,10 +14,6 @@ class AdminPublicBodyController < ApplicationController render :action => 'list' end - # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) - verify :method => :post, :only => [ :destroy, :create, :update ], - :redirect_to => { :action => :list } - def list @public_bodies = PublicBody.paginate :order => "name", :page => params[:page], :per_page => 10 end @@ -35,7 +31,7 @@ class AdminPublicBodyController < ApplicationController @public_body = PublicBody.new(params[:public_body]) if @public_body.save flash[:notice] = 'PublicBody was successfully created.' - redirect_to :action => 'list' + redirect_to admin_url('body/list') else render :action => 'new' end @@ -51,7 +47,7 @@ class AdminPublicBodyController < ApplicationController @public_body = PublicBody.find(params[:id]) if @public_body.update_attributes(params[:public_body]) flash[:notice] = 'PublicBody was successfully updated.' - redirect_to :action => 'show', :id => @public_body + redirect_to admin_url('body/show/' + @public_body.id.to_s) else render :action => 'edit' end @@ -59,7 +55,7 @@ class AdminPublicBodyController < ApplicationController def destroy PublicBody.find(params[:id]).destroy - redirect_to :action => 'list' + redirect_to admin_url('body/list') end private diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 24ee8e578..8eeed45b5 100644 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -5,7 +5,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: link_to_helper.rb,v 1.2 2007-11-06 16:05:29 francis Exp $ +# $Id: link_to_helper.rb,v 1.3 2007-12-14 13:24:04 francis Exp $ module LinkToHelper @@ -41,6 +41,11 @@ module LinkToHelper text.gsub!(/[^a-z0-9_-]/, "") text end + + def admin_url(relative_path) + admin_url_prefix = MySociety::Config.get("ADMIN_BASE_URL", "/admin/") + return admin_url_prefix + relative_path + end end diff --git a/app/views/layouts/admin.rhtml b/app/views/layouts/admin.rhtml index b856632d5..ad30f4924 100644 --- a/app/views/layouts/admin.rhtml +++ b/app/views/layouts/admin.rhtml @@ -11,8 +11,7 @@ <body> <p><b>FOIFA admin interface:</b> -<% admin_url_prefix = MySociety::Config.get("ADMIN_BASE_URL", "/admin/") %> -<%= link_to 'Public bodies', admin_url_prefix + 'body/list' %> +<%= link_to 'Public bodies', admin_url('body/list') %> </p> <p style="color: green"><%= flash[:notice] %></p> @@ -2,14 +2,9 @@ Please send me a copy of the contract signed with Veolia for refuse and recycling collection. -Check these out for ids -http://www.ico.gov.uk/Home/tools_and_resources/decision_notices.aspx - Next ==== -When making new public body redirect doesn't work - Either rotate log files, or merge with Apache ones Check confirmed everywhere in password check etc. @@ -33,16 +28,17 @@ Test that actually sending request outgoing mail using deliveries Remove "Outgoing messages is invalid" error -Remove everything from test/ - You need to pull the magic email addresses out of incoming_messages so they aren't shown on the website -Some way of getting to your own home page - +Some way of getting to your own user page + Tidying ======= +Do we need to say to the public body "all responses will be published" from a +privacy point of view? + accept-charset="utf-8" on all forms - does it matter if Content-Type of whole page is already UTF-8? @@ -87,13 +83,14 @@ Say that we would like response by email (not postal address) in footer Later ===== +Check these out for ids +http://www.ico.gov.uk/Home/tools_and_resources/decision_notices.aspx + (10:32:14) richard: you just need to count the number of rows of text and compare it to the number of rows in the textbox (10:32:29) richard: then increase the height of the textbox by 1em-ish (10:32:52) Matthew: their function is called autogrow_textarea() by the way, if you just want to look at it... thanks :) I won't do it now as there are more important things, I was just accidentally impressed -Add postal address at City University to request - Lucene for search (ask Louise for plugin) Read wiki page lots |