Admin: add Describe button to edit form (restore describe->use in form)
This commit is contained in:
parent
53ad9199c9
commit
96d14d8563
1 changed files with 31 additions and 17 deletions
48
new.php
48
new.php
|
|
@ -837,24 +837,38 @@ function applySwitchPayload(payload){
|
||||||
<script>
|
<script>
|
||||||
(function(){
|
(function(){
|
||||||
function attachDescribeButtons(){
|
function attachDescribeButtons(){
|
||||||
document.querySelectorAll('.admin-video-row').forEach(function(row){
|
document.querySelectorAll('.admin-video-row').forEach(function(row){
|
||||||
if (row.querySelector('.describe-button')) return;
|
if (row.querySelector('.describe-button')) return;
|
||||||
var actions = row.querySelector('.admin-actions');
|
var actions = row.querySelector('.admin-actions');
|
||||||
if (!actions) return;
|
if (!actions) return;
|
||||||
var job = row.dataset.job;
|
var job = row.dataset.job;
|
||||||
if (!job) return;
|
if (!job) return;
|
||||||
var describe = document.createElement('a');
|
var describe = document.createElement('a');
|
||||||
describe.className = 'button describe-button';
|
describe.className = 'button describe-button';
|
||||||
describe.href = '#';
|
describe.href = '#';
|
||||||
describe.dataset.job = job;
|
describe.dataset.job = job;
|
||||||
describe.textContent = 'Describe';
|
describe.textContent = 'Describe';
|
||||||
var first = actions.querySelector('.button');
|
var first = actions.querySelector('.button');
|
||||||
if (first) actions.insertBefore(describe, first);
|
if (first) actions.insertBefore(describe, first);
|
||||||
else actions.appendChild(describe);
|
else actions.appendChild(describe);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
function showModal(job, description, rawJson){
|
// Also add a Describe button to the edit form (when editing a single job)
|
||||||
|
var editForm = document.getElementById('edit-form');
|
||||||
|
if (editForm && !editForm.querySelector('.describe-button')) {
|
||||||
|
var dirInput = editForm.querySelector('input[name="dir"]');
|
||||||
|
if (dirInput && dirInput.value) {
|
||||||
|
var describe2 = document.createElement('button');
|
||||||
|
describe2.className = 'button describe-button';
|
||||||
|
describe2.type = 'button';
|
||||||
|
describe2.dataset.job = dirInput.value;
|
||||||
|
describe2.textContent = 'Describe';
|
||||||
|
var submit = editForm.querySelector('button[type="submit"]');
|
||||||
|
if (submit) submit.parentNode.insertBefore(describe2, submit);
|
||||||
|
else editForm.appendChild(describe2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function showModal(job, description, rawJson){
|
||||||
var existing = document.getElementById('mvlog-gemini-modal');
|
var existing = document.getElementById('mvlog-gemini-modal');
|
||||||
if (existing) existing.remove();
|
if (existing) existing.remove();
|
||||||
var overlay = document.createElement('div');
|
var overlay = document.createElement('div');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue