{% extends "ldt/ldt_base.html" %}
{% load i18n %}

{% block js_import %}
    {{ block.super }}    
	<script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/projectscontents.js" ></script>
{% endblock %}

{% block css_import %}
    {{ block.super }}
    <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/workspace.css" />
    <style type="text/css">
    
    .titleresults {
    	font-weight: bold;
    	font-size: 1.2em;
    }
    
    .segmentinfos {
    	border-radius: 5px;
    	padding: 5px;
    }
    
    .segmentinfos:hover {
    	background-color: #ededed;
    }
    
    .listsegments {
    	list-style-type: none;
    	padding-left: 15px;
    }
    
    .descresults {
    	font-size: 0.9em;
    }
    </style>
{% endblock %}

{% block js_declaration %}
	{{ block.super }}

	<script type="text/javascript">   
	$(document).ready(function(){
		init_events_all(document, "/pf/ldtplatform/ldt/embedpopup", '', '', '', '');
	});    
    </script>
{% endblock %}


{% block content %}

<div class="span-24 last" id="allcontentsdiv">

{% if msg %}
{{ msg }}
{% else %}

	{% ifequal nb_results 0 %}
	{% blocktrans %} No results for <b>{{ search }}</b>.{% endblocktrans %}
	{% else %}
	
	{% trans "Results for " %} <b> {{ search }}</b>	({{ nb_results }} {% trans "Result" %}{{ nb_results|pluralize }}) :
	<br /><br />
		
	
	{% autoescape off %}
	<ul>
	{% for res in results.object_list %}
		<li>		
			<span class="titleresults">{{res.content_title|capfirst}}</span><br />
			{% ifnotequal res.content_description 'None' %}
			<span class="descresults">{{ res.content_description }}</span><br />
			{% endifnotequal %}		
			<ul class="listsegments">
			{% for segment in res.list %}
				<li class="segmentinfos" ><span  class="" title="{% trans 'open ldt' %}"><a class="ldt_link_open_ldt" href="{% url ldt.ldt_utils.views.display_highlighted_seg segment.project_id segment.iri_id segment.ensemble_id segment.decoupage_id segment.element_id %}">{{ segment.title }}</a></span><br />
				{{ segment.context }}<br />
				{% if segment.tags %}
				<b>{% trans "Tags"%}</b> : {{ segment.tags }}
				{% endif %}
				</li>
			{% endfor %}
			</ul>	
		</li><br />
	{% endfor %}
	</ul>
	{% endautoescape %}


<div class="pagination">
    <span class="step-links">
        {% if results.has_previous %}
            <a href="{% url ldt.ldt_utils.views.search_listing %}?page={{ results.previous_page_number }}">{% trans "previous" %}</a>
        {% endif %}

		{% if results.paginator.num_pages > 1 %}
        <span class="current">
           {% blocktrans with number=results.number num_pages=results.paginator.num_pages%}Page {{number}} of  {{num_pages}}{% endblocktrans %}
        </span>
        {% endif %}

        {% if results.has_next %}
            <a href="{% url ldt.ldt_utils.views.search_listing %}?page={{ results.next_page_number }}">{% trans "next" %}</a>
        {% endif %}
    </span>
</div>

	{% endifequal %}
{% endif %}

{% endblock %}