{% extends "layout.html" %}

{% block navigation %}

<ul class="nav navbar-nav mr-auto">
  <li class="nav-item">
    <a href="{{ url_for('web_experiments.user_experiments', username=current_user.username) }}" class="nav-link">
      <i class="fas fa-globe mr-2"></i>Web Experiments</a>
  </li>
  <li class="nav-item nav-link">|</li>
  <li class="nav-item"><a href="{{ url_for('local_experiments.experiments') }}" class="nav-link active"><i
        class="fas fa-dot-circle mr-2"></i>Local Experiments (current)</a></li>
</ul>

{% endblock %}

{% block content %}

{% for experiment in experiments %}
<article class="media content-section">
  <div class="media-body">
    <small class="text-muted">{{ experiment.date_created.strftime('%Y-%m-%d') }} | </small>
    <a class="article-title"
      href="{{ url_for('local_experiments.local_experiment', experiment_title=experiment.title, username=experiment.author) }}">{{ experiment.title }}</a><button
      type="button" class="btn btn-danger btn-sm ml-3 mt-1 float-right" data-toggle="modal"
      data-target="#deleteModal{{ experiment.title }}"><i class='fas fa-trash mr-2'></i>delete</button></button>
    <!-- <p class="article-content">{{ experiment.script }}</p> -->
  </div>
</article>
<!-- Modal -->
<div class="modal fade" id="deleteModal{{ experiment.title }}" tabindex="-1" role="dialog"
  aria-labelledby="deleteModal{{ experiment.title }}" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="deleteModal{{ experiment.title }}">Delete Experiment</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        Are you sure that you want to delete this experiment? The data stored in Mortimer will be lost! <br><br>The
        experimental data in the Alfred database will <b>not</b> be deleted by this.
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <form method="POST"
          action="{{ url_for('local_experiments.delete_experiment', experiment_title=experiment.title, username=experiment.author) }}">
          <input class="btn btn-danger" type="submit" value="Delete">
        </form>
      </div>
    </div>
  </div>
</div>
{% endfor %}



{% endblock content %}