2008-07-19 20:27:45 +02:00
|
|
|
module RecurringTodosHelper
|
|
|
|
|
def recurring_todo_tag_list
|
2020-10-27 21:39:19 +02:00
|
|
|
tags_except_starred = @recurring_todo.tags.reject { |t| t.name == Todo::STARRED_TAG_NAME }
|
2020-10-10 02:27:42 +03:00
|
|
|
tag_list = tags_except_starred
|
2020-10-27 21:39:19 +02:00
|
|
|
.collect { |t| content_tag(:span, link_to(t.name, tag_path(t.name)), :class => "tag #{t.label}") }
|
2020-10-10 02:27:42 +03:00
|
|
|
.join('')
|
2012-05-12 15:37:13 +02:00
|
|
|
return content_tag :span, tag_list.html_safe, :class => "tags"
|
2008-07-19 20:27:45 +02:00
|
|
|
end
|
2014-08-14 21:05:05 -05:00
|
|
|
|
2008-07-19 20:27:45 +02:00
|
|
|
def recurring_todo_remote_delete_icon
|
2020-10-10 02:27:42 +03:00
|
|
|
link_to(image_tag_for_delete, 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
|
2014-08-14 21:05:05 -05:00
|
|
|
|
2008-11-29 20:15:49 +01:00
|
|
|
def recurring_todo_remote_star_icon
|
2020-10-10 02:27:42 +03:00
|
|
|
link_to(image_tag_for_star(@recurring_todo),
|
|
|
|
|
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
|
2014-08-14 21:05:05 -05:00
|
|
|
|
2008-07-19 20:27:45 +02:00
|
|
|
def recurring_todo_remote_edit_icon
|
|
|
|
|
if !@recurring_todo.completed?
|
2020-10-10 02:27:42 +03:00
|
|
|
str = link_to(image_tag_for_edit(@recurring_todo),
|
2008-07-19 20:27:45 +02:00
|
|
|
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
|
2012-05-18 15:33:47 +02:00
|
|
|
str = content_tag(:a, image_tag("blank.png"), :class => "icon")
|
2008-07-19 20:27:45 +02:00
|
|
|
end
|
|
|
|
|
str
|
|
|
|
|
end
|
2014-08-14 21:05:05 -05:00
|
|
|
|
2008-07-19 20:27:45 +02:00
|
|
|
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
|
2020-10-10 02:27:42 +03: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)
|
2020-10-10 02:27:42 +03: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
|