{% extends "base_nav.html" %}
{% load humanize %}
{% load i18n %}
{% load staticfiles %}
{% block "title" %}{% trans "Browse" %}{% endblock %}
{% block "css" %}
<link href="{% static 'css/secrets.css' %}" rel="stylesheet">
{% endblock %}
{% block "nav_browse" %}active{% endblock %}
{% block "content" %}
<div class="container">
	<div class="row">
		<div class="col-md-12">
			<h1>
				{% if search_term %}
				{% blocktrans %}Search results for '{{ search_term }}'...{% endblocktrans %}
				{% else %}
				{% trans "Browse all items" %}
				{% endif %}

			</h1>
			{{ page_obj.paginator.count }} item(s) found
			<br><br>
			<div class="panel panel-default">
				<table class="table table-hover">
					{% for secret in secrets %}
					<tr>
						<td class="secret-list-icons">
							{% if secret not in readable_secrets %}
							<i class="fa fa-lock"></i>&nbsp;
							{% endif %}
							{% if secret.content_type == secret.CONTENT_PASSWORD %}
							<i class="fa fa-user"></i>
							{% elif secret.content_type == secret.CONTENT_FILE %}
							<i class="fa fa-file"></i>
							{% elif secret.content_type == secret.CONTENT_CC %}
							<i class="fa fa-credit-card"></i>
							{% endif %}
						</td>
						<td>
							<a href="{{ secret.get_absolute_url }}">
								{{ secret.name }}
							</a>
						</td>
						<td>
							{% if secret.username %}
							<span class="secret-list-detail">{{ secret.username }}</span>
							{% endif %}
							{% if secret.filename %}
							<span class="secret-list-detail">{{ secret.filename }}</span>
							{% endif %}
						</td>
					</tr>
					{% endfor %}
				</table>
			</div>
			{% if is_paginated %}
			<ul class="pagination">
				{% if page_obj.has_previous %}
				<li><a href="?page={{ page_obj.previous_page_number }}{% if search_term %}&search={{ search_term_url }}{% endif %}"><i class="fa fa-chevron-left"></i></a></li>
				{% else %}
				<li class="disabled"><a href="#"><i class="fa fa-chevron-left"></i></a></li>
				{% endif %}
				{% for page in paginator.page_range %}
				{% if page_obj.number == page %}
				<li class="active"><a href="#">{{ page }} <span class="sr-only">(current)</span></a></li>
				{% else %}
				<li><a href="?page={{ page }}{% if search_term %}&search={{ search_term_url }}{% endif %}">{{ page }}</a></li>
				{% endif %}
				{% endfor %}
				{% if page_obj.has_next %}
				<li><a href="?page={{ page_obj.next_page_number }}{% if search_term %}&search={{ search_term_url }}{% endif %}"><i class="fa fa-chevron-right"></i></a></li>
				{% else %}
				<li class="disabled"><a href="#"><i class="fa fa-chevron-right"></i></a></li>
				{% endif %}
			</ul>
			{% endif %}
		</div>
	</div>
</div>
{% endblock %}
