tracks/app/helpers/recurring_todos_helper.rb
Marcus Ilgner fd3f69d927 Changed code to support basic i18n.
Added RubyMine configuration and rvm setup to .gitignore.
2010-11-09 16:31:26 +08:00

50 lines
1.8 KiB
Ruby

module RecurringTodosHelper
def recurring_todo_tag_list
tags_except_starred = @recurring_todo.tags.reject{|t| t.name == Todo::STARRED_TAG_NAME}
tag_list = tags_except_starred.collect{|t| "<span class=\"tag #{t.name.gsub(' ','-')}\">" +
# link_to(t.name, :controller => "todos", :action => "tag", :id =>
# t.name) + TODO: tag view for recurring_todos (yet?)
t.name +
"</span>"}.join('')
"<span class='tags'>#{tag_list}</span>"
end
def recurring_todo_remote_delete_icon
link_to( image_tag_for_delete,
recurring_todo_path(@recurring_todo), :id => "delete_icon_"+@recurring_todo.id.to_s,
:class => "icon delete_icon", :title => t('todos.delete_recurring_action', :description => @recurring_todo.description))
end
def recurring_todo_remote_star_icon
link_to( image_tag_for_star(@recurring_todo),
toggle_star_recurring_todo_path(@recurring_todo),
:class => "icon star_item", :title => t('todos.star_action'))
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),
:class => "icon edit_icon")
else
str = '<a class="icon">' + image_tag("blank.png") + "</a> "
end
str
end
def recurring_todo_remote_toggle_checkbox
str = check_box_tag('item_id', toggle_check_recurring_todo_path(@recurring_todo), @recurring_todo.completed?, :class => 'item-checkbox')
str
end
private
def image_tag_for_delete
image_tag("blank.png", :title =>t('todos.delete_action'), :class=>"delete_item")
end
def image_tag_for_edit(todo)
image_tag("blank.png", :title =>t('todos.edit_action'), :class=>"edit_item", :id=> dom_id(todo, 'edit_icon'))
end
end