summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--templates/mods/list.html69
1 files changed, 62 insertions, 7 deletions
diff --git a/templates/mods/list.html b/templates/mods/list.html
index 4e75039..b5420b8 100644
--- a/templates/mods/list.html
+++ b/templates/mods/list.html
@@ -16,7 +16,7 @@
16 </form> 16 </form>
17 <p style="margin-top:0.5rem;font-size:0.8rem;color:var(--fg-muted)"> 17 <p style="margin-top:0.5rem;font-size:0.8rem;color:var(--fg-muted)">
18 Select one or more <code>.jar</code> files, or a <code>.zip</code> containing multiple <code>.jar</code>s. 18 Select one or more <code>.jar</code> files, or a <code>.zip</code> containing multiple <code>.jar</code>s.
19 Mods containing <strong>only</strong> client-side classes will be rejected. 19 Disabled mods are renamed to <code>.jar.disabled</code> so the server skips them.
20 </p> 20 </p>
21</div> 21</div>
22 22
@@ -25,9 +25,16 @@
25 <p>No mods installed. Upload a mod to get started.</p> 25 <p>No mods installed. Upload a mod to get started.</p>
26</div> 26</div>
27{% else %} 27{% else %}
28<table class="table"> 28<div class="batch-bar" style="margin-bottom:0.75rem;display:flex;gap:0.5rem;align-items:center">
29 <span style="font-size:0.85rem;color:var(--fg-muted)">With selected:</span>
30 <button type="button" class="btn" id="batch-toggle-btn" onclick="batchSubmit('toggle')">Toggle</button>
31 <button type="button" class="btn-danger"
32 onclick="if(confirm('Permanently delete selected mods?')) batchSubmit('delete')">Delete</button>
33</div>
34<table class="table" id="mods-table">
29 <thead> 35 <thead>
30 <tr> 36 <tr>
37 <th><input type="checkbox" id="select-all" onclick="toggleAll(this)"></th>
31 <th>Name</th> 38 <th>Name</th>
32 <th>Filename</th> 39 <th>Filename</th>
33 <th>Side</th> 40 <th>Side</th>
@@ -38,7 +45,8 @@
38 </thead> 45 </thead>
39 <tbody> 46 <tbody>
40 {% for m in mods %} 47 {% for m in mods %}
41 <tr> 48 <tr class="{% if !m.enabled %}row-dim{% endif %}">
49 <td><input type="checkbox" name="mod_id" value="{{ m.id }}" data-enabled="{{ m.enabled }}"></td>
42 <td> 50 <td>
43 {% if let Some(name) = m.display_name %} 51 {% if let Some(name) = m.display_name %}
44 {{ name }} 52 {{ name }}
@@ -58,26 +66,42 @@
58 <td> 66 <td>
59 {% if !m.accepted %} 67 {% if !m.accepted %}
60 <span class="status-badge status-error">Rejected</span> 68 <span class="status-badge status-error">Rejected</span>
69 {% else if !m.enabled %}
70 <span class="status-badge status-warning">Disabled</span>
61 {% else if m.side == "CLIENT" %} 71 {% else if m.side == "CLIENT" %}
62 <span class="status-badge status-warning">Warning</span> 72 <span class="status-badge status-warning">Warning</span>
63 {% else %} 73 {% else %}
64 <span class="status-badge status-running">Accepted</span> 74 <span class="status-badge status-running">Active</span>
65 {% endif %} 75 {% endif %}
66 {% if let Some(reason) = m.rejection_reason %} 76 {% if let Some(reason) = m.rejection_reason %}
67 <div style="font-size:0.8rem;color:var(--err);margin-top:0.25rem">{{ reason }}</div> 77 <div style="font-size:0.8rem;color:var(--err);margin-top:0.25rem">{{ reason }}</div>
68 {% endif %} 78 {% endif %}
69 </td> 79 </td>
70 <td>{{ m.created_at }}</td> 80 <td>{{ m.created_at }}</td>
71 <td> 81 <td style="white-space:nowrap">
82 <form action="/instances/{{ instance_id }}/mods/{{ m.id }}/toggle" method="post" style="display:inline">
83 <button type="submit" class="btn-sm {% if m.enabled %}btn{% else %}btn-ok{% endif %}">
84 {% if m.enabled %}Disable{% else %}Enable{% endif %}
85 </button>
86 </form>
72 <form action="/instances/{{ instance_id }}/mods/{{ m.id }}/delete" method="post" style="display:inline" 87 <form action="/instances/{{ instance_id }}/mods/{{ m.id }}/delete" method="post" style="display:inline"
73 onsubmit="return confirm('Remove this mod?')"> 88 onsubmit="return confirm('Permanently remove this mod?')">
74 <button type="submit" class="btn-danger btn-sm">Remove</button> 89 <button type="submit" class="btn-danger btn-sm">Delete</button>
75 </form> 90 </form>
76 </td> 91 </td>
77 </tr> 92 </tr>
78 {% endfor %} 93 {% endfor %}
79 </tbody> 94 </tbody>
80</table> 95</table>
96
97<form id="batch-form" method="post" style="display:none"></form>
98
99<div class="batch-bar" style="margin-top:0.75rem;display:flex;gap:0.5rem;align-items:center">
100 <span style="font-size:0.85rem;color:var(--fg-muted)">With selected:</span>
101 <button type="button" class="btn" id="batch-toggle-btn2" onclick="batchSubmit('toggle')">Toggle</button>
102 <button type="button" class="btn-danger"
103 onclick="if(confirm('Permanently delete selected mods?')) batchSubmit('delete')">Delete</button>
104</div>
81{% endif %} 105{% endif %}
82 106
83<div style="margin-top:1rem"> 107<div style="margin-top:1rem">
@@ -85,4 +109,35 @@
85 <button type="submit" class="btn">Rescan All Mods</button> 109 <button type="submit" class="btn">Rescan All Mods</button>
86 </form> 110 </form>
87</div> 111</div>
112
113<script>
114function toggleAll(source) {
115 document.querySelectorAll('input[name="mod_id"]').forEach(cb => cb.checked = source.checked);
116}
117
118function batchSubmit(action) {
119 const checked = document.querySelectorAll('input[name="mod_id"]:checked');
120 if (checked.length === 0) return;
121
122 const form = document.getElementById('batch-form');
123 // Clear any previous hidden inputs
124 form.textContent = '';
125 form.action = '/instances/{{ instance_id }}/mods/batch-' + action;
126
127 for (const cb of checked) {
128 const input = document.createElement('input');
129 input.type = 'hidden';
130 input.name = 'mod_id';
131 input.value = cb.value;
132 form.appendChild(input);
133 }
134
135 form.submit();
136}
137</script>
138
139<style>
140.row-dim { opacity: 0.55; }
141.row-dim:hover { opacity: 0.85; }
142</style>
88{% endblock %} 143{% endblock %}