{layout @admin.html}
{block content}
<div class="column-group horizontal-gutters top-space">
  <div class="xlarge-75 large-75 medium-75 small-100 tiny-100">
    <h1>{_}snippets{/_}</h1>
  </div>
  <div class="xlarge-25 large-25 medium-25 small-100 tiny-100 bottom-space">
    <a class="ink-button green" href="{=BASE_URL}snippet/add">{_'new_snippet'}</a>
  </div>
</div>
<div class ="column-group horizontal-gutters">
  <div class="xlarge-75 large-75 medium-100 small-100 tiny-100">
    {if $snippets}
    <table class="ink-table hover medium">
      <thead>
	<th class="align-left">{_'name'}</th>
	<th class="align-left">{_'created_at'}</th>
	<th class="align-left">{_'updated_at'}</th>
	<th colspan="3"></th>
      </thead>
      <tbody>
	{foreach $snippets as $snippet}
	<tr><!-- {if $iterator->isOdd()} class="orange"{/if} -->
	  <td>{$snippet->name}</td>
	  <td>{$snippet->created_at|date:$mediumDate}</td>
	  <td>{$snippet->updated_at|date:$mediumDate}</td>
	  <!-- <td><a href="{=BASE_URL}snippet/moveup/{$snippet->snippet_id}"><img src="public/images/Arrow-up-icon.png" alt="{_'move_up'}" title="{_'move_up'}"></a></td> -->
	  <!-- <td><a href="{=BASE_URL}snippet/movedown/{$snippet->snippet_id}"><img src="public/images/Arrow-down-icon.png" alt="{_'move_down'}" title="{_'move_down'}"></a></td> -->
	  <td><a href="{=BASE_URL}snippet/update/{$snippet->snippet_id}"><img alt="{_'update'}" src="public/images/edit_24.png"></a></td>
	  {var $confirm = ('confirm_delete_snippet'|translate:$snippet->name)}
	  <td><a href="{=BASE_URL}snippet/delete/{$snippet->snippet_id}"><img src="public/images/delete_24.png" alt="{_'remove_snippet'}" title="{_'remove_snippet'}" onclick="return confirm('{$confirm|noescape}');"></a></td>
	</tr>
	{/foreach}
      </tbody>
    </table>
    {include 'pagination/ink.html', url: BASE_URL . 'snippet/list?page=%d'}
    {/if}
  </div>
  <div class="xlarge-25 large-25 medium-100 small-100 tiny-100">
    <div>
      <header>
	<h2 class="medium">{_}last_modified_snippets{/_}</h2>
      </header>
      <hr>
      <div class="small">
	<ul>
	  {foreach models\Snippet::findLastModifiedSnippets() as $snippet}
	  <li>#{$snippet->snippet_id} <a href="{=BASE_URL}snippet/update/{$snippet->snippet_id}">{$snippet->name}</a> <span class="small-date">({$snippet->updated_at|date:$mediumDate})</span></li>
	  {/foreach}
	</ul>
      </div>
    </div>
    <div class="top-space">
      
      <header>
	<h2 class="medium">{_}last_created_snippets{/_}</h2>
      </header>
      <hr>
      <div class="small">
	<ul>
	  {foreach models\Snippet::findLastCreatedSnippets() as $snippet}
	  <li>#{$snippet->snippet_id} <a href="{=BASE_URL}snippet/update/{$snippet->snippet_id}">{$snippet->name}</a> <span class="small-date">({$snippet->created_at|date:$mediumDate})</span></li>
	  {/foreach}
	</ul>
      </div>
    </div>
  </div>
</div>
{/block}
