<% if @task.enable_subtasks? && (@task.period.nil? || @task.period.active_or_future?) %>
<% form_tag({:controller => 'tasks', :action => :specify, :id => @task}) do %>
<%= image_button_to('add.png', l(:specify), :controller => 'tasks', :action => :specify, :id => @task.id)%>
<% end %>
<% end %>
<%=(" " * @task.depth * 4) if @task.depth > 0 %>
<%=resolution_image(@task.resolution) if @task.finished_at %>
<%="-" if @task.children.size > 0 %>
<% if @task.loggable? -%>
<% if @task.work_started? -%>
<% remote_form_for(:work, :url => {:controller => 'works', :action => 'update_time', :id => @task.started_work}) do |f| %>
<%=submit_tag('checkmark', :value => l(:save), :style => 'display: none')%>
<%=l :started_at%> <%=f.text_field 'started_at_time', :id => "work_#{@task.started_work.id}_started_at_time", :value => @task.started_work.started_at.strftime('%H:%M'),
:class => :task_time, :maxlength => 5 %>
<% end %>
<% elsif @task.track_times? && (@task.period_id.nil? || @task.period.active?) %>
<%=image_link_to_remote 'hammer.png', l(:start_work), {:controller => 'tasks', :action => :start_work, :id => @task.id}, nil, true %>
<% end -%>
<% end -%>
<% if @task.loggable? && @task.work_started? -%>
<% form_tag({:controller => 'works', :action => 'update', :id => @task.started_work}) do %>
<%= image_detour_to('ernes_stop.png', l(:end_work), {:controller => 'tasks', :action => :end_work, :id => @task.id}, nil, true) %>
<% end -%>
<% end -%>
<% if @task.active? -%>
<% if @task.loggable? -%>
<% unless @task.work_started? -%>
<%# form_tag({:controller => 'tasks', :action => 'update', :id => @task}) do -%>
<%=image_link_to_remote('arrow_right.png', l(:move_to_next_period), {:action => :move_task_to_next_period, :id => @task}, nil, true) if @task.backlog.enable_periods? || @task.period_id%>
<%=image_link_to_remote('ernes_stop.png', l(:abort), {:action => :abort_task, :id => @task}, nil, true)%>
<%# end -%>
<% end -%>
<% end -%>
<% elsif (@task.period.nil? || (not @task.period.passed?)) && @task.leaf? -%>
<% form_tag({:controller => 'tasks', :action => 'update', :id => @task}) do -%>
<%=image_link_to_remote('eraser.png', l(:reopen), {:action => :reopen_task, :id => @task}, nil, true) %>
<% end -%>
<% end -%>
<% form_tag({:action => 'update', :id => @task}, :multipart => true) do %>
<%= render :partial => 'form' %>
<%= submit_tag l(:save) %>
<%= back_or_link_to l(:back), :action => 'list' %>
<% end %>