2008-07-19 20:27:45 +02:00
|
|
|
module RecurringTodosHelper
|
|
|
|
|
|
|
|
|
|
def recurring_todo_tag_list
|
|
|
|
|
tags_except_starred = @recurring_todo.tags.reject{|t| t.name == Todo::STARRED_TAG_NAME}
|
2008-11-29 20:15:49 +01:00
|
|
|
tag_list = tags_except_starred.collect{|t| "<span class=\"tag #{t.name.gsub(' ','-')}\">" +
|
2011-10-08 21:32:15 -05:00
|
|
|
link_to(t.name, :controller => "todos", :action => "tag", :id =>
|
|
|
|
|
t.name) + #TODO: tag view for recurring_todos (yet?)
|
2008-07-19 20:27:45 +02:00
|
|
|
"</span>"}.join('')
|
|
|
|
|
"<span class='tags'>#{tag_list}</span>"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def recurring_todo_remote_delete_icon
|
2009-09-07 18:44:23 -04:00
|
|
|
link_to( image_tag_for_delete,
|
2008-07-19 20:27:45 +02:00
|
|
|
recurring_todo_path(@recurring_todo), :id => "delete_icon_"+@recurring_todo.id.to_s,
|
2011-02-09 20:41:34 +01:00
|
|
|
:class => "icon delete_icon", :title => t('todos.delete_recurring_action_title'), :x_confirm_message => t('todos.delete_recurring_action_confirm', :description => @recurring_todo.description))
|
2008-07-19 20:27:45 +02:00
|
|
|
end
|
|
|
|
|
|
2008-11-29 20:15:49 +01:00
|
|
|
def recurring_todo_remote_star_icon
|
2009-09-07 18:44:23 -04:00
|
|
|
link_to( image_tag_for_star(@recurring_todo),
|
2010-12-04 22:28:31 +01:00
|
|
|
toggle_star_recurring_todo_path(@recurring_todo), :id => "star_icon_"+@recurring_todo.id.to_s,
|
2010-10-31 21:27:13 +08:00
|
|
|
:class => "icon star_item", :title => t('todos.star_action'))
|
2008-07-19 20:27:45 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def recurring_todo_remote_edit_icon
|
|
|
|
|
if !@recurring_todo.completed?
|
|
|
|
|
str = link_to( image_tag_for_edit(@recurring_todo),
|
|
|
|
|
edit_recurring_todo_path(@recurring_todo),
|
2010-12-04 22:28:31 +01:00
|
|
|
:class => "icon edit_icon", :id => "link_edit_recurring_todo_#{@recurring_todo.id}")
|
2008-07-19 20:27:45 +02:00
|
|
|
else
|
|
|
|
|
str = '<a class="icon">' + image_tag("blank.png") + "</a> "
|
|
|
|
|
end
|
|
|
|
|
str
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def recurring_todo_remote_toggle_checkbox
|
2010-12-04 22:28:31 +01:00
|
|
|
return check_box_tag("check_#{@recurring_todo.id}", toggle_check_recurring_todo_path(@recurring_todo), @recurring_todo.completed?, :class => 'item-checkbox')
|
2008-07-19 20:27:45 +02:00
|
|
|
end
|
2009-03-27 09:57:34 +01:00
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def image_tag_for_delete
|
2010-10-31 21:27:13 +08:00
|
|
|
image_tag("blank.png", :title =>t('todos.delete_action'), :class=>"delete_item")
|
2009-03-27 09:57:34 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def image_tag_for_edit(todo)
|
2010-10-31 21:27:13 +08:00
|
|
|
image_tag("blank.png", :title =>t('todos.edit_action'), :class=>"edit_item", :id=> dom_id(todo, 'edit_icon'))
|
2009-03-27 09:57:34 +01:00
|
|
|
end
|
2009-09-07 18:44:23 -04:00
|
|
|
end
|