{layout './../../../templates/@layout.latte'}
{block content}
	{var $showTopTags = ($isItMainArticle !== FALSE && $topTags && !$allTags)}
	{var $showAllTags = ($isItMainArticle !== FALSE && $allTags)}
	{var $showArticleTags = ($isItMainArticle === FALSE && !$topTags)}

	<div class="row-fluid help-module">
		<div class="span3">
			{include '@menu.latte'}
		</div>

		<div class="span9">
			<div class="box-content">
				<div class="top">
					<div style="float: left;">
						{form searchForm}
							<div class="input-append">
								{input search}
								{input submit}
							</div>
						{/form}
					</div>

					<div style="float: right;">
						<a n:href="delete!, harticle => $article->id" data-help-confirm="Opravdu chcete tento článek smazat?" n:if="$isItMainArticle === FALSE && ($user->isInRole('administrator') || $user->isInRole('manager'))"><i class="icon-trash" style="margin-right: 5px;"></i>Smazat</a>
						<span style="padding: 0px 5px 0px 5px;"></span>
						<a n:href="edit, harticle => $article->id" n:if="$user->isInRole('administrator') || $user->isInRole('manager')"><i class="icon-pencil" style="margin-right: 5px;"></i>Upravit obsah</a>
					</div>

					<div style="clear: both;"></div>
				</div>

				<div class="tags" style="margin: 10px 0px 10px 0px;">
					<div n:if="$showTopTags">
						{foreach $topTags as $tag}
							<a n:href="search, htag => $tag->id"><span class="label">{$tag->name}</span></a>
						{/foreach}
						<div style="clear: both;"></div>
						<a n:href="detail, harticle => $article->id, hall => TRUE" class="btn" style="margin-top: 10px; width: 98%; text-align: center;">
							<i class="icon-arrow-down"></i><span style="padding: 0px 10px 0px 10px;">Zobrazit více</span><i class="icon-arrow-down"></i>
						</a>
					</div>

					<div n:if="$showAllTags">
						{foreach $allTags as $tag}
							<a n:href="search, htag => $tag->id"><span class="label">{$tag->name}</span></a>
						{/foreach}
						<hr>
					</div>

					<div n:if="$showArticleTags">
						{foreach $tags as $tag}
							<a n:href="search, htag => $tag->id_tag"><span class="label">{$tag->name}</span></a>
						{/foreach}
					</div>
				</div>

				<div class="article">
					<div n:foreach="$flashes as $flash" class="alert alert-{$flash->type}">{$flash->message}</div>

					<h2><a n:href="detail, harticle => $article->id">{$article->title}</a></h2>
					{\Nette\Utils\Html::el()->add($article->text)}
				</div>
			</div>
		</div>
	</div>

	{include './../@js.latte'}
	<script>
		(function($) {
			searchTypeahead({!$jsonTags});
		})(jQuery);
	</script>
