{% extends "base.html" %}

{% block title %}Action #{{ action.id }}: {{ action.name }} — {{ service_name }}{% endblock %}

{% block content %}
  <h1>
    {% if action.user is not none %}
    <a href="{{ url_for('.user_profile', user_id=action.user.id) }}" title="{{ action.user.name }}">{{ action.user.name }}</a> /
    {% endif %}
    {% if action.instrument is not none %}
    <a href="{{ url_for('.instrument', instrument_id=action.instrument.id) }}" title="{{ action.instrument.name }}">{{ action.instrument.name }}</a> &mdash;
    {% endif %}
    <a href="{{ url_for('.action', action_id=action.id) }}" title="{{ action.name }}">{{ action.name }}</a>
  </h1>
  {% if action.user_id is not none %}
  <p class="text-muted">{% if is_public %}<i class="fa fa-unlock" aria-hidden="true"></i>{% else %}<i class="fa fa-lock" aria-hidden="true"></i>{% endif %} This custom action is {% if not is_public %}not {% endif %}public.</p>
  {% endif %}
  {% if action.is_hidden %}
  <p class="text-muted"><i class="fa fa-eye-slash" aria-hidden="true"></i> This action has been hidden from action lists.</p>
  {% endif %}
  {% if action.description_as_html or action.description %}
  <div class="action-user-content">
  {% if action.description_as_html %}{{ action.description_as_html | safe }}{% else %}<p>{{ action.description }}</p>{% endif %}
  </div>
  {% endif %}
  {% with instrument = action.instrument %}
    {% include "instruments/instrument_scientists.html" %}
  {% endwith %}
  <a href="{{ url_for('.objects', action=action.id) }}" class="btn btn-default">{{ action.type.view_text }}</a>
  {% if not current_user.is_readonly %}
  <a href="{{ url_for('.new_object', action_id=action.id) }}" class="btn btn-primary">{{ action.type.perform_text}}</a>
  {% endif %}
  {% if not current_user.is_readonly %}
  {% if may_edit %}
    <a href="{{ url_for('.action', action_id=action.id, mode='edit') }}" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Modify the settings for this action.">Edit Action</a>
  {% endif %}
  {% if not action.type.admin_only or current_user.is_admin %}
  <a href="{{ url_for('.new_action', previous_action_id=action.id) }}" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Create a new custom action based on the settings for this action.">Use as Template</a>
  {% endif %}
  {% endif %}
{% endblock %}

{% block scripts %}
{{ super() }}
  <script src="{{ url_for('static', filename='js/markdown_image_viewer.js') }}"></script>
<script>
$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})
</script>
{% endblock %}