<article>
	<header>
		<nav>
		  <ul>
			<li><strong>TODOS</strong></li>
		  </ul>
		  <ul>
			<li><?=anchor("todo/?filter=all",'All', ['role'=>($filter=='all'?'button':'')])?></li>
			<li><?=anchor("todo/?filter=active",'Active', ['role'=>($filter=='active'?'button':'')])?></li>
			<li><?=anchor("todo/?filter=done",'Done', ['role'=>($filter=='done'?'button':'')])?></li>
		  </ul>
		</nav>
	</header>
	<?=form_open('todo/add')?>
		<fieldset role="group">
			<input type="text" placeholder="Buy milk and eggs..." name="todo">
			<button><i class="fa fa-plus"></i></button>
		</fieldset>
	</form>

	<table>
<?php foreach($todos as $todo): ?>
	<?php if ($todo->done): ?>
		<tr>
		<td><s><?=$todo->text?></s></td>
		<td class='action'>
		<?=anchor("todo/toggle/{$todo->id}", '<i class="fa fa-toggle-on"></i>')?>
		<?=anchor("todo/delete/{$todo->id}", '<i class="fa fa-trash-o"></i>')?>
		<?=anchor("todo/edit/{$todo->id}", '<i class="fa fa-edit"></i>')?>

	<?php else: ?>

		<tr><td><?=$todo->text?></td>
		<td class='action'>
		<?=anchor("todo/toggle/{$todo->id}", '<i class="fa fa-toggle-off"></i>')?>
		<?=anchor("todo/delete/{$todo->id}", '<i class="fa fa-trash-o"></i>')?>
		<?=anchor("todo/edit/{$todo->id}", '<i class="fa fa-edit"></i>')?>
	<?php endif; ?>
	</td></tr>
<?php endforeach; ?>
	</table>
</article>
