Skip to content
Snippets Groups Projects
Commit 39e6f504 authored by Robert Schilling's avatar Robert Schilling
Browse files

Move to helper, no instance variables

parent b94088d5
No related branches found
No related tags found
No related merge requests found
Loading
@@ -34,13 +34,6 @@ class Todo < ActiveRecord::Base
Loading
@@ -34,13 +34,6 @@ class Todo < ActiveRecord::Base
action == BUILD_FAILED action == BUILD_FAILED
end end
   
def action_name
case action
when Todo::ASSIGNED then 'assigned you'
when Todo::MENTIONED then 'mentioned you on'
end
end
def body def body
if note.present? if note.present?
note.note note.note
Loading
Loading
Loading
@@ -11,7 +11,7 @@
Loading
@@ -11,7 +11,7 @@
- else - else
(removed) (removed)
%span.todo-label %span.todo-label
= todo.action_name = todo_action_name(todo)
- if todo.target - if todo.target
= todo_target_link(todo) = todo_target_link(todo)
- else - else
Loading
Loading
Loading
@@ -14,11 +14,11 @@ module API
Loading
@@ -14,11 +14,11 @@ module API
# #
# Example Request: # Example Request:
# GET /todos # GET /todos
#
get do get do
@todos = find_todos todos = find_todos
@todos = paginate @todos
   
present @todos, with: Entities::Todo present paginate(todos), with: Entities::Todo
end end
   
# Mark todo as done # Mark todo as done
Loading
@@ -31,10 +31,10 @@ module API
Loading
@@ -31,10 +31,10 @@ module API
# DELETE /todos/:id # DELETE /todos/:id
# #
delete ':id' do delete ':id' do
@todo = current_user.todos.find(params[:id]) todo = current_user.todos.find(params[:id])
@todo.done todo.done
   
present @todo, with: Entities::Todo present todo, with: Entities::Todo
end end
   
# Mark all todos as done # Mark all todos as done
Loading
@@ -44,10 +44,10 @@ module API
Loading
@@ -44,10 +44,10 @@ module API
# DELETE /todos # DELETE /todos
# #
delete do delete do
@todos = find_todos todos = find_todos
@todos.each(&:done) todos.each(&:done)
   
present @todos, with: Entities::Todo present paginate(todos), with: Entities::Todo
end end
end end
end end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment