aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/templates/display_files.html
blob: d72ca0ecde9f6f73c7e2f846653d51bbb7e455d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{% extends "index_page.html" %}
{% block title %}Trait Submission{% endblock %}

{% block css %}
<link rel="stylesheet" type="text/css" href="{{ url_for('css', filename='DataTables/css/jquery.dataTables.css') }}" />
{% endblock %}

{% block content %}
<!-- Start of body -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="container-fluid bg-{{ category }}">
  {% for category, message in messages %}
  <div class="alert {{category}}" role="alert">{{ message }}</div>
  {% endfor %}
</div>
{% endif %}
{% endwith %}

<div class="container">
  {%if (not waiting) and (not approved) and (not rejected)%}
  <div class="row" style="text-align: left; padding: 5em 0 0 5em;">
    <span class="glyphicon glyphicon-info-sign text-info"></span>
    <strong>There are no diffs to act on.</strong>
  </div>
  {%endif%}
    {% if waiting %}
    <h2>Files for approval:</h2>
    <div class="row">
        <div class="col-md-7">
            <table class="table table-hover table-striped cell-border">
                <thead>
                    <th scope="col">Resource Id</</th>
                    <th scope="col">Author</th>
                    <th scope="col">TimeStamp</th>
                    <th scope="col"></th>
                    <th scope="col"></th>
                </thead>
                <tbody>
                    {% for data in waiting %}
                    <tr>
                      {% set file_url = url_for('metadata_edit.show_diff', name=data.filepath.name) %}
                        <td><a href="{{ file_url }}" target="_blank">{{ data.meta.get("resource_id") }}</a></td>
                        <td>{{ data.meta.get("author")}}</td>
                        <td>{{ data.meta.get("time_stamp")}}</td>
                        {% set reject_url = url_for('metadata_edit.reject_data', resource_id=data.meta.get('resource_id'), file_name=data.filepath.name, dataset_name=data.diff.dataset_name, trait_name=data.diff.trait_name) %}
                        {% set approve_url = url_for('metadata_edit.approve_data', resource_id=data.meta.get('resource_id'), file_name=data.filepath.name, dataset_name=data.diff.dataset_name, trait_name=data.diff.trait_name) %}
                        <td>
                            <button type="button"
                                    class="btn btn-secondary btn-sm">
                                <a href="{{ reject_url }}">Reject</a>
                            </button>
                        </td>
                        <td>
                            <button type="button"
                                    class="btn btn-warning btn-sm">
                                <a href="{{ approve_url }}">Approve</a>
                            </button>
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
    {% endif %}

    {% if approved %}
    <h2>Approved Data:</h2>
    <div class="row">
        <div class="col-md-8">
            <table class="table-responsive table-hover table-striped cell-border" id="table-approved">
                <thead>
                    <th scope="col">Resource Id</</th>
                    <th scope="col">Author</th>
                    <th scope="col">TimeStamp</th>
                </thead>
                <tbody>
                    {% for data in approved %}
                    <tr>
                        {% set file_url = url_for('metadata_edit.show_diff', name=data.filepath.name) %}
                        <td><a href="{{ file_url }}" target="_blank">{{ data.meta.get("resource_id") }}</a></td>
                        <td>{{ data.meta.get("author")}}</td>
                        <td>{{ data.meta.get("time_stamp")}}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
    {% endif %}

    {% if rejected %}
    <h2>Rejected Files:</h2>
    <div class="row">
        <div class="col-md-8">
            <table class="table-responsive table-hover table-striped cell-border" id="table-rejected">
                <thead>
                    <th scope="col">Resource Id</</th>
                    <th scope="col">Author</th>
                    <th scope="col">TimeStamp</th>
                </thead>
                <tbody>
                    {% for data in rejected %}
                    <tr>
                        {% set file_url = url_for('metadata_edit.show_diff', name=data.filepath.name) %}
                        <td><a href="{{ file_url }}" target="_blank">{{ data.meta.get("resource_id") }}</a></td>
                        <td>{{ data.meta.get("author")}}</td>
                        <td>{{ data.meta.get("time_stamp")}}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
    {% endif %}
</div>
{%endblock%}

{% block js %}
<script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTables/js/jquery.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTables/js/jquery.dataTables.min.js') }}"></script>
<script language="javascript" type="text/javascript">
 gn_server_url = "{{ gn_server_url }}";
 
 $(document).ready( function() {
     $('#table-approved').dataTable();
     $('#table-rejected').dataTable();
 });
</script>
{% endblock %}