mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-28 12:58:48 +01:00
keep tracks of last url in mobile view to be able to return to last page after edit of action. Fixes #696. Also applies patch to fix selenium test and update them for the navigation with the new return path.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@835 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
b011cbec2b
commit
5d2023d18b
6 changed files with 57 additions and 28 deletions
|
|
@ -127,14 +127,21 @@ class ContextsController < ApplicationController
|
|||
|
||||
def render_contexts_mobile
|
||||
lambda do
|
||||
@page_title = "TRACKS::List Contexts"
|
||||
@active_contexts = @contexts.find(:all, { :conditions => ["hide = ?", false]})
|
||||
@hidden_contexts = @contexts.find(:all, { :conditions => ["hide = ?", true]})
|
||||
@down_count = @active_contexts.size + @hidden_contexts.size
|
||||
cookies[:mobile_url]=request.request_uri
|
||||
render :action => 'index_mobile'
|
||||
end
|
||||
end
|
||||
|
||||
def render_context_mobile
|
||||
lambda do
|
||||
@page_title = "TRACKS::List actions in "+@context.name
|
||||
@not_done = @not_done_todos.select {|t| t.context_id == @context.id }
|
||||
@down_count = @not_done.size
|
||||
cookies[:mobile_url]=request.request_uri
|
||||
render :action => 'mobile_show_context'
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class ProjectsController < ApplicationController
|
|||
@max_completed = current_user.prefs.show_number_completed
|
||||
|
||||
@count = @not_done.size
|
||||
@down_count = @count + @deferred.size
|
||||
@next_project = current_user.projects.next_from(@project)
|
||||
@previous_project = current_user.projects.previous_from(@project)
|
||||
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
|
||||
|
|
@ -196,6 +197,8 @@ class ProjectsController < ApplicationController
|
|||
@active_projects = @projects.select{ |p| p.active? }
|
||||
@hidden_projects = @projects.select{ |p| p.hidden? }
|
||||
@completed_projects = @projects.select{ |p| p.completed? }
|
||||
@down_count = @active_projects.size + @hidden_projects.size + @completed_projects.size
|
||||
cookies[:mobile_url]=request.request_uri
|
||||
render :action => 'index_mobile'
|
||||
end
|
||||
end
|
||||
|
|
@ -208,6 +211,7 @@ class ProjectsController < ApplicationController
|
|||
@project_default_context = "The default context for this project is "+
|
||||
@project.default_context.name
|
||||
end
|
||||
cookies[:mobile_url]=request.request_uri
|
||||
render :action => 'project_mobile'
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class TodosController < ApplicationController
|
|||
respond_to do |format|
|
||||
format.m {
|
||||
@new_mobile = true
|
||||
@return_path=cookies[:mobile_url]
|
||||
render :action => "new_mobile"
|
||||
}
|
||||
end
|
||||
|
|
@ -102,6 +103,7 @@ class TodosController < ApplicationController
|
|||
@projects = current_user.projects.select { |p| p.active? }
|
||||
@contexts = current_user.contexts.find(:all)
|
||||
@edit_mobile = true
|
||||
@return_path=cookies[:mobile_url]
|
||||
render :action => 'show_mobile'
|
||||
end
|
||||
format.xml { render :xml => @todo.to_xml( :root => 'todo', :except => :user_id ) }
|
||||
|
|
@ -208,7 +210,11 @@ class TodosController < ApplicationController
|
|||
format.xml { render :xml => @todo.to_xml( :except => :user_id ) }
|
||||
format.m do
|
||||
if @saved
|
||||
redirect_to formatted_todos_path(:m)
|
||||
if cookies[:mobile_url]
|
||||
redirect_to cookies[:mobile_url]
|
||||
else
|
||||
redirect_to formatted_todos_path(:m)
|
||||
end
|
||||
else
|
||||
render :action => "edit", :format => :m
|
||||
end
|
||||
|
|
@ -275,6 +281,7 @@ class TodosController < ApplicationController
|
|||
current_user.deferred_todos.find_and_activate_ready
|
||||
@not_done_todos = current_user.deferred_todos
|
||||
@count = @not_done_todos.size
|
||||
@down_count = @count
|
||||
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json unless mobile?
|
||||
|
||||
respond_to do |format|
|
||||
|
|
@ -332,11 +339,13 @@ class TodosController < ApplicationController
|
|||
@done = tag_collection.find(:all, :limit => max_completed, :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'completed'])
|
||||
# Set count badge to number of items with this tag
|
||||
@not_done_todos.empty? ? @count = 0 : @count = @not_done_todos.size
|
||||
# #@default_project_context_name_map =
|
||||
@down_count = @count
|
||||
# @default_project_context_name_map =
|
||||
# build_default_project_context_name_map(@projects).to_json
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.m {
|
||||
cookies[:mobile_url]=request.request_uri
|
||||
render :action => "mobile_tag"
|
||||
}
|
||||
end
|
||||
|
|
@ -555,16 +564,9 @@ class TodosController < ApplicationController
|
|||
def render_todos_mobile
|
||||
lambda do
|
||||
@page_title = "All actions"
|
||||
if @context
|
||||
@page_title += " in context #{@context.name}"
|
||||
@down_count = @context.not_done_todo_count
|
||||
elsif @project
|
||||
@page_title += " in project #{@project.name}"
|
||||
@down_count = @project.not_done_todo_count
|
||||
else
|
||||
@home = true
|
||||
determine_down_count
|
||||
end
|
||||
@home = true
|
||||
cookies[:mobile_url]=request.request_uri
|
||||
determine_down_count
|
||||
|
||||
render :action => 'index_mobile'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
<%= render :partial => 'edit_mobile' %>
|
||||
<p><input type="submit" value="Create" tabindex="6" /></p>
|
||||
<% end -%>
|
||||
<%= link_to "Back", formatted_todos_path(:m) %>
|
||||
<%= link_to "Back", @return_path %>
|
||||
|
|
@ -4,7 +4,7 @@ login :as => 'admin'
|
|||
open '/m'
|
||||
wait_for_text 'css=h1 span.count', '10'
|
||||
|
||||
click_and_wait "link=+"
|
||||
click_and_wait "link=0-Add new action"
|
||||
|
||||
type "todo_notes", "test notes"
|
||||
type "todo_description", "test name"
|
||||
|
|
|
|||
|
|
@ -1,25 +1,41 @@
|
|||
setup :fixtures => :all
|
||||
login :as => 'admin'
|
||||
|
||||
# open home page
|
||||
open '/m'
|
||||
wait_for_title "All actions"
|
||||
wait_for_text 'css=h1 span.count', '10'
|
||||
|
||||
click_and_wait "link=2"
|
||||
verify_title "All actions"
|
||||
wait_for_text 'css=h1 span.count', '10'
|
||||
|
||||
select "context_id", "label=agenda"
|
||||
click_and_wait "change_context"
|
||||
verify_title "All actions in context agenda"
|
||||
# open context page
|
||||
click_and_wait "link=2-Contexts"
|
||||
verify_title "TRACKS::List Contexts"
|
||||
# choose agenda context
|
||||
click_and_wait "link=agenda"
|
||||
verify_title "TRACKS::List actions in agenda"
|
||||
wait_for_text 'css=h1 span.count', '5'
|
||||
|
||||
select "context_id", "label=call"
|
||||
click_and_wait "change_context"
|
||||
verify_title "All actions in context call"
|
||||
# click on tag foo to go to tag page
|
||||
click_and_wait "link=foo"
|
||||
verify_title "TRACKS::Tagged with 'foo'"
|
||||
wait_for_text 'css=h1 span.count', '2'
|
||||
|
||||
click_and_wait "link=3-Projects"
|
||||
wait_for_text 'css=h1 span.count', '3'
|
||||
click_and_wait "link=Build a working time machine"
|
||||
wait_for_text 'css=h1 span.count', '3'
|
||||
|
||||
select "project_id", "label=Build a working time machine"
|
||||
click_and_wait "change_project"
|
||||
verify_title "All actions in project Build a working time machine"
|
||||
wait_for_text 'css=h1 span.count', '2'
|
||||
# follow link of action to edit form and mark done
|
||||
click_and_wait "link=Select Delorean model"
|
||||
open_and_wait '/todos/6.m'
|
||||
click "done"
|
||||
click_and_wait "//input[@value='Update']"
|
||||
# should return to project view
|
||||
verify_title "TRACKS::Project: Build a working time machine"
|
||||
open_and_wait '/m'
|
||||
# on home page the count should be increased
|
||||
wait_for_text 'css=h1 span.count', '9'
|
||||
|
||||
# just test the navigation.
|
||||
click_and_wait "link=Tickler"
|
||||
wait_for_text 'css=h1 span.count', '1'
|
||||
click_and_wait "link=Feeds"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue