actions.html 3.53 KB
Newer Older
André Anjos's avatar
André Anjos committed
1 2 3
{% comment %}
 * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
 * Contact: beat.support@idiap.ch
jaden's avatar
jaden committed
4
 *
André Anjos's avatar
André Anjos committed
5
 * This file is part of the beat.web module of the BEAT platform.
jaden's avatar
jaden committed
6
 *
André Anjos's avatar
André Anjos committed
7 8 9 10
 * Commercial License Usage
 * Licensees holding valid commercial BEAT licenses may use this file in
 * accordance with the terms contained in a written agreement between you
 * and Idiap. For further information contact tto@idiap.ch
jaden's avatar
jaden committed
11
 *
André Anjos's avatar
André Anjos committed
12 13 14 15 16 17
 * Alternatively, this file may be used under the terms of the GNU Affero
 * Public License version 3 as published by the Free Software and appearing
 * in the file LICENSE.AGPL included in the packaging of this file.
 * The BEAT platform is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.
jaden's avatar
jaden committed
18
 *
André Anjos's avatar
André Anjos committed
19 20 21 22 23 24
 * You should have received a copy of the GNU Affero Public License along
 * with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
{% load report_tags %}

{% with object.get_status_display as status %}
25
<div class="btn-group btn-group-sm action-buttons pull-right" ng-controller='GroupsController as vm'>
André Anjos's avatar
André Anjos committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

  {% if display_count %}
  <!-- Experiment count, works for all -->
  {% visible_experiments object as experiments %}
  <a class="btn btn-default btn-references" href="{{ object.get_absolute_url }}" data-toggle="tooltip" data-placement="bottom" title="Experiments using this report"><span class="badge">{{ experiments.count }}</span></a>
  {% endif %}

  {% ifequal request.user object.author %}

  <!-- Delete, needs to be the owner -->
  {% if status == 'Editable' %}
  <a class="btn btn-default btn-delete" onclick="modal_delete('report', '{{ object.fullname }}', '{% url 'api_reports:all' %}', '{% url 'reports:list' request.user.username %}');" data-toggle="tooltip" data-placement="bottom" title="Delete"><i class="fa fa-times fa-lg"></i></a>

  {% if display_count %}
  <a class="btn btn-default btn-edit" href="{{ object.get_author_absolute_url }}" data-toggle="tooltip" data-placement="bottom" title="Edit"><i class="fa fa-edit fa-lg"></i></a>
  {% else %}
42
  <a id="save-button" class="btn btn-default btn-save" data-toggle="tooltip" data-placement="bottom" title="Save" report-save save-report='vm.saveReport'><i class="fa fa-floppy-o fa-lg"></i></a>
jaden's avatar
jaden committed
43 44 45 46 47
  <span  class="btn btn-default" data-toggle='modal' data-target='#lockReportModal'>
	  <a class="btn-report" data-toggle="tooltip" data-placement="bottom" title="Lock">
		  <i class="fa fa-lock fa-lg"></i>
	  </a>
  </span>
André Anjos's avatar
André Anjos committed
48 49 50
  {% endif %}

  {% elif status == 'Locked' and not display_count %}
jaden's avatar
jaden committed
51 52 53 54 55
  <span  class="btn btn-default" data-toggle='modal' data-target='#publishReportModal'>
	  <a class="btn-report" data-toggle="tooltip" data-placement="bottom" title="Publish">
		  <i class="fa fa-globe fa-lg"></i>
	  </a>
  </span>
André Anjos's avatar
André Anjos committed
56 57 58 59 60 61 62 63 64 65 66
  {% endif %}

  {% endifequal %}

  <!-- Edit, as admin -->
  {% if request.user.is_staff %}
  <a class="btn btn-default btn-edit" href="{% url 'admin:reports_report_change' object.id %}" data-toggle="tooltip" data-placement="bottom" title="Edit as admin"><i class="fa fa-cogs fa-lg"></i></a>
  {% endif %}

  <a class="btn btn-default btn-view" href="{{ object.get_absolute_url }}" data-toggle="tooltip" data-placement="bottom" title="Review"><i class="fa fa-arrow-circle-right fa-lg"></i></a>

jaden's avatar
jaden committed
67
  {% if not display_count and status == 'Editable' %}
68
  <report-lock save-report='vm.saveReport'></report-lock>
jaden's avatar
jaden committed
69 70 71 72 73 74 75
  {% endif %}

  {% if not display_count and status == 'Locked' %}
  <report-publish></report-publish>
  {% endif %}


André Anjos's avatar
André Anjos committed
76 77 78
</div>

{% endwith %}