mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 08:10:13 +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
|
||||||
|
|
|
||||||
|
|
@ -1,282 +1,283 @@
|
||||||
class ProjectsController < ApplicationController
|
class ProjectsController < ApplicationController
|
||||||
|
|
||||||
helper :application, :todos, :notes
|
helper :application, :todos, :notes
|
||||||
before_filter :set_source_view
|
before_filter :set_source_view
|
||||||
before_filter :set_project_from_params, :only => [:update, :destroy, :show, :edit]
|
before_filter :set_project_from_params, :only => [:update, :destroy, :show, :edit]
|
||||||
before_filter :default_context_filter, :only => [:create, :update]
|
before_filter :default_context_filter, :only => [:create, :update]
|
||||||
skip_before_filter :login_required, :only => [:index]
|
skip_before_filter :login_required, :only => [:index]
|
||||||
prepend_before_filter :login_or_feed_token_required, :only => [:index]
|
prepend_before_filter :login_or_feed_token_required, :only => [:index]
|
||||||
session :off, :only => :index, :if => Proc.new { |req| ['rss','atom','txt'].include?(req.parameters[:format]) }
|
session :off, :only => :index, :if => Proc.new { |req| ['rss','atom','txt'].include?(req.parameters[:format]) }
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@projects = current_user.projects(true)
|
@projects = current_user.projects(true)
|
||||||
if params[:projects_and_actions]
|
if params[:projects_and_actions]
|
||||||
projects_and_actions
|
projects_and_actions
|
||||||
else
|
else
|
||||||
@contexts = current_user.contexts(true)
|
@contexts = current_user.contexts(true)
|
||||||
init_not_done_counts(['project'])
|
init_not_done_counts(['project'])
|
||||||
if params[:only_active_with_no_next_actions]
|
if params[:only_active_with_no_next_actions]
|
||||||
@projects = @projects.select { |p| p.active? && count_undone_todos(p) == 0 }
|
@projects = @projects.select { |p| p.active? && count_undone_todos(p) == 0 }
|
||||||
end
|
end
|
||||||
init_project_hidden_todo_counts(['project'])
|
init_project_hidden_todo_counts(['project'])
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html &render_projects_html
|
format.html &render_projects_html
|
||||||
format.m &render_projects_mobile
|
format.m &render_projects_mobile
|
||||||
format.xml { render :xml => @projects.to_xml( :except => :user_id ) }
|
format.xml { render :xml => @projects.to_xml( :except => :user_id ) }
|
||||||
format.rss &render_rss_feed
|
format.rss &render_rss_feed
|
||||||
format.atom &render_atom_feed
|
format.atom &render_atom_feed
|
||||||
format.text &render_text_feed
|
format.text &render_text_feed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def projects_and_actions
|
def projects_and_actions
|
||||||
@projects = @projects.select { |p| p.active? }
|
@projects = @projects.select { |p| p.active? }
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.text {
|
format.text {
|
||||||
render :action => 'index_text_projects_and_actions', :layout => false, :content_type => Mime::TEXT
|
render :action => 'index_text_projects_and_actions', :layout => false, :content_type => Mime::TEXT
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
init_data_for_sidebar unless mobile?
|
init_data_for_sidebar unless mobile?
|
||||||
@projects = current_user.projects
|
@projects = current_user.projects
|
||||||
@page_title = "TRACKS::Project: #{@project.name}"
|
@page_title = "TRACKS::Project: #{@project.name}"
|
||||||
@project.todos.send :with_scope, :find => { :include => [:context, :tags] } do
|
@project.todos.send :with_scope, :find => { :include => [:context, :tags] } do
|
||||||
@not_done = @project.not_done_todos(:include_project_hidden_todos => true)
|
@not_done = @project.not_done_todos(:include_project_hidden_todos => true)
|
||||||
@deferred = @project.deferred_todos.sort_by { |todo| todo.show_from }
|
@deferred = @project.deferred_todos.sort_by { |todo| todo.show_from }
|
||||||
@done = @project.done_todos
|
@done = @project.done_todos
|
||||||
end
|
end
|
||||||
|
|
||||||
@max_completed = current_user.prefs.show_number_completed
|
@max_completed = current_user.prefs.show_number_completed
|
||||||
|
|
||||||
@count = @not_done.size
|
@count = @not_done.size
|
||||||
@down_count = @count + @deferred.size
|
@down_count = @count + @deferred.size
|
||||||
@next_project = current_user.projects.next_from(@project)
|
@next_project = current_user.projects.next_from(@project)
|
||||||
@previous_project = current_user.projects.previous_from(@project)
|
@previous_project = current_user.projects.previous_from(@project)
|
||||||
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
|
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.m &render_project_mobile
|
format.m &render_project_mobile
|
||||||
format.xml { render :xml => @project.to_xml( :except => :user_id ) }
|
format.xml { render :xml => @project.to_xml( :except => :user_id ) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Example XML usage: curl -H 'Accept: application/xml' -H 'Content-Type:
|
# Example XML usage: curl -H 'Accept: application/xml' -H 'Content-Type:
|
||||||
# application/xml'
|
# application/xml'
|
||||||
# -u username:password
|
# -u username:password
|
||||||
# -d '<request><project><name>new project_name</name></project></request>'
|
# -d '<request><project><name>new project_name</name></project></request>'
|
||||||
# http://our.tracks.host/projects
|
# http://our.tracks.host/projects
|
||||||
#
|
#
|
||||||
def create
|
def create
|
||||||
if params[:format] == 'application/xml' && params['exception']
|
if params[:format] == 'application/xml' && params['exception']
|
||||||
render_failure "Expected post format is valid xml like so: <request><project><name>project name</name></project></request>."
|
render_failure "Expected post format is valid xml like so: <request><project><name>project name</name></project></request>."
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@project = current_user.projects.build
|
@project = current_user.projects.build
|
||||||
params_are_invalid = true
|
params_are_invalid = true
|
||||||
if (params['project'] || (params['request'] && params['request']['project']))
|
if (params['project'] || (params['request'] && params['request']['project']))
|
||||||
@project.attributes = params['project'] || params['request']['project']
|
@project.attributes = params['project'] || params['request']['project']
|
||||||
params_are_invalid = false
|
params_are_invalid = false
|
||||||
end
|
end
|
||||||
@go_to_project = params['go_to_project']
|
@go_to_project = params['go_to_project']
|
||||||
@saved = @project.save
|
@saved = @project.save
|
||||||
@project_not_done_counts = { @project.id => 0 }
|
@project_not_done_counts = { @project.id => 0 }
|
||||||
@active_projects_count = current_user.projects.count(:conditions => "state = 'active'")
|
@active_projects_count = current_user.projects.count(:conditions => "state = 'active'")
|
||||||
@contexts = current_user.contexts
|
@contexts = current_user.contexts
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js { @down_count = current_user.projects.size }
|
format.js { @down_count = current_user.projects.size }
|
||||||
format.xml do
|
format.xml do
|
||||||
if @project.new_record? && params_are_invalid
|
if @project.new_record? && params_are_invalid
|
||||||
render_failure "Expected post format is valid xml like so: <request><project><name>project name</name></project></request>."
|
render_failure "Expected post format is valid xml like so: <request><project><name>project name</name></project></request>."
|
||||||
elsif @project.new_record?
|
elsif @project.new_record?
|
||||||
render_failure @project.errors.full_messages.join(', ')
|
render_failure @project.errors.full_messages.join(', ')
|
||||||
else
|
else
|
||||||
head :created, :location => project_url(@project)
|
head :created, :location => project_url(@project)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Edit the details of the project
|
# Edit the details of the project
|
||||||
#
|
#
|
||||||
def update
|
def update
|
||||||
params['project'] ||= {}
|
params['project'] ||= {}
|
||||||
if params['project']['state']
|
if params['project']['state']
|
||||||
@state_changed = @project.state != params['project']['state']
|
@state_changed = @project.state != params['project']['state']
|
||||||
logger.info "@state_changed: #{@project.state} == #{params['project']['state']} != #{@state_changed}"
|
logger.info "@state_changed: #{@project.state} == #{params['project']['state']} != #{@state_changed}"
|
||||||
@project.transition_to(params['project']['state'])
|
@project.transition_to(params['project']['state'])
|
||||||
params['project'].delete('state')
|
params['project'].delete('state')
|
||||||
end
|
end
|
||||||
success_text = if params['field'] == 'name' && params['value']
|
success_text = if params['field'] == 'name' && params['value']
|
||||||
params['project']['id'] = params['id']
|
params['project']['id'] = params['id']
|
||||||
params['project']['name'] = params['value']
|
params['project']['name'] = params['value']
|
||||||
end
|
end
|
||||||
@project.attributes = params['project']
|
@project.attributes = params['project']
|
||||||
if @project.save
|
if @project.save
|
||||||
if boolean_param('wants_render')
|
if boolean_param('wants_render')
|
||||||
if (@project.hidden?)
|
if (@project.hidden?)
|
||||||
@project_project_hidden_todo_counts = Hash.new
|
@project_project_hidden_todo_counts = Hash.new
|
||||||
@project_project_hidden_todo_counts[@project.id] = @project.reload().not_done_todo_count(:include_project_hidden_todos => true)
|
@project_project_hidden_todo_counts[@project.id] = @project.reload().not_done_todo_count(:include_project_hidden_todos => true)
|
||||||
else
|
else
|
||||||
@project_not_done_counts = Hash.new
|
@project_not_done_counts = Hash.new
|
||||||
@project_not_done_counts[@project.id] = @project.reload().not_done_todo_count(:include_project_hidden_todos => true)
|
@project_not_done_counts[@project.id] = @project.reload().not_done_todo_count(:include_project_hidden_todos => true)
|
||||||
end
|
end
|
||||||
@contexts = current_user.contexts
|
@contexts = current_user.contexts
|
||||||
@active_projects_count = current_user.projects.count(:conditions => "state = 'active'")
|
@active_projects_count = current_user.projects.count(:conditions => "state = 'active'")
|
||||||
@hidden_projects_count = current_user.projects.count(:conditions => "state = 'hidden'")
|
@hidden_projects_count = current_user.projects.count(:conditions => "state = 'hidden'")
|
||||||
@completed_projects_count = current_user.projects.count(:conditions => "state = 'completed'")
|
@completed_projects_count = current_user.projects.count(:conditions => "state = 'completed'")
|
||||||
render :template => 'projects/update.js.rjs'
|
render :template => 'projects/update.js.rjs'
|
||||||
return
|
return
|
||||||
elsif boolean_param('update_status')
|
elsif boolean_param('update_status')
|
||||||
render :template => 'projects/update_status.js.rjs'
|
render :template => 'projects/update_status.js.rjs'
|
||||||
return
|
return
|
||||||
elsif boolean_param('update_default_context')
|
elsif boolean_param('update_default_context')
|
||||||
@initial_context_name = @project.default_context.name
|
@initial_context_name = @project.default_context.name
|
||||||
render :template => 'projects/update_default_context.js.rjs'
|
render :template => 'projects/update_default_context.js.rjs'
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
render :text => success_text || 'Success'
|
render :text => success_text || 'Success'
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
notify :warning, "Couldn't update project"
|
notify :warning, "Couldn't update project"
|
||||||
render :text => ''
|
render :text => ''
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
render :template => 'projects/update.js.rjs'
|
render :template => 'projects/update.js.rjs'
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@contexts = current_user.contexts
|
@contexts = current_user.contexts
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@project.destroy
|
@project.destroy
|
||||||
@active_projects_count = current_user.projects.count(:conditions => "state = 'active'")
|
@active_projects_count = current_user.projects.count(:conditions => "state = 'active'")
|
||||||
@hidden_projects_count = current_user.projects.count(:conditions => "state = 'hidden'")
|
@hidden_projects_count = current_user.projects.count(:conditions => "state = 'hidden'")
|
||||||
@completed_projects_count = current_user.projects.count(:conditions => "state = 'completed'")
|
@completed_projects_count = current_user.projects.count(:conditions => "state = 'completed'")
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js { @down_count = current_user.projects.size }
|
format.js { @down_count = current_user.projects.size }
|
||||||
format.xml { render :text => "Deleted project #{@project.name}" }
|
format.xml { render :text => "Deleted project #{@project.name}" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def order
|
def order
|
||||||
project_ids = params["list-active-projects"] || params["list-hidden-projects"] || params["list-completed-projects"]
|
project_ids = params["list-active-projects"] || params["list-hidden-projects"] || params["list-completed-projects"]
|
||||||
projects = current_user.projects.update_positions( project_ids )
|
projects = current_user.projects.update_positions( project_ids )
|
||||||
render :nothing => true
|
render :nothing => true
|
||||||
rescue
|
rescue
|
||||||
notify :error, $!
|
notify :error, $!
|
||||||
redirect_to :action => 'index'
|
redirect_to :action => 'index'
|
||||||
end
|
end
|
||||||
|
|
||||||
def alphabetize
|
def alphabetize
|
||||||
@state = params['state']
|
@state = params['state']
|
||||||
@projects = current_user.projects.alphabetize(:state => @state) if @state
|
@projects = current_user.projects.alphabetize(:state => @state) if @state
|
||||||
@contexts = current_user.contexts
|
@contexts = current_user.contexts
|
||||||
init_not_done_counts(['project'])
|
init_not_done_counts(['project'])
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def render_projects_html
|
def render_projects_html
|
||||||
lambda do
|
lambda do
|
||||||
@page_title = "TRACKS::List Projects"
|
@page_title = "TRACKS::List Projects"
|
||||||
@count = current_user.projects.size
|
@count = current_user.projects.size
|
||||||
@active_projects = @projects.select{ |p| p.active? }
|
@active_projects = @projects.select{ |p| p.active? }
|
||||||
@hidden_projects = @projects.select{ |p| p.hidden? }
|
@hidden_projects = @projects.select{ |p| p.hidden? }
|
||||||
@completed_projects = @projects.select{ |p| p.completed? }
|
@completed_projects = @projects.select{ |p| p.completed? }
|
||||||
@no_projects = @projects.empty?
|
@no_projects = @projects.empty?
|
||||||
@projects.cache_note_counts
|
@projects.cache_note_counts
|
||||||
@new_project = current_user.projects.build
|
@new_project = current_user.projects.build
|
||||||
render
|
render
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_projects_mobile
|
def render_projects_mobile
|
||||||
lambda do
|
lambda do
|
||||||
@active_projects = @projects.select{ |p| p.active? }
|
@active_projects = @projects.select{ |p| p.active? }
|
||||||
@hidden_projects = @projects.select{ |p| p.hidden? }
|
@hidden_projects = @projects.select{ |p| p.hidden? }
|
||||||
@completed_projects = @projects.select{ |p| p.completed? }
|
@completed_projects = @projects.select{ |p| p.completed? }
|
||||||
@down_count = @active_projects.size + @hidden_projects.size + @completed_projects.size
|
@down_count = @active_projects.size + @hidden_projects.size + @completed_projects.size
|
||||||
cookies[:mobile_url]=request.request_uri
|
cookies[:mobile_url]=request.request_uri
|
||||||
render :action => 'index_mobile'
|
render :action => 'index_mobile'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_project_mobile
|
def render_project_mobile
|
||||||
lambda do
|
lambda do
|
||||||
if @project.default_context.nil?
|
if @project.default_context.nil?
|
||||||
@project_default_context = "This project does not have a default context"
|
@project_default_context = "This project does not have a default context"
|
||||||
else
|
else
|
||||||
@project_default_context = "The default context for this project is "+
|
@project_default_context = "The default context for this project is "+
|
||||||
@project.default_context.name
|
@project.default_context.name
|
||||||
end
|
end
|
||||||
cookies[:mobile_url]=request.request_uri
|
cookies[:mobile_url]=request.request_uri
|
||||||
render :action => 'project_mobile'
|
@mobile_from_project = @project.id
|
||||||
end
|
render :action => 'project_mobile'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
def render_rss_feed
|
|
||||||
lambda do
|
def render_rss_feed
|
||||||
render_rss_feed_for @projects, :feed => feed_options,
|
lambda do
|
||||||
:item => { :title => :name, :description => lambda { |p| summary(p) } }
|
render_rss_feed_for @projects, :feed => feed_options,
|
||||||
end
|
:item => { :title => :name, :description => lambda { |p| summary(p) } }
|
||||||
end
|
end
|
||||||
|
end
|
||||||
def render_atom_feed
|
|
||||||
lambda do
|
def render_atom_feed
|
||||||
render_atom_feed_for @projects, :feed => feed_options,
|
lambda do
|
||||||
:item => { :description => lambda { |p| summary(p) },
|
render_atom_feed_for @projects, :feed => feed_options,
|
||||||
:title => :name,
|
:item => { :description => lambda { |p| summary(p) },
|
||||||
:author => lambda { |p| nil } }
|
:title => :name,
|
||||||
end
|
:author => lambda { |p| nil } }
|
||||||
end
|
end
|
||||||
|
end
|
||||||
def feed_options
|
|
||||||
Project.feed_options(current_user)
|
def feed_options
|
||||||
end
|
Project.feed_options(current_user)
|
||||||
|
end
|
||||||
def render_text_feed
|
|
||||||
lambda do
|
def render_text_feed
|
||||||
init_project_hidden_todo_counts(['project'])
|
lambda do
|
||||||
render :action => 'index', :layout => false, :content_type => Mime::TEXT
|
init_project_hidden_todo_counts(['project'])
|
||||||
end
|
render :action => 'index', :layout => false, :content_type => Mime::TEXT
|
||||||
end
|
end
|
||||||
|
end
|
||||||
def set_project_from_params
|
|
||||||
@project = current_user.projects.find_by_params(params)
|
def set_project_from_params
|
||||||
end
|
@project = current_user.projects.find_by_params(params)
|
||||||
|
end
|
||||||
def set_source_view
|
|
||||||
@source_view = params['_source_view'] || 'project'
|
def set_source_view
|
||||||
end
|
@source_view = params['_source_view'] || 'project'
|
||||||
|
end
|
||||||
def default_context_filter
|
|
||||||
p = params['project']
|
def default_context_filter
|
||||||
p = params['request']['project'] if p.nil? && params['request']
|
p = params['project']
|
||||||
p = {} if p.nil?
|
p = params['request']['project'] if p.nil? && params['request']
|
||||||
default_context_name = p['default_context_name']
|
p = {} if p.nil?
|
||||||
p.delete('default_context_name')
|
default_context_name = p['default_context_name']
|
||||||
|
p.delete('default_context_name')
|
||||||
unless default_context_name.blank?
|
|
||||||
default_context = Context.find_or_create_by_name(default_context_name)
|
unless default_context_name.blank?
|
||||||
p['default_context_id'] = default_context.id
|
default_context = Context.find_or_create_by_name(default_context_name)
|
||||||
end
|
p['default_context_id'] = default_context.id
|
||||||
end
|
end
|
||||||
|
end
|
||||||
def summary(project)
|
|
||||||
project_description = ''
|
def summary(project)
|
||||||
project_description += sanitize(markdown( project.description )) unless project.description.blank?
|
project_description = ''
|
||||||
project_description += "<p>#{count_undone_todos_phrase(p)}. "
|
project_description += sanitize(markdown( project.description )) unless project.description.blank?
|
||||||
project_description += "Project is #{project.state}."
|
project_description += "<p>#{count_undone_todos_phrase(p)}. "
|
||||||
project_description += "</p>"
|
project_description += "Project is #{project.state}."
|
||||||
project_description
|
project_description += "</p>"
|
||||||
end
|
project_description
|
||||||
|
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))+" | ") -%>
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,40 @@
|
||||||
<% @tag_list_text = ""
|
<% @tag_list_text = ""
|
||||||
@tag_list_text = tag_list_text if @todo -%>
|
@tag_list_text = tag_list_text if @todo -%>
|
||||||
<span class="errors">
|
<span class="errors">
|
||||||
<%= error_messages_for("todo") %>
|
<%= error_messages_for("todo") %>
|
||||||
</span>
|
</span>
|
||||||
<% this_year = user_time.to_date.strftime("%Y").to_i
|
<% this_year = user_time.to_date.strftime("%Y").to_i
|
||||||
if parent_container_type == 'show_mobile' -%>
|
if parent_container_type == 'show_mobile' -%>
|
||||||
<p><label for="todo_done">Done?</label> <%= check_box_tag("done", 1, @todo && @todo.completed?, "tabindex" => 1) %></p>
|
<p><label for="todo_done">Done?</label> <%= check_box_tag("done", 1, @todo && @todo.completed?, "tabindex" => 1) %></p>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<h2><label for="todo_description">Description</label></h2>
|
<h2><label for="todo_description">Description</label></h2>
|
||||||
<%= text_field( "todo", "description", "tabindex" => 2) %>
|
<%= text_field( "todo", "description", "tabindex" => 2) %>
|
||||||
<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
|
||||||
<h2><label for="todo_project_id">Project</label></h2>
|
collection_select( "todo", "context_id", @contexts, "id", "name", {}, {"tabindex" => 4} )
|
||||||
<%= collection_select( "todo", "project_id", @projects, "id", "name",
|
else
|
||||||
{:include_blank => true}, {"tabindex" => 5} ) %>
|
select_tag("todo[context_id]", options_from_collection_for_select(
|
||||||
<h2><label for="tag_list">Tags (separate with commas)</label></h2>
|
@contexts, "id", "name", @mobile_from_context.id),
|
||||||
<%= text_field_tag "tag_list", @tag_list_text, :size => 30, :tabindex => 6 %>
|
{"id" => :todo_context_id, :tabindex => 4} )
|
||||||
<h2><label for="todo_due">Due</label></h2>
|
end %>
|
||||||
<%= date_select("todo", "due", :order => [:day, :month, :year],
|
<h2><label for="todo_project_id">Project</label></h2>
|
||||||
:start_year => this_year, :include_blank => true) %>
|
<%= unless @mobile_from_project
|
||||||
<h2><label for="todo_show_from">Show from</label></h2>
|
collection_select( "todo", "project_id", @projects, "id", "name",
|
||||||
<%= date_select("todo", "show_from", :order => [:day, :month, :year],
|
{:include_blank => true}, {"tabindex" => 5} )
|
||||||
:start_year => this_year, :include_blank => true) %>
|
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>
|
||||||
|
<%= text_field_tag "tag_list", @tag_list_text, :size => 30, :tabindex => 6 %>
|
||||||
|
<h2><label for="todo_due">Due</label></h2>
|
||||||
|
<%= date_select("todo", "due", :order => [:day, :month, :year],
|
||||||
|
:start_year => this_year, :include_blank => true) %>
|
||||||
|
<h2><label for="todo_show_from">Show from</label></h2>
|
||||||
|
<%= date_select("todo", "show_from", :order => [:day, :month, :year],
|
||||||
|
:start_year => this_year, :include_blank => true) %>
|
||||||
|
|
|
||||||
|
|
@ -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