fix #908 where the return path was set hard-coded which did not honor subdir settings

This commit is contained in:
Reinier Balt 2009-06-02 22:03:17 +02:00
parent 7a7862221d
commit 91c52cc89c

View file

@ -36,7 +36,7 @@ class TodosController < ApplicationController
respond_to do |format| respond_to do |format|
format.m { format.m {
@new_mobile = true @new_mobile = true
@return_path=cookies[:mobile_url] @return_path=cookies[:mobile_url] ? cookies[:mobile_url] : mobile_path
@mobile_from_context = current_user.contexts.find_by_id(params[:from_context]) if params[:from_context] @mobile_from_context = current_user.contexts.find_by_id(params[:from_context]) if params[:from_context]
@mobile_from_project = current_user.projects.find_by_id(params[:from_project]) if params[:from_project] @mobile_from_project = current_user.projects.find_by_id(params[:from_project]) if params[:from_project]
if params[:from_project] && !params[:from_context] if params[:from_project] && !params[:from_context]
@ -79,9 +79,7 @@ class TodosController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { redirect_to :action => "index" } format.html { redirect_to :action => "index" }
format.m do format.m do
@return_path=cookies[:mobile_url] @return_path=cookies[:mobile_url] ? cookies[:mobile_url] : mobile_path
# todo: use function for this fixed path
@return_path='/m' if @return_path.nil?
if @saved if @saved
redirect_to @return_path redirect_to @return_path
else else
@ -124,7 +122,7 @@ class TodosController < ApplicationController
@projects = current_user.projects.active @projects = current_user.projects.active
@contexts = current_user.contexts.find(:all) @contexts = current_user.contexts.find(:all)
@edit_mobile = true @edit_mobile = true
@return_path=cookies[:mobile_url] @return_path=cookies[:mobile_url] ? cookies[:mobile_url] : mobile_path
render :action => 'show' render :action => 'show'
end end
format.xml { render :xml => @todo.to_xml( :root => 'todo', :except => :user_id ) } format.xml { render :xml => @todo.to_xml( :root => 'todo', :except => :user_id ) }
@ -278,8 +276,9 @@ class TodosController < ApplicationController
format.m do format.m do
if @saved if @saved
if cookies[:mobile_url] if cookies[:mobile_url]
old_path = cookies[:mobile_url]
cookies[:mobile_url] = {:value => nil, :secure => SITE_CONFIG['secure_cookies']} cookies[:mobile_url] = {:value => nil, :secure => SITE_CONFIG['secure_cookies']}
redirect_to cookies[:mobile_url] redirect_to old_path
else else
redirect_to formatted_todos_path(:m) redirect_to formatted_todos_path(:m)
end end