{% extends "spider_base/nouc_base.html" %}
{% load i18n static spider_rdf %}
{% load flatpages %}
{% block title %}{% blocktrans trimmed %}
  Home
{% endblocktrans %}{% endblock %}

{% block extrahead %}
{{block.super}}
<link rel="stylesheet" href="{% static 'admin/css/vendor/select2/select2.css' %}">
{% if DEBUG %}
  <script src="{% static 'admin/js/vendor/jquery/jquery.js' %}"></script>
  <script src="{% static 'admin/js/vendor/select2/select2.full.js' %}"></script>
{% else %}
  <script src="{% static 'admin/js/vendor/jquery/jquery.min.js' %}"></script>
  <script src="{% static 'admin/js/vendor/select2/select2.full.min.js' %}"></script>
{% endif %}
{% endblock %}

{% block main_classes %}{{block.super}} w3-content w3-card-4{% endblock %}


{% block content %}
  {% block frontblock %}
  <div>
    {% get_flatpages '/home/heading/' for request.user as heading_pages %}
    {% for page in heading_pages %}
      <div>
        {{page.content|safe}}
      </div>
    {% empty%}
      <div>
        <h1>{% blocktrans trimmed %}
          Welcome to spkcspider
        {% endblocktrans %}</h1>
      </div>
    {% endfor %}
    {% get_flatpages '/home/main/' for request.user as main_pages %}
    {% for page in main_pages %}
      <div class="w3-margin w3-padding w3-white">
        <h3 class="">{{page.title}}</h3>
        <hr/>
        {{page.content|safe}}
      </div>
    {% endfor %}
  </div>
  {% endblock %}
  {% block featured_components %}
  {% if object_list|length > 0 %}
  <div>
    <div>
      <h2 class="">
        {% trans "Featured:" %}
      </h2>
    </div>
    <div  class="w3-margin">
      <table class="w3-table w3-bordered w3-hoverable" rel="spkc:components">
        {% for uc in object_list %}
          <tr class="color-front-{{uc.strength}}" title="{{uc.description|escape}}" resource="{% url 'spider_base:ucontent-list' id=uc.id nonce=uc.nonce %}" typeof="spkc:Component">
            <td style="width:40%; min-height:48px">
              <data hidden="hidden" property="spkc:type">Component</data>
              <data hidden="hidden" property="spkc:strength" datatype="xsd:integer">{{uc.strength}}</data>
              <data rel="spkc:properties">
                <data typeof="spkc:Property">
                  <data hidden="hidden" property="spkc:name">name</data>
                  <data property="spkc:value">{{ uc.name }}</data>
                </data>
                <em>({{uc.user}})</em>
                <data hidden="hidden" typeof="spkc:Property">
                  <data hidden="hidden" property="spkc:name">user</data>
                  <data hidden="hidden" property="spkc:value">{{uc.username}}</data>
                </data>
                <data hidden="hidden" typeof="spkc:Property">
                  <data hidden="hidden" property="spkc:name">description</data>
                  <data hidden="hidden" property="spkc:value">{{uc.description|escape}}</data>
                </data>
              </data>
            </td>
            <td>
              {% blocktrans trimmed with time=uc.modified|timesince %}
              Modified: {{time}} ago
              {% endblocktrans %}
            </td>
            <td class="w3-show-inline-block">
              <div class="w3-bar w3-round-large w3-tiny w3-blue">
                <a class="w3-hover-black w3-button w3-bar-item w3-tooltip w3-mobile" href="{% url 'spider_base:ucontent-list' id=uc.id nonce=uc.nonce %}" property="spkc:action:view">
                  <div class="spkc-entity-button"><i class="fa fa-list-ul" aria-label="{% trans 'List' %}" alt="{% trans 'List' %}"></i></div>
                  <div aria-hidden="true" class="w3-text w3-black spkc-entity-button-text"><div class="w3-animate-opacity">{% trans 'List' %}</div></div>
                </a>
                {% if uc.user == request.user %}
                  <a class="w3-hover-black w3-button w3-bar-item w3-tooltip w3-mobile" href="{% url 'spider_base:ucomponent-update' name=uc.name nonce=uc.nonce %}" property="spkc:action:update">
                    <div class="spkc-entity-button"><i class="fa fa-edit" aria-label="{% trans 'Edit' %}" alt="{% trans 'Edit' %}"></i></div>
                    <div aria-hidden="true" class="w3-text w3-black w3-large spkc-entity-button-text"><div class="w3-animate-opacity">{% trans 'Edit' %}</div></div>
                  </a>
                {% endif %}
              </div>
            </td>
          </tr>
        {% endfor %}
      </table>
    </div>
  </div>
  <div class="page-manipulation w3-padding" style="margin-top:40px">
    {% url 'spider_base:ucomponent-listpublic' as searchpath %}
    {% include 'spider_base/list_footer.html' with searchpath=searchpath %}
  </div>
  {% endif %}
  {% endblock featured_components %}
  <data hidden="hidden" property="spkc:strength" datatype="xsd:integer">0</data>
  <div class="w3-margin">
    <a href="{% url 'spider_base:ucomponent-listpublic' %}">
      <span class="w3-large w3-text-blue">
        {% blocktrans trimmed %}
          List public components (spiders)...
        {% endblocktrans %}
      </span>
    </a>
  </div>
{% endblock %}
