<ol>
[%
$.each(tasks.model.task,function(i,n){
var evenodd = 'un';
var id = n.id;
var date = Date.parse(n.dueOn).toLocaleDateString();
(i%2==0) ? evenodd='odd' : evenodd='even';
%]
<li class="task-list-item [%=evenodd%]-table">
  <div class="task-list-item-vis" id="vis[%=n.id%]">
    <span class="task-checkbox-cont"><input type="checkbox" id="ck[%=n.id%]" class="task-checkbox"[%if(n.complete=='true'){%] checked="checked"[%}%]/></span>
    [%=n.title%]
    <span class="task-label task-label-[%=task_types.type_by_id(n.type).name%]">[%=task_types.type_by_id(n.type).name%]</span>
    <div class="edit-task-controls">
      <span style=""><abbr class="timeago" title="[%=n.dueOn%]">[%=n.dueOn%]</abbr></span>
    </div>
  </div>
  <div class="task-list-item-edit hide" id="ed[%=id%]">
    <form>
      <span class="">
        <input class="edit-task-form edit-task-title" id="ti[%=id%]" name="title" value="[%=n.title%]"/>
      </span>
      <br/>
      <span class="">
        <label>Due on</label>
        <input class="edit-task-form edit-task-due date-pick" id="due[%=id%]" name="dueOn" value="[%=date%]"/>
      </span>
      <span class="">
        <label>Type</label>
        <select name="type" id="ty[%=id%]">
          [%$.each(task_types.model().taskType,function(i,taskType){%]
            <option value="[%=taskType.id%]"[%if(n.type==taskType.id){%] selected="selected"[%}%]>[%=taskType.name%]</option>
          [%});%]
        </select>
      </span>
      <span class="">
        <label>Contact</label>
        <select name="contact" id="co[%=id%]">
          [%$.each(contacts.model.contact,function(i,contact){%]
            <option value="[%=contact.id%]"[%if(n.contact==contact.id){%] selected="selected"[%}%]>[%=contact.firstName%] [%=contact.lastName%]</option>
          [%});%]
        </select>
      </span>
      <span class="">
        <label>Assigned To</label>
        <select name="assignedTo" id="as[%=id%]">
          [%$.each(users.model.user,function(i,user){%]
            <option value="[%=user.id%]"[%if(n.assignedTo==user.id){%] selected="selected"[%}%]>[%=user.firstName%] [%=user.lastName%]</option>
          [%});%]
        </select>
      </span>
      <input class="edit-task-form edit-task-save" id="sv[%=id%]" type="button" value="Save"/>
      <input class="edit-task-form edit-task-cancel" type="button" value="Cancel"/>
    </form>
  </div>
</li>
[%});%]
</ol>