mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-28 21:08:48 +01:00
remove duplication in mobile cookie handling
This commit is contained in:
parent
580cad7ad8
commit
306d501e20
1 changed files with 13 additions and 15 deletions
|
|
@ -510,13 +510,7 @@ class TodosController < ApplicationController
|
|||
format.xml { render :xml => @todo.to_xml( *to_xml_params ) }
|
||||
format.m do
|
||||
if @saved
|
||||
if cookies[:mobile_url]
|
||||
old_path = cookies[:mobile_url]
|
||||
cookies[:mobile_url] = {:value => nil, :secure => SITE_CONFIG['secure_cookies']}
|
||||
redirect_to old_path
|
||||
else
|
||||
redirect_to todos_path(:format => 'm')
|
||||
end
|
||||
do_mobile_todo_redirection
|
||||
else
|
||||
render :action => "edit", :format => :m
|
||||
end
|
||||
|
|
@ -798,14 +792,8 @@ class TodosController < ApplicationController
|
|||
format.html { redirect_to :back }
|
||||
format.js {render :action => 'update'}
|
||||
format.m {
|
||||
notify(:notice, t("todos.action_deferred", :description => @todo.description))
|
||||
if cookies[:mobile_url]
|
||||
old_path = cookies[:mobile_url]
|
||||
cookies[:mobile_url] = {:value => nil, :secure => SITE_CONFIG['secure_cookies']}
|
||||
redirect_to old_path
|
||||
else
|
||||
redirect_to todos_path(:format => 'm')
|
||||
end
|
||||
notify(:notice, t("todos.action_deferred", :description => @todo.description))
|
||||
do_mobile_todo_redirection
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
@ -926,6 +914,16 @@ class TodosController < ApplicationController
|
|||
|
||||
private
|
||||
|
||||
def do_mobile_todo_redirection
|
||||
if cookies[:mobile_url]
|
||||
old_path = cookies[:mobile_url]
|
||||
cookies[:mobile_url] = {:value => nil, :secure => SITE_CONFIG['secure_cookies']}
|
||||
redirect_to old_path
|
||||
else
|
||||
redirect_to todos_path(:format => 'm')
|
||||
end
|
||||
end
|
||||
|
||||
def to_xml_params
|
||||
if params[:limit_fields] == 'index'
|
||||
return [:only => [:id, :created_at, :updated_at, :completed_at] ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue