Skip to content

Commit 0958934

Browse files
author
SM_SAYEED
committed
Admin view updated
1 parent 54c58c7 commit 0958934

File tree

1 file changed

+100
-63
lines changed

1 file changed

+100
-63
lines changed

templates/property_detail.html

Lines changed: 100 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
<title>{{ pretty_title }} - {{ tab.title() }} | Patterns Matter</title>
55
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
66
<style>
7+
.container {
8+
max-width: 1200px;
9+
margin: 2em auto;
10+
padding: 2em;
11+
background: #363636;
12+
border-radius: 18px;
13+
box-shadow: 0 2px 16px #2224;
14+
}
715
.upload-block {
816
margin-top: 2em;
917
background: #363636;
@@ -19,26 +27,50 @@
1927
font-weight: bold;
2028
margin-bottom: 1em;
2129
}
22-
.data-table {
30+
.data-table-wrap {
31+
overflow-x: auto;
2332
margin-top: 2em;
33+
}
34+
.data-table {
2435
width: 100%;
2536
border-collapse: collapse;
37+
table-layout: fixed;
38+
background: #363636;
2639
}
2740
.data-table th, .data-table td {
2841
border: 1px solid #444;
2942
padding: 0.7em 1em;
3043
text-align: left;
44+
word-break: break-word;
45+
vertical-align: middle;
3146
}
3247
.data-table th {
3348
background: #282;
3449
color: #fff;
3550
}
36-
.data-table td a {
37-
color: #22aadd;
38-
text-decoration: underline;
51+
.data-table input[type="text"] {
52+
max-width: 170px;
53+
background: #222;
54+
color: #fff;
55+
border: 1px solid #888;
56+
border-radius: 6px;
57+
padding: 0.2em 0.7em;
3958
}
40-
.data-table td a:hover {
41-
color: #1177cc;
59+
.data-table button, .data-table .delete-btn {
60+
min-width: 55px;
61+
padding: 0.3em 1em;
62+
}
63+
.data-table .delete-btn {
64+
background: #d33;
65+
color: #fff;
66+
border: none;
67+
border-radius: 6px;
68+
font-weight: bold;
69+
margin-left: 0.7em;
70+
cursor: pointer;
71+
}
72+
.data-table .delete-btn:hover {
73+
background: #a22;
4274
}
4375
.return-home {
4476
display: inline-block;
@@ -51,6 +83,10 @@
5183
font-weight: bold;
5284
}
5385
.return-home:hover { background: #225c44; }
86+
@media (max-width: 900px) {
87+
.container { padding: 0.7em; }
88+
.data-table { font-size: 0.97em; }
89+
}
5490
</style>
5591
</head>
5692
<body>
@@ -98,69 +134,70 @@ <h3>Upload a {{ pretty_title }} {{ tab.title() }} {% if tab == 'dataset' %}(CSV
98134
<div class="msg">{{ edit_message }}</div>
99135
{% endif %}
100136

101-
<!-- Uploaded files table -->
102-
<table class="data-table">
103-
<tr>
104-
<th>Filename</th>
105-
{% if tab == 'dataset' %}<th>Source</th>{% endif %}
106-
<th>Description</th>
107-
<th>Uploaded At</th>
108-
<th>Operation</th>
109-
</tr>
110-
{% for fname, source, description, uploaded_at in uploads %}
111-
<tr>
112-
<td>{{ fname }}</td>
113-
{% if tab == 'dataset' %}
137+
<!-- Uploaded files table in scrollable wrapper -->
138+
<div class="data-table-wrap">
139+
<table class="data-table">
140+
<tr>
141+
<th>Filename</th>
142+
{% if tab == 'dataset' %}<th>Source</th>{% endif %}
143+
<th>Description</th>
144+
<th>Uploaded At</th>
145+
<th>Operation</th>
146+
</tr>
147+
{% for fname, source, description, uploaded_at in uploads %}
148+
<tr>
149+
<td>{{ fname }}</td>
150+
{% if tab == 'dataset' %}
151+
<td>
152+
{% if admin %}
153+
<form method="post" style="display:inline;">
154+
<input type="hidden" name="row_filename" value="{{ fname }}">
155+
<input type="text" name="row_source" value="{{ source or '' }}" size="18">
156+
{% else %}
157+
{{ source or '' }}
158+
{% endif %}
159+
</td>
160+
{% endif %}
114161
<td>
115162
{% if admin %}
116-
<form method="post" style="display:inline;">
117-
<input type="hidden" name="row_filename" value="{{ fname }}">
118-
<input type="text" name="row_source" value="{{ source or '' }}" size="18">
163+
{% if tab == 'dataset' %}
164+
<input type="text" name="row_description" value="{{ description or '' }}" size="22">
165+
<button type="submit" name="edit_row" value="1" style="margin-left:6px;">Save</button>
166+
</form>
167+
{% else %}
168+
<form method="post" style="display:inline;">
169+
<input type="hidden" name="row_filename" value="{{ fname }}">
170+
<input type="text" name="row_description" value="{{ description or '' }}" size="22">
171+
<button type="submit" name="edit_row" value="1" style="margin-left:6px;">Save</button>
172+
</form>
173+
{% endif %}
119174
{% else %}
120-
{{ source or '' }}
175+
{{ description or '' }}
121176
{% endif %}
122177
</td>
123-
{% endif %}
124-
<td>
125-
{% if admin %}
126-
{% if tab == 'dataset' %}
127-
<input type="text" name="row_description" value="{{ description or '' }}" size="22">
128-
<button type="submit" name="edit_row" value="1" style="margin-left:6px;">Save</button>
129-
</form>
130-
{% else %}
131-
<form method="post" style="display:inline;">
132-
<input type="hidden" name="row_filename" value="{{ fname }}">
133-
<input type="text" name="row_description" value="{{ description or '' }}" size="22">
134-
<button type="submit" name="edit_row" value="1" style="margin-left:6px;">Save</button>
135-
</form>
178+
<td>{{ uploaded_at.split('T')[0] if uploaded_at else '' }}</td>
179+
<td>
180+
{% if fname.endswith('.csv') or fname.endswith('.npy') %}
181+
<a href="{{ url_for('view_table', filename=property_name + '/' + tab + '/' + fname) }}" target="_blank">View</a>
136182
{% endif %}
137-
{% else %}
138-
{{ description or '' }}
139-
{% endif %}
140-
</td>
141-
<td>{{ uploaded_at.split('T')[0] if uploaded_at else '' }}</td>
142-
<td>
143-
{% if fname.endswith('.csv') or fname.endswith('.npy') %}
144-
<a href="{{ url_for('view_table', filename=property_name + '/' + tab + '/' + fname) }}" target="_blank">View</a>
145-
{% endif %}
146-
<a href="{{ url_for('uploaded_file', filename=property_name + '/' + tab + '/' + fname) }}" download>Download</a>
147-
{% if admin %}
148-
<form action="{{ url_for('delete_dataset_file', property_name=property_name, tab=tab, filename=fname) }}" method="post" style="display:inline;" onsubmit="return confirm('Delete this file?');"></form>
149-
<button type="submit" style="background:#d33;color:#fff;border:none;padding:0.2em 0.9em;border-radius:5px;margin-left:1em;">Delete</button>
150-
</form>
151-
{% endif %}
152-
153-
</td>
154-
</tr>
155-
{% endfor %}
156-
{% if uploads|length == 0 %}
157-
<tr>
158-
<td colspan="{% if tab == 'dataset' %}5{% else %}4{% endif %}">
159-
No files uploaded yet for this {{ tab }}.
160-
</td>
161-
</tr>
162-
{% endif %}
163-
</table>
183+
<a href="{{ url_for('uploaded_file', filename=property_name + '/' + tab + '/' + fname) }}" download>Download</a>
184+
{% if admin %}
185+
<form action="{{ url_for('delete_dataset_file', property_name=property_name, tab=tab, filename=fname) }}" method="post" style="display:inline;" onsubmit="return confirm('Delete this file?');">
186+
<button type="submit" class="delete-btn">Delete</button>
187+
</form>
188+
{% endif %}
189+
</td>
190+
</tr>
191+
{% endfor %}
192+
{% if uploads|length == 0 %}
193+
<tr>
194+
<td colspan="{% if tab == 'dataset' %}5{% else %}4{% endif %}">
195+
No files uploaded yet for this {{ tab }}.
196+
</td>
197+
</tr>
198+
{% endif %}
199+
</table>
200+
</div>
164201

165202
<a class="return-home" href="{{ url_for('public_home') }}">Return to Home</a>
166203
<a class="return-home" href="{{ url_for('materials_portal') }}" style="margin-left: 1.5em;">Back to Materials Database</a>

0 commit comments

Comments
 (0)