<% if @task.enable_subtasks? && active && (@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 %>
<%=detour_to "##{@task.id}", :controller => 'tasks', :action => :edit, :id => @task.id, :style => 'border: 0px; margin: 0px; padding: 0px' if @task.position || @task.depth == 0 %>
<% if active && @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')%>
<%=f.text_field 'started_at_time', :id => "work_#{@task.started_work.id}_started_at_time", :tabindex => i+1, :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 active && @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.track_done? || @task.total_done != 0 %>
<% if @task.loggable? || @task.finished_at -%>
<% unless !@task.track_done? || @task.track_times? || @task.work_started? || @task.finished_at -%>
<% form_tag({:controller => 'works', :action => (@task.work_started? ? :edit : :create), :id => @task.started_work}) do %>
<%=hidden_field('work', 'task_id', :value => @task.id)%>
<%=submit_tag('checkmark', :value => l(:save), :style => 'display: none')%>
<%=text_field 'work', 'hours', :tabindex => i+1, :id => "#{@task.id}_done",
:class => :task_hours, :maxlength => 4,
:ondblclick => "form.elements[1].style.display = 'inline';this.style.display = 'none'" -%>
<% end -%>
<% end -%>
<%=t @task.total_done if @task.total_done != 0%>
<% end -%>
<% end -%>
<% if active && @task.loggable? -%>
<% if @task.track_todo? -%>
<% if @task.period.nil? || @task.period.active_or_future? -%>
<% form_for(:estimate, :url => {:action => :update_task_estimate, :id => @task}) do |f| -%>
<%=f.text_field :todo, :tabindex => i+2, :id => "task_#{@task.id}_todo", :value => @task.todo, :class => :task_hours, :maxlength => 4 %>
<% end -%>
<% else -%>
<%=@task.todo %>
<% end -%>
<% end -%>
<% if (not @task.track_times?) && !@task.work_started? && (@task.period.nil? || @task.period.active?) %>
<%=image_link_to_remote('checkmark.png', l(:complete), {:action => :finish_task, :id => @task}, 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 -%>