mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-22 10:10:12 +01:00
fix suppressing some edit actions on certain views that were enables incorrectly
This commit is contained in:
parent
4f8132adc2
commit
1dca4747f3
4 changed files with 253 additions and 294 deletions
|
|
@ -1,287 +1,239 @@
|
||||||
module TodosHelper
|
module TodosHelper
|
||||||
|
|
||||||
# #require 'users_controller' Counts the number of incomplete items in the
|
# #require 'users_controller' Counts the number of incomplete items in the
|
||||||
# specified context
|
# specified context
|
||||||
#
|
#
|
||||||
def count_items(context)
|
def count_items(context)
|
||||||
count = Todo.find_all("done=0 AND context_id=#{context.id}").length
|
count = Todo.find_all("done=0 AND context_id=#{context.id}").length
|
||||||
end
|
end
|
||||||
|
|
||||||
def form_remote_tag_edit_todo( &block )
|
def form_remote_tag_edit_todo( &block )
|
||||||
form_tag(
|
form_tag(
|
||||||
todo_path(@todo), {
|
todo_path(@todo), {
|
||||||
:method => :put,
|
:method => :put,
|
||||||
:id => dom_id(@todo, 'form'),
|
:id => dom_id(@todo, 'form'),
|
||||||
:class => dom_id(@todo, 'form') + " inline-form edit_todo_form" },
|
:class => dom_id(@todo, 'form') + " inline-form edit_todo_form" },
|
||||||
&block )
|
&block )
|
||||||
apply_behavior 'form.edit_todo_form', make_remote_form(
|
apply_behavior 'form.edit_todo_form', make_remote_form(
|
||||||
:method => :put,
|
:method => :put,
|
||||||
:before => "this.down('button.positive').startWaiting()",
|
:before => "this.down('button.positive').startWaiting()",
|
||||||
:loaded => "this.down('button.positive').stopWaiting()",
|
:loaded => "this.down('button.positive').stopWaiting()",
|
||||||
:condition => "!(this.down('button.positive').isWaiting())"),
|
:condition => "!(this.down('button.positive').isWaiting())"),
|
||||||
:prevent_default => true
|
:prevent_default => true
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_behavior_for_delete_icon
|
def set_behavior_for_star_icon
|
||||||
parameters = "_source_view=#{@source_view}"
|
apply_behavior '.item-container a.star_item:click',
|
||||||
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
remote_to_href(:method => 'put', :with => "{ _source_view : '#{@source_view}' }"),
|
||||||
apply_behavior '.item-container a.delete_icon:click', :prevent_default => true do |page|
|
:prevent_default => true
|
||||||
page.confirming "'Are you sure that you want to ' + this.title + '?'" do
|
end
|
||||||
page << "itemContainer = this.up('.item-container'); itemContainer.startWaiting();"
|
|
||||||
page << remote_to_href(:method => 'delete', :with => "'#{parameters}'", :complete => "itemContainer.stopWaiting();")
|
def remote_star_icon
|
||||||
end
|
str = link_to( image_tag_for_star(@todo),
|
||||||
end
|
toggle_star_todo_path(@todo),
|
||||||
end
|
:class => "icon star_item", :title => "star the action '#{@todo.description}'")
|
||||||
|
set_behavior_for_star_icon
|
||||||
def remote_delete_icon
|
str
|
||||||
str = link_to( image_tag_for_delete,
|
end
|
||||||
todo_path(@todo), :id => "delete_icon_"+@todo.id.to_s,
|
|
||||||
:class => "icon delete_icon", :title => "delete the action '#{@todo.description}'")
|
def set_behavior_for_toggle_checkbox
|
||||||
set_behavior_for_delete_icon
|
parameters = "_source_view=#{@source_view}"
|
||||||
str
|
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
||||||
end
|
apply_behavior '.item-container input.item-checkbox:click',
|
||||||
|
remote_function(:url => javascript_variable('this.value'), :method => 'put',
|
||||||
def set_behavior_for_star_icon
|
:with => "'#{parameters}'")
|
||||||
apply_behavior '.item-container a.star_item:click',
|
end
|
||||||
remote_to_href(:method => 'put', :with => "{ _source_view : '#{@source_view}' }"),
|
|
||||||
:prevent_default => true
|
def remote_toggle_checkbox
|
||||||
end
|
str = check_box_tag('item_id', toggle_check_todo_path(@todo), @todo.completed?, :class => 'item-checkbox')
|
||||||
|
set_behavior_for_toggle_checkbox
|
||||||
def remote_star_icon
|
str
|
||||||
str = link_to( image_tag_for_star(@todo),
|
end
|
||||||
toggle_star_todo_path(@todo),
|
|
||||||
:class => "icon star_item", :title => "star the action '#{@todo.description}'")
|
def date_span
|
||||||
set_behavior_for_star_icon
|
if @todo.completed?
|
||||||
str
|
"<span class=\"grey\">#{format_date( @todo.completed_at )}</span>"
|
||||||
end
|
elsif @todo.deferred?
|
||||||
|
show_date( @todo.show_from )
|
||||||
def set_behavior_for_edit_icon
|
else
|
||||||
parameters = "_source_view=#{@source_view}"
|
due_date( @todo.due )
|
||||||
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
end
|
||||||
apply_behavior '.item-container a.edit_icon:click', :prevent_default => true do |page|
|
end
|
||||||
page << "Effect.Pulsate(this);"
|
|
||||||
page << remote_to_href(:method => 'get', :with => "'#{parameters}'")
|
def tag_list_text
|
||||||
end
|
@todo.tags.collect{|t| t.name}.join(', ')
|
||||||
end
|
end
|
||||||
|
|
||||||
def remote_edit_icon
|
def tag_list
|
||||||
if !@todo.completed?
|
tags_except_starred = @todo.tags.reject{|t| t.name == Todo::STARRED_TAG_NAME}
|
||||||
str = link_to( image_tag_for_edit(@todo),
|
tag_list = tags_except_starred.collect{|t| "<span class=\"tag #{t.name.gsub(' ','-')}\">" + link_to(t.name, :controller => "todos", :action => "tag", :id => t.name) + "</span>"}.join('')
|
||||||
edit_todo_path(@todo),
|
"<span class='tags'>#{tag_list}</span>"
|
||||||
:class => "icon edit_icon")
|
end
|
||||||
set_behavior_for_edit_icon
|
|
||||||
else
|
def tag_list_mobile
|
||||||
str = '<a class="icon">' + image_tag("blank.png") + "</a> "
|
tags_except_starred = @todo.tags.reject{|t| t.name == Todo::STARRED_TAG_NAME}
|
||||||
end
|
# removed the link. TODO: add link to mobile view of tagged actions
|
||||||
str
|
tag_list = tags_except_starred.collect{|t|
|
||||||
end
|
"<span class=\"tag\">" +
|
||||||
|
link_to(t.name, {:action => "tag", :controller => "todos", :id => t.name+".m"}) +
|
||||||
def set_behavior_for_toggle_checkbox
|
"</span>"}.join('')
|
||||||
parameters = "_source_view=#{@source_view}"
|
if tag_list.empty? then "" else "<span class=\"tags\">#{tag_list}</span>" end
|
||||||
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
end
|
||||||
apply_behavior '.item-container input.item-checkbox:click',
|
|
||||||
remote_function(:url => javascript_variable('this.value'), :method => 'put',
|
def deferred_due_date
|
||||||
:with => "'#{parameters}'")
|
if @todo.deferred? && @todo.due
|
||||||
end
|
"(action due on #{format_date(@todo.due)})"
|
||||||
|
end
|
||||||
def remote_toggle_checkbox
|
end
|
||||||
str = check_box_tag('item_id', toggle_check_todo_path(@todo), @todo.completed?, :class => 'item-checkbox')
|
|
||||||
set_behavior_for_toggle_checkbox
|
def project_and_context_links(parent_container_type, opts = {})
|
||||||
str
|
str = ''
|
||||||
end
|
if @todo.completed?
|
||||||
|
str += @todo.context.name unless opts[:suppress_context]
|
||||||
def date_span
|
should_suppress_project = opts[:suppress_project] || @todo.project.nil?
|
||||||
if @todo.completed?
|
str += ", " unless str.blank? || should_suppress_project
|
||||||
"<span class=\"grey\">#{format_date( @todo.completed_at )}</span>"
|
str += @todo.project.name unless should_suppress_project
|
||||||
elsif @todo.deferred?
|
str = "(#{str})" unless str.blank?
|
||||||
show_date( @todo.show_from )
|
else
|
||||||
else
|
if (['project', 'tag', 'stats', 'search'].include?(parent_container_type))
|
||||||
due_date( @todo.due )
|
str << item_link_to_context( @todo )
|
||||||
end
|
end
|
||||||
end
|
if (['context', 'tickler', 'tag', 'stats', 'search'].include?(parent_container_type)) && @todo.project_id
|
||||||
|
str << item_link_to_project( @todo )
|
||||||
def tag_list_text
|
end
|
||||||
@todo.tags.collect{|t| t.name}.join(', ')
|
end
|
||||||
end
|
return str
|
||||||
|
end
|
||||||
def tag_list
|
|
||||||
tags_except_starred = @todo.tags.reject{|t| t.name == Todo::STARRED_TAG_NAME}
|
# Uses the 'staleness_starts' value from settings.yml (in days) to colour the
|
||||||
tag_list = tags_except_starred.collect{|t| "<span class=\"tag #{t.name.gsub(' ','-')}\">" + link_to(t.name, :controller => "todos", :action => "tag", :id => t.name) + "</span>"}.join('')
|
# background of the action appropriately according to the age of the creation
|
||||||
"<span class='tags'>#{tag_list}</span>"
|
# date:
|
||||||
end
|
# * l1: created more than 1 x staleness_starts, but < 2 x staleness_starts
|
||||||
|
# * l2: created more than 2 x staleness_starts, but < 3 x staleness_starts
|
||||||
def tag_list_mobile
|
# * l3: created more than 3 x staleness_starts
|
||||||
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
|
def staleness_class(item)
|
||||||
tag_list = tags_except_starred.collect{|t|
|
if item.due || item.completed?
|
||||||
"<span class=\"tag\">" +
|
return ""
|
||||||
link_to(t.name, {:action => "tag", :controller => "todos", :id => t.name+".m"}) +
|
elsif item.created_at < user_time - (prefs.staleness_starts * 3).days
|
||||||
"</span>"}.join('')
|
return " stale_l3"
|
||||||
if tag_list.empty? then "" else "<span class=\"tags\">#{tag_list}</span>" end
|
elsif item.created_at < user_time - (prefs.staleness_starts * 2).days
|
||||||
end
|
return " stale_l2"
|
||||||
|
elsif item.created_at < user_time - (prefs.staleness_starts).days
|
||||||
def deferred_due_date
|
return " stale_l1"
|
||||||
if @todo.deferred? && @todo.due
|
else
|
||||||
"(action due on #{format_date(@todo.due)})"
|
return ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def project_and_context_links(parent_container_type, opts = {})
|
# Check show_from date in comparison to today's date Flag up date
|
||||||
str = ''
|
# appropriately with a 'traffic light' colour code
|
||||||
if @todo.completed?
|
#
|
||||||
str += @todo.context.name unless opts[:suppress_context]
|
def show_date(d)
|
||||||
should_suppress_project = opts[:suppress_project] || @todo.project.nil?
|
if d == nil
|
||||||
str += ", " unless str.blank? || should_suppress_project
|
return ""
|
||||||
str += @todo.project.name unless should_suppress_project
|
end
|
||||||
str = "(#{str})" unless str.blank?
|
|
||||||
else
|
days = days_from_today(d)
|
||||||
if (['project', 'tag', 'stats', 'search'].include?(parent_container_type))
|
|
||||||
str << item_link_to_context( @todo )
|
case days
|
||||||
end
|
# overdue or due very soon! sound the alarm!
|
||||||
if (['context', 'tickler', 'tag', 'stats', 'search'].include?(parent_container_type)) && @todo.project_id
|
when -1000..-1
|
||||||
str << item_link_to_project( @todo )
|
"<a title=\"" + format_date(d) + "\"><span class=\"red\">Scheduled to show " + (days * -1).to_s + " days ago</span></a> "
|
||||||
end
|
when 0
|
||||||
end
|
"<a title=\"" + format_date(d) + "\"><span class=\"amber\">Show Today</span></a> "
|
||||||
return str
|
when 1
|
||||||
end
|
"<a title=\"" + format_date(d) + "\"><span class=\"amber\">Show Tomorrow</span></a> "
|
||||||
|
# due 2-7 days away
|
||||||
# Uses the 'staleness_starts' value from settings.yml (in days) to colour the
|
when 2..7
|
||||||
# background of the action appropriately according to the age of the creation
|
if prefs.due_style == Preference.due_styles[:due_on]
|
||||||
# date:
|
"<a title=\"" + format_date(d) + "\"><span class=\"orange\">Show on " + d.strftime("%A") + "</span></a> "
|
||||||
# * l1: created more than 1 x staleness_starts, but < 2 x staleness_starts
|
else
|
||||||
# * l2: created more than 2 x staleness_starts, but < 3 x staleness_starts
|
"<a title=\"" + format_date(d) + "\"><span class=\"orange\">Show in " + days.to_s + " days</span></a> "
|
||||||
# * l3: created more than 3 x staleness_starts
|
end
|
||||||
#
|
# more than a week away - relax
|
||||||
def staleness_class(item)
|
else
|
||||||
if item.due || item.completed?
|
"<a title=\"" + format_date(d) + "\"><span class=\"green\">Show in " + days.to_s + " days</span></a> "
|
||||||
return ""
|
end
|
||||||
elsif item.created_at < user_time - (prefs.staleness_starts * 3).days
|
end
|
||||||
return " stale_l3"
|
|
||||||
elsif item.created_at < user_time - (prefs.staleness_starts * 2).days
|
def calendar_setup( input_field )
|
||||||
return " stale_l2"
|
str = "Calendar.setup({ ifFormat:\"#{prefs.date_format}\""
|
||||||
elsif item.created_at < user_time - (prefs.staleness_starts).days
|
str << ",firstDay:#{prefs.week_starts},showOthers:true,range:[2004, 2010]"
|
||||||
return " stale_l1"
|
str << ",step:1,inputField:\"" + input_field + "\",cache:true,align:\"TR\" })\n"
|
||||||
else
|
javascript_tag str
|
||||||
return ""
|
end
|
||||||
end
|
|
||||||
end
|
def item_container_id (todo)
|
||||||
|
if source_view_is :project
|
||||||
# Check show_from date in comparison to today's date Flag up date
|
return "p#{todo.project_id}" if todo.active?
|
||||||
# appropriately with a 'traffic light' colour code
|
return "tickler" if todo.deferred?
|
||||||
#
|
end
|
||||||
def show_date(d)
|
return "c#{todo.context_id}"
|
||||||
if d == nil
|
end
|
||||||
return ""
|
|
||||||
end
|
def should_show_new_item
|
||||||
|
|
||||||
days = days_from_today(d)
|
if @todo.project.nil? == false
|
||||||
|
# do not show new actions that were added to hidden or completed projects
|
||||||
case days
|
# on home page and context page
|
||||||
# overdue or due very soon! sound the alarm!
|
return false if source_view_is(:todo) && (@todo.project.hidden? || @todo.project.completed?)
|
||||||
when -1000..-1
|
return false if source_view_is(:context) && (@todo.project.hidden? || @todo.project.completed?)
|
||||||
"<a title=\"" + format_date(d) + "\"><span class=\"red\">Scheduled to show " + (days * -1).to_s + " days ago</span></a> "
|
end
|
||||||
when 0
|
|
||||||
"<a title=\"" + format_date(d) + "\"><span class=\"amber\">Show Today</span></a> "
|
return true if source_view_is(:deferred) && @todo.deferred?
|
||||||
when 1
|
return true if source_view_is(:project) && @todo.project.hidden? && @todo.project_hidden?
|
||||||
"<a title=\"" + format_date(d) + "\"><span class=\"amber\">Show Tomorrow</span></a> "
|
return true if source_view_is(:project) && @todo.deferred?
|
||||||
# due 2-7 days away
|
return true if !source_view_is(:deferred) && @todo.active?
|
||||||
when 2..7
|
return false
|
||||||
if prefs.due_style == Preference.due_styles[:due_on]
|
end
|
||||||
"<a title=\"" + format_date(d) + "\"><span class=\"orange\">Show on " + d.strftime("%A") + "</span></a> "
|
|
||||||
else
|
def parent_container_type
|
||||||
"<a title=\"" + format_date(d) + "\"><span class=\"orange\">Show in " + days.to_s + " days</span></a> "
|
return 'tickler' if source_view_is :deferred
|
||||||
end
|
return 'project' if source_view_is :project
|
||||||
# more than a week away - relax
|
return 'stats' if source_view_is :stats
|
||||||
else
|
return 'context'
|
||||||
"<a title=\"" + format_date(d) + "\"><span class=\"green\">Show in " + days.to_s + " days</span></a> "
|
end
|
||||||
end
|
|
||||||
end
|
def empty_container_msg_div_id
|
||||||
|
return "tickler-empty-nd" if source_view_is(:project) && @todo.deferred?
|
||||||
def calendar_setup( input_field )
|
return "p#{@todo.project_id}empty-nd" if source_view_is :project
|
||||||
str = "Calendar.setup({ ifFormat:\"#{prefs.date_format}\""
|
return "c#{@todo.context_id}empty-nd"
|
||||||
str << ",firstDay:#{prefs.week_starts},showOthers:true,range:[2004, 2010]"
|
end
|
||||||
str << ",step:1,inputField:\"" + input_field + "\",cache:true,align:\"TR\" })\n"
|
|
||||||
javascript_tag str
|
def project_names_for_autocomplete
|
||||||
end
|
array_or_string_for_javascript( ['None'] + current_user.projects.active.collect{|p| escape_javascript(p.name) } )
|
||||||
|
end
|
||||||
def item_container_id (todo)
|
|
||||||
if source_view_is :project
|
def context_names_for_autocomplete
|
||||||
return "p#{todo.project_id}" if todo.active?
|
# #return array_or_string_for_javascript(['Create a new context']) if
|
||||||
return "tickler" if todo.deferred?
|
# @contexts.empty?
|
||||||
end
|
array_or_string_for_javascript( current_user.contexts.collect{|c| escape_javascript(c.name) } )
|
||||||
return "c#{todo.context_id}"
|
end
|
||||||
end
|
|
||||||
|
def format_ical_notes(notes)
|
||||||
def should_show_new_item
|
split_notes = notes.split(/\n/)
|
||||||
|
joined_notes = split_notes.join("\\n")
|
||||||
if @todo.project.nil? == false
|
end
|
||||||
# do not show new actions that were added to hidden or completed projects
|
|
||||||
# on home page and context page
|
def formatted_pagination(total)
|
||||||
return false if source_view_is(:todo) && (@todo.project.hidden? || @todo.project.completed?)
|
s = will_paginate(@todos)
|
||||||
return false if source_view_is(:context) && (@todo.project.hidden? || @todo.project.completed?)
|
(s.gsub(/(<\/[^<]+>)/, '\1 ')).chomp(' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
return true if source_view_is(:deferred) && @todo.deferred?
|
def date_field_tag(name, id, value = nil, options = {})
|
||||||
return true if source_view_is(:project) && @todo.project.hidden? && @todo.project_hidden?
|
text_field_tag name, value, {"size" => 12, "id" => id, "class" => "Date", "onfocus" => "Calendar.setup", "autocomplete" => "off"}.update(options.stringify_keys)
|
||||||
return true if source_view_is(:project) && @todo.deferred?
|
end
|
||||||
return true if !source_view_is(:deferred) && @todo.active?
|
|
||||||
return false
|
private
|
||||||
end
|
|
||||||
|
def image_tag_for_star(todo)
|
||||||
def parent_container_type
|
class_str = todo.starred? ? "starred_todo" : "unstarred_todo"
|
||||||
return 'tickler' if source_view_is :deferred
|
image_tag("blank.png", :title =>"Star action", :class => class_str)
|
||||||
return 'project' if source_view_is :project
|
end
|
||||||
return 'stats' if source_view_is :stats
|
|
||||||
return 'context'
|
def defer_link(days)
|
||||||
end
|
link_to_remote image_tag("defer_#{days}.png", :alt => "Defer #{pluralize(days, 'day')}"), :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => days, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}
|
||||||
|
end
|
||||||
def empty_container_msg_div_id
|
|
||||||
return "tickler-empty-nd" if source_view_is(:project) && @todo.deferred?
|
end
|
||||||
return "p#{@todo.project_id}empty-nd" if source_view_is :project
|
|
||||||
return "c#{@todo.context_id}empty-nd"
|
|
||||||
end
|
|
||||||
|
|
||||||
def project_names_for_autocomplete
|
|
||||||
array_or_string_for_javascript( ['None'] + current_user.projects.active.collect{|p| escape_javascript(p.name) } )
|
|
||||||
end
|
|
||||||
|
|
||||||
def context_names_for_autocomplete
|
|
||||||
# #return array_or_string_for_javascript(['Create a new context']) if
|
|
||||||
# @contexts.empty?
|
|
||||||
array_or_string_for_javascript( current_user.contexts.collect{|c| escape_javascript(c.name) } )
|
|
||||||
end
|
|
||||||
|
|
||||||
def format_ical_notes(notes)
|
|
||||||
split_notes = notes.split(/\n/)
|
|
||||||
joined_notes = split_notes.join("\\n")
|
|
||||||
end
|
|
||||||
|
|
||||||
def formatted_pagination(total)
|
|
||||||
s = will_paginate(@todos)
|
|
||||||
(s.gsub(/(<\/[^<]+>)/, '\1 ')).chomp(' ')
|
|
||||||
end
|
|
||||||
|
|
||||||
def date_field_tag(name, id, value = nil, options = {})
|
|
||||||
text_field_tag name, value, {"size" => 12, "id" => id, "class" => "Date", "onfocus" => "Calendar.setup", "autocomplete" => "off"}.update(options.stringify_keys)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def image_tag_for_delete
|
|
||||||
image_tag("blank.png", :title =>"Delete action", :class=>"delete_item")
|
|
||||||
end
|
|
||||||
|
|
||||||
def image_tag_for_edit(todo)
|
|
||||||
image_tag("blank.png", :title =>"Edit action", :class=>"edit_item", :id=> dom_id(todo, 'edit_icon'))
|
|
||||||
end
|
|
||||||
|
|
||||||
def image_tag_for_star(todo)
|
|
||||||
class_str = todo.starred? ? "starred_todo" : "unstarred_todo"
|
|
||||||
image_tag("blank.png", :title =>"Star action", :class => class_str)
|
|
||||||
end
|
|
||||||
|
|
||||||
def defer_link(days)
|
|
||||||
link_to_remote image_tag("defer_#{days}.png", :alt => "Defer #{pluralize(days, 'day')}"), :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => days, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,7 @@
|
||||||
<%= render :partial => "todos/todo", :collection => @not_done, :locals => { :parent_container_type => "context" } %>
|
<%= render :partial => "todos/todo", :collection => @not_done, :locals => { :parent_container_type => "context" } %>
|
||||||
<% if @not_done.empty?
|
<% if @not_done.empty?
|
||||||
# fix (hack) for #713
|
# fix (hack) for #713
|
||||||
set_behavior_for_delete_icon
|
|
||||||
set_behavior_for_star_icon
|
set_behavior_for_star_icon
|
||||||
set_behavior_for_edit_icon
|
|
||||||
set_behavior_for_toggle_checkbox
|
set_behavior_for_toggle_checkbox
|
||||||
end
|
end
|
||||||
-%>
|
-%>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
@todo = todo
|
@todo = todo
|
||||||
suppress_context ||= false
|
suppress_context ||= false
|
||||||
suppress_project ||= false
|
suppress_project ||= false
|
||||||
suppress_edit_button ||= false
|
suppress_edit_button ||= todo.completed?
|
||||||
parameters = "_source_view=#{@source_view}"
|
parameters = "_source_view=#{@source_view}"
|
||||||
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
||||||
@z_index_counter = @z_index_counter - 1 # for IE z-index bug
|
@z_index_counter = @z_index_counter - 1 # for IE z-index bug
|
||||||
|
|
@ -12,10 +12,14 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
||||||
<%= remote_star_icon %>
|
<%= remote_star_icon %>
|
||||||
<%= remote_toggle_checkbox unless source_view_is :deferred %>
|
<%= remote_toggle_checkbox unless source_view_is :deferred %>
|
||||||
<ul class="sf-menu sf-item-menu"><li style="z-index:<%=@z_index_counter%>"><%= image_tag "downarrow.png", :alt=> "" %><ul id="ul<%= dom_id(todo) %>">
|
<ul class="sf-menu sf-item-menu"><li style="z-index:<%=@z_index_counter%>"><%= image_tag "downarrow.png", :alt=> "" %><ul id="ul<%= dom_id(todo) %>">
|
||||||
<li><%= link_to_remote("Edit", :url => {:controller => 'todos', :action => 'edit', :id => @todo.id}, :method => 'get', :with => "'#{parameters}'", :before => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();") %></li>
|
<% unless suppress_edit_button %>
|
||||||
|
<li><%= link_to_remote("Edit", :url => {:controller => 'todos', :action => 'edit', :id => @todo.id}, :method => 'get', :with => "'#{parameters}'", :before => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();") %></li>
|
||||||
|
<% end %>
|
||||||
<li><%= link_to_remote "Delete", :url => {:controller => 'todos', :action => 'destroy', :id => @todo.id}, :method => 'delete', :with => "'#{parameters}'", :before => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();" %></li>
|
<li><%= link_to_remote "Delete", :url => {:controller => 'todos', :action => 'destroy', :id => @todo.id}, :method => 'delete', :with => "'#{parameters}'", :before => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();" %></li>
|
||||||
<li><%= link_to_remote "Defer 1 day", :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => 1, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}, :before => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();" %></li>
|
<% unless todo.completed? || todo.deferred? %>
|
||||||
<li><%= link_to_remote "Defer 7 days", :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => 7, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}, :before => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();" %></li>
|
<li><%= link_to_remote "Defer 1 day", :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => 1, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}, :before => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();" %></li>
|
||||||
|
<li><%= link_to_remote "Defer 7 days", :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => 7, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}, :before => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();" %></li>
|
||||||
|
<% end %>
|
||||||
</ul></ul>
|
</ul></ul>
|
||||||
<div class="description<%= staleness_class( todo ) %>">
|
<div class="description<%= staleness_class( todo ) %>">
|
||||||
<%= date_span -%>
|
<%= date_span -%>
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,15 @@
|
||||||
* Mailing list: http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss
|
* Mailing list: http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss
|
||||||
* Original developer: bsag (http://www.rousette.org.uk/)
|
* Original developer: bsag (http://www.rousette.org.uk/)
|
||||||
* Contributors: http://getontracks.org/wiki/Tracks/Contributing/Contributors
|
* Contributors: http://getontracks.org/wiki/Tracks/Contributing/Contributors
|
||||||
* Version: 1.7
|
* Version: 1.8devel
|
||||||
* Copyright: (cc) 2004-2009 rousette.org.uk.
|
* Copyright: (cc) 2004-2009 rousette.org.uk.
|
||||||
* License: GNU GPL
|
* License: GNU GPL
|
||||||
|
|
||||||
|
== Version 1.7devel
|
||||||
|
|
||||||
|
New features:
|
||||||
|
1. Redesign of menus and introduction of a context menu per todo
|
||||||
|
|
||||||
== Version 1.7
|
== Version 1.7
|
||||||
|
|
||||||
New features:
|
New features:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue