mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-01 06:48:49 +01:00
parent
ce3897a2bd
commit
bbbb3a1886
3 changed files with 18 additions and 0 deletions
|
|
@ -638,6 +638,15 @@ class TodosController < ApplicationController
|
|||
end
|
||||
render :inline => "<%= auto_complete_result2(@items) %>"
|
||||
end
|
||||
|
||||
def convert_to_project
|
||||
@todo = Todo.find(params[:id])
|
||||
@project = Project.new(:name => @todo.description, :description => @todo.notes,
|
||||
:default_context => @todo.context)
|
||||
@todo.destroy
|
||||
@project.save!
|
||||
redirect_to project_url(@project)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,14 @@ module TodosHelper
|
|||
:complete => todo_stop_waiting_js(todo))
|
||||
end
|
||||
end
|
||||
|
||||
def remote_promote_to_project_menu_item(todo)
|
||||
url = {:controller => 'todos', :action => 'convert_to_project', :id => todo.id,
|
||||
:_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}
|
||||
url[:_tag_name] = @tag_name if @source_view == 'tag'
|
||||
|
||||
return link_to("Promote to project", url)
|
||||
end
|
||||
|
||||
def todo_start_waiting_js(todo)
|
||||
return "$('#ul#{dom_id(todo)}').css('visibility', 'hidden'); $('##{dom_id(todo)}').block({message: null})"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
|||
<li><%= remote_defer_menu_item(1, todo) %></li>
|
||||
<li><%= remote_defer_menu_item(7, todo) %></li>
|
||||
<% end %>
|
||||
<li><%= remote_promote_to_project_menu_item(todo) %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue