mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 16:20:12 +01:00
fixes for mobile view and for recurring todos
* fixed redirect to last page instead of /mobile after adding a new todo using mobile interface * fixed adding new todo to tickler instead of home after marking a todo belonging an active recurring todo complete
This commit is contained in:
parent
c6dc3fcd5b
commit
db86df5497
7 changed files with 341 additions and 316 deletions
|
|
@ -144,6 +144,7 @@ class ContextsController < ApplicationController
|
||||||
@not_done = @not_done_todos.select {|t| t.context_id == @context.id }
|
@not_done = @not_done_todos.select {|t| t.context_id == @context.id }
|
||||||
@down_count = @not_done.size
|
@down_count = @not_done.size
|
||||||
cookies[:mobile_url]=request.request_uri
|
cookies[:mobile_url]=request.request_uri
|
||||||
|
@mobile_from_context = @context.id
|
||||||
render :action => 'mobile_show_context'
|
render :action => 'mobile_show_context'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -218,6 +218,7 @@ class ProjectsController < ApplicationController
|
||||||
@project.default_context.name
|
@project.default_context.name
|
||||||
end
|
end
|
||||||
cookies[:mobile_url]=request.request_uri
|
cookies[:mobile_url]=request.request_uri
|
||||||
|
@mobile_from_project = @project.id
|
||||||
render :action => 'project_mobile'
|
render :action => 'project_mobile'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,12 @@ class TodosController < ApplicationController
|
||||||
format.m {
|
format.m {
|
||||||
@new_mobile = true
|
@new_mobile = true
|
||||||
@return_path=cookies[:mobile_url]
|
@return_path=cookies[:mobile_url]
|
||||||
|
@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]
|
||||||
|
if params[:from_project] && !params[:from_context]
|
||||||
|
# we have a project but not a context -> use the default context
|
||||||
|
@mobile_from_context = @mobile_from_project.default_context
|
||||||
|
end
|
||||||
render :action => "new"
|
render :action => "new"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
@ -71,7 +77,7 @@ class TodosController < ApplicationController
|
||||||
# todo: use function for this fixed path
|
# todo: use function for this fixed path
|
||||||
@return_path='/mobile' if @return_path.nil?
|
@return_path='/mobile' if @return_path.nil?
|
||||||
if @saved
|
if @saved
|
||||||
redirect_to mobile_abbrev_url
|
redirect_to @return_path
|
||||||
else
|
else
|
||||||
@projects = current_user.projects.find(:all)
|
@projects = current_user.projects.find(:all)
|
||||||
@contexts = current_user.contexts.find(:all)
|
@contexts = current_user.contexts.find(:all)
|
||||||
|
|
|
||||||
|
|
@ -114,11 +114,10 @@ module TodosHelper
|
||||||
tags_except_starred = @todo.tags.reject{|t| t.name == Todo::STARRED_TAG_NAME}
|
tags_except_starred = @todo.tags.reject{|t| t.name == Todo::STARRED_TAG_NAME}
|
||||||
# removed the link. TODO: add link to mobile view of tagged actions
|
# removed the link. TODO: add link to mobile view of tagged actions
|
||||||
tag_list = tags_except_starred.collect{|t|
|
tag_list = tags_except_starred.collect{|t|
|
||||||
"<span class=\"tag #{t.name.gsub(' ','-')}\">" +
|
"<span class=\"tag\">" +
|
||||||
link_to(t.name, {:action => "tag", :controller => "todos", :id => t.name+".m"}) +
|
link_to(t.name, {:action => "tag", :controller => "todos", :id => t.name+".m"}) +
|
||||||
# link_to(t.name, formatted_tag_path(t, :m)) +
|
|
||||||
"</span>"}.join('')
|
"</span>"}.join('')
|
||||||
"<span class='tags'>#{tag_list}</span>"
|
"<span class=\"tags\">#{tag_list}</span>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def deferred_due_date
|
def deferred_due_date
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<%
|
||||||
|
new_todo_params = {}
|
||||||
|
new_todo_params[:from_project] = @mobile_from_project if @mobile_from_project
|
||||||
|
new_todo_params[:from_context] = @mobile_from_context if @mobile_from_context
|
||||||
|
-%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
|
@ -10,7 +14,7 @@
|
||||||
if !@prefs.nil? -%>
|
if !@prefs.nil? -%>
|
||||||
<h1><span class="count"><%= @down_count %></span> <%=
|
<h1><span class="count"><%= @down_count %></span> <%=
|
||||||
user_time.strftime(@prefs.title_date_format) -%></h1>
|
user_time.strftime(@prefs.title_date_format) -%></h1>
|
||||||
<%= (link_to("0-Add new action", formatted_new_todo_path(:m))+" | ") unless @new_mobile -%>
|
<%= (link_to("0-Add new action", formatted_new_todo_path(:m, new_todo_params))+" | ") unless @new_mobile -%>
|
||||||
<%= (link_to("1-Home", formatted_todos_path(:m))+" | ") unless @home -%>
|
<%= (link_to("1-Home", formatted_todos_path(:m))+" | ") unless @home -%>
|
||||||
<%= (link_to("2-Contexts", formatted_contexts_path(:m))+" | ") -%>
|
<%= (link_to("2-Contexts", formatted_contexts_path(:m))+" | ") -%>
|
||||||
<%= (link_to("3-Projects", formatted_projects_path(:m))+" | ") -%>
|
<%= (link_to("3-Projects", formatted_projects_path(:m))+" | ") -%>
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,24 @@ if parent_container_type == 'show_mobile' -%>
|
||||||
<h2><label for="todo_notes">Notes</label></h2>
|
<h2><label for="todo_notes">Notes</label></h2>
|
||||||
<%= text_area( "todo", "notes", "cols" => 30, "rows" => 5, "tabindex" => 3) %>
|
<%= text_area( "todo", "notes", "cols" => 30, "rows" => 5, "tabindex" => 3) %>
|
||||||
<h2><label for="todo_context_id">Context</label></h2>
|
<h2><label for="todo_context_id">Context</label></h2>
|
||||||
<%= collection_select( "todo", "context_id", @contexts, "id", "name", {"tabindex" => 4} ) %>
|
<%= unless @mobile_from_context
|
||||||
|
collection_select( "todo", "context_id", @contexts, "id", "name", {}, {"tabindex" => 4} )
|
||||||
|
else
|
||||||
|
select_tag("todo[context_id]", options_from_collection_for_select(
|
||||||
|
@contexts, "id", "name", @mobile_from_context.id),
|
||||||
|
{"id" => :todo_context_id, :tabindex => 4} )
|
||||||
|
end %>
|
||||||
<h2><label for="todo_project_id">Project</label></h2>
|
<h2><label for="todo_project_id">Project</label></h2>
|
||||||
<%= collection_select( "todo", "project_id", @projects, "id", "name",
|
<%= unless @mobile_from_project
|
||||||
{:include_blank => true}, {"tabindex" => 5} ) %>
|
collection_select( "todo", "project_id", @projects, "id", "name",
|
||||||
|
{:include_blank => true}, {"tabindex" => 5} )
|
||||||
|
else
|
||||||
|
# manually add blank option since :include_blank does not work
|
||||||
|
# with options_from_collection_for_select
|
||||||
|
select_tag("todo[project_id]", "<option value=\"\"></option>"+options_from_collection_for_select(
|
||||||
|
@projects, "id", "name", @mobile_from_project.id),
|
||||||
|
{"id" => :todo_project_id, :tabindex => 5} )
|
||||||
|
end %>
|
||||||
<h2><label for="tag_list">Tags (separate with commas)</label></h2>
|
<h2><label for="tag_list">Tags (separate with commas)</label></h2>
|
||||||
<%= text_field_tag "tag_list", @tag_list_text, :size => 30, :tabindex => 6 %>
|
<%= text_field_tag "tag_list", @tag_list_text, :size => 30, :tabindex => 6 %>
|
||||||
<h2><label for="todo_due">Due</label></h2>
|
<h2><label for="todo_due">Due</label></h2>
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,12 @@ if @saved
|
||||||
end
|
end
|
||||||
|
|
||||||
# show new todo if the completed todo was recurring
|
# show new todo if the completed todo was recurring
|
||||||
unless @new_recurring_todo.nil?
|
unless @new_recurring_todo.nil? || @new_recurring_todo.deferred?
|
||||||
page.call "todoItems.ensureVisibleWithEffectAppear", item_container_id(@new_recurring_todo)
|
page.call "todoItems.ensureVisibleWithEffectAppear", item_container_id(@new_recurring_todo)
|
||||||
page.insert_html :bottom, item_container_id(@new_recurring_todo), :partial => 'todos/todo', :locals => { :todo => @new_recurring_todo, :parent_container_type => parent_container_type }
|
page.insert_html :bottom, item_container_id(@new_recurring_todo), :partial => 'todos/todo', :locals => { :todo => @new_recurring_todo, :parent_container_type => parent_container_type }
|
||||||
page.visual_effect :highlight, dom_id(@new_recurring_todo, 'line'), {'startcolor' => "'#99ff99'"}
|
page.visual_effect :highlight, dom_id(@new_recurring_todo, 'line'), {'startcolor' => "'#99ff99'"}
|
||||||
else
|
else
|
||||||
page.notify :notice, "There is no next action after the recurring action you just finished. The recurrence is completed", 6.0 unless @recurring_todo.nil?
|
page.notify :notice, "There is no next action after the recurring action you just finished. The recurrence is completed", 6.0 unless @new_recurring_todo.deferred?
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue