File size: 4,027 Bytes
9da4125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{% extends 'base.html' %}

{% block title %}Просмотр общей папки{% endblock %}

{% block content %}
<div class="row mb-4">
    <div class="col-md-8">
        <h2>Просмотр папки: {{ folder.original_filename }}</h2>
        <p class="text-muted">Владелец: {{ folder.owner_username }}</p>
    </div>
    <div class="col-md-4 text-end">
        <a href="{{ url_for('shared_with_me') }}" class="btn btn-secondary">
            <i class="fas fa-arrow-left"></i> Назад к общим файлам
        </a>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="card-header bg-primary text-white">
                <h5 class="mb-0">Содержимое папки</h5>
            </div>
            <div class="card-body">
                {% if files %}
                <div class="table-responsive">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th>Имя</th>
                                <th>Тип</th>
                                <th>Размер</th>
                                <th>Права доступа</th>
                                <th>Действия</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for file in files %}
                            <tr>
                                <td>
                                    {% if file.is_folder %}
                                    <a href="{{ url_for('view_shared_file', file_id=file.id) }}" class="text-decoration-none">
                                        <i class="fas fa-folder text-warning"></i> {{ file.original_filename }}
                                    </a>
                                    {% else %}
                                    <i class="fas fa-file text-primary"></i> {{ file.original_filename }}
                                    {% endif %}
                                </td>
                                <td>{{ 'Папка' if file.is_folder else 'Файл' }}</td>
                                <td>{{ file.size|filesizeformat if not file.is_folder else '-' }}</td>
                                <td>
                                    {% if file.permission == 'read' %}
                                    <span class="badge bg-info">Только чтение</span>
                                    {% elif file.permission == 'write' %}
                                    <span class="badge bg-success">Чтение и запись</span>
                                    {% endif %}
                                </td>
                                <td>
                                    <div class="btn-group">
                                        <a href="{{ url_for('view_shared_file', file_id=file.id) }}" class="btn btn-sm btn-outline-primary">
                                            {% if file.is_folder %}
                                            <i class="fas fa-folder-open"></i>
                                            {% else %}
                                            <i class="fas fa-download"></i>
                                            {% endif %}
                                        </a>
                                    </div>
                                </td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
                {% else %}
                <div class="text-center py-5">
                    <i class="fas fa-folder-open fa-4x text-muted mb-3"></i>
                    <h5>Эта папка пуста</h5>
                </div>
                {% endif %}
            </div>
        </div>
    </div>
</div>
{% endblock %}