{% extends "base.html" %}


{% block container %}

<div class="col-md-12 sub-header">
    <div class="container">
	<div class="row">
	    <h3>&nbsp;&nbsp;ANALYSES
		<span class="pull-right">
		    <a id="sort" href="/analyses?sort" type="button" class="btn btn-default">
			<i class="glyphicon glyphicon-sort-by-attributes"></i>
			&nbsp;Sort</a>&nbsp;&nbsp;
		    <a id="max-results" href="/analyses" type="button" class="btn btn-default">
			<i class="glyphicon glyphicon-resize-vertical"></i>
			&nbsp;Max results</a>
		    &nbsp;&nbsp;
		    <a href="analysis_form" class="btn btn-primary" role="button">
			<i class="glyphicon glyphicon-plus"></i>
			&nbsp;
			<strong>New Analysis</strong>
		    </a>
		</span> 
	    </h3>
	    <br>
	</div>
    </div>
</div>


<div class="container">
  <div class="row">
    <div class="col-md-12">

	
      <div class="col-md-12">
	  <br>
      </div>
      
      <div class="col-md-12">
	  <div class="card-columns">
	      
	      {% for analysis in analyses %}
	      
	      <div class="card card-on-deck">
		  
		  <div class="card-block">
		      <h4 class="text-center">
			  <a href="{{ url_for('.analyses', id=analysis.id) }}">
			      <!--<strong>{{ analysis.title }}</strong> -->
			      {{ analysis.title }}
			  </a>
		      </h4>
		      
		      <h4 class="text-center">
			  <span class="label label-primary" data-toggle="tooltip" data-placement="right" title="Collaboration">
			      {{analysis.collaboration }}
			  </span>
		      </h4>
		      <br><br>
		      
		      <div>{{ analysis.description }}</div>
		      
		      <br><br>
		      
		      <div class="inline-block text-center">
			  <span class="badge">
			      <i class="glyphicon glyphicon-user"></i>
			      &nbsp;{{analysis.owner.name}}
			  </span>
			  <span class="badge">
			      {{analysis.scan_requests[:]|length}}&nbsp;requests
			  </span>
			  <span class="badge">
			      {{analysis.subscriptions[:]|length}}&nbsp;subscriptions
			  </span>
		      </div>
		      
		      <br>
		      
		      <div class="text-center">
			  <a href="{{ url_for('.analyses', id=analysis.id) }}">
			      <span class="label label-default">
				  <i class="glyphicon glyphicon-eye-open"></i>
				  &nbsp;view</span>
			  </a>
			  &nbsp;&nbsp;
			  <a href="{{ url_for('.subscribe', id=analysis.id) }}">
			      <span class="label label-default">
				  <i class="glyphicon glyphicon-pushpin"></i>
				  &nbsp;subscribe
			      </span>
			  </a>
			  &nbsp;&nbsp;
			  <a href="{{ url_for('.request_form', id=analysis.id) }}">
			      <span class="label label-default">
				  <i class="glyphicon glyphicon-plus"></i>
				  &nbsp;add&nbsp;request
			      </span>
			  </a>
		      </div>
		      
		      
		  </div>
	      </div>      
	      {% endfor %}

    </div>
      </div>
      
    <!--<div class="col-md-12 card card-stats">
	<a href="#">
	  <br>
	  <h4 class="text-center">Load more...</h4>
	  <br>
	</a>
      </div> -->

    </div>
  </div>
</div>
<script type="text/javascript">
  
  $(document).ready(function() {
  $('.more').each(function () {
        var content = $(this).html();
        $(this).html(shortStr(content, content.length/2, 300));
  });
  })

</script>

{% endblock %}
