{% extends "base.html" %}
{% block title %}home{% endblock %}
{% block content %}
{% if site.google_custom_search_id %}
<script>
  (function() {
    var cx = '{{ site.google_custom_search_id }}';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
{% endif %}
{% if debug %}
<p> DEBUG: {{ debug }}</p>
{% endif %}
{{ site.welcome_message|simpletags }}
<p>
{{ paper_html_admin_buttons }}
{{ seminar_html_admin_buttons }}
{{ event_html_admin_buttons }}
{{ position_html_admin_buttons }}
{{ news_html_admin_buttons }}
</p>

{% if projects %}
<h2>Projects</h2>
<ul>
{% for project in projects %}
<li><a class='external' href='{{ project.external_url }}'>{{ project.title }}</a>
    {% if project.principal_investigator %}({{ project.principal_investigator }}){% endif %}
    {% if project.tag %}&gt; <a href='/papers/?tag={{ project.tag }}'>papers</a></li>{% endif %}
{% endfor %}
</ul>
{% endif %}


{% if news %}
<h2>News</h2>
<ul>
{% for item in news %}
<li> {{ item.html() }} {{ item.html_admin_buttons() }}</li>
{% endfor %}
</ul>
{% endif %}

{% if positions %}
<h2>Open Positions</h2>
<ul>
{% for item in positions %}
<li> {{ item.html() }} {{ item.html_admin_buttons() }}</li>
{% endfor %}
</ul>
{% endif %}

{% if seminars %}
<h2>Forthcoming Seminars</h2>
<ul>
{% for item in seminars %}
<li> {{ item.html() }} {{ item.html_admin_buttons() }}</li>
{% endfor %}
</ul>
{% endif %}

{% if events %}
<h2>Forthcoming Events</h2>
{% if site.google_calendar_id %}
<iframe src="https://calendar.google.com/calendar/embed?src={{ site.google_calendar_id }}&ctz=Europe/Rome&showTitle=0" style="border: 0;frameborder: 0;scrolling: no" width="800" height="600"></iframe>
{% endif %}

<ul>
{% for item in events %}
<li> {{ item.html() }} {{ item.html_admin_buttons() }}</li>
{% endfor %}
</ul>
{% endif %}

{% if last_added_papers %}
<h2>Recently Added Papers</h2>
<ul>
{% for paper in last_added_papers %}
<li> {{ paper.html() }} {{ paper.html_admin_buttons() }}</li>
{% endfor %}
</ul>
{% endif %}

{% if last_modified_papers %}
<h2>Recently Modified Papers</h2>
<ul>
{% for paper in last_modified_papers %}
<li> {{ paper.html() }} {{ paper.html_admin_buttons() }}</li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}
