Commit 42cbcb23 authored by Douwe Maan's avatar Douwe Maan

"X assigned you Y" instead of "X assigned Y"

parent d53ae7f1
...@@ -7,6 +7,13 @@ module TodosHelper ...@@ -7,6 +7,13 @@ module TodosHelper
current_user.todos.done.count current_user.todos.done.count
end end
def todo_action_name(todo)
case todo.action
when Todo::ASSIGNED then 'assigned you'
when Todo::MENTIONED then 'mentioned you on'
end
end
def todo_target_link(todo) def todo_target_link(todo)
target = todo.target_type.titleize.downcase target = todo.target_type.titleize.downcase
link_to "#{target} #{todo.target.to_reference}", todo_target_path(todo) link_to "#{target} #{todo.target.to_reference}", todo_target_path(todo)
......
...@@ -43,13 +43,6 @@ class Todo < ActiveRecord::Base ...@@ -43,13 +43,6 @@ class Todo < ActiveRecord::Base
state :done state :done
end end
def action_name
case action
when ASSIGNED then 'assigned'
when MENTIONED then 'mentioned you on'
end
end
def body def body
if note.present? if note.present?
note.note note.note
...@@ -57,8 +50,4 @@ class Todo < ActiveRecord::Base ...@@ -57,8 +50,4 @@ class Todo < ActiveRecord::Base
target.title target.title
end end
end end
def target_iid
target.respond_to?(:iid) ? target.iid : target_id
end
end end
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
%span.author_name %span.author_name
= link_to_author todo = link_to_author todo
%span.todo_label %span.todo_label
= todo.action_name = todo_action_name(todo)
= todo_target_link(todo) = todo_target_link(todo)
&middot; #{time_ago_with_tooltip(todo.created_at)} &middot; #{time_ago_with_tooltip(todo.created_at)}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment