sub advanced settings modal

This commit is contained in:
Corban-Lee Jones 2024-06-24 23:48:52 +01:00
parent 03139848c6
commit d3bc768000
2 changed files with 63 additions and 10 deletions

View File

@ -154,9 +154,10 @@ $("#addSubscriptionBtn").on("click", async function() {
async function showEditSubModal(subId) {
if (subId === -1) {
$("#subFormModal .form-create, #subAdvancedModal .form-create").show();
$("#subFormModal .form-edit, #subAdvancedModal .form-edit").hide();
$("#subFormModal input, #subFormModal textarea").val("");
$("#subFormModal .form-create").show();
$("#subFormModal .form-edit").hide();
$("#subChannels").val("").change();
$("#subFilters").val("").change();
$("#subMutators").val("").change();
@ -165,6 +166,9 @@ async function showEditSubModal(subId) {
$("#subImagePreview small").show();
}
else {
$("#subFormModal .form-create, #subAdvancedModal .form-create").hide();
$("#subFormModal .form-edit, #subAdvancedModal .form-edit").show();
const subscription = subTable.row(function(idx, data, node) {
return data.id === subId;
}).data();
@ -173,8 +177,6 @@ async function showEditSubModal(subId) {
$("#subUrl").val(subscription.url);
$("#subExtraNotes").val(subscription.extra_notes);
$("#subActive").prop("checked", subscription.active);
$("#subFormModal .form-create").hide();
$("#subFormModal .form-edit").show();
$("#subMutators").val("").change();
$("#subMutators").val(subscription.mutators.map(mutator => mutator.id)).change();

View File

@ -3,7 +3,7 @@
<div class="modal-content rounded-1">
<form id="subForm" class="mb-0" novalidate>
<div class="modal-header">
<h5 class="modal-title">
<h5 class="modal-title ms-2">
<span class="form-create">Add</span>
<span class="form-edit">Edit</span>
Subscription
@ -39,12 +39,12 @@
<select name="subFilters" id="subFilters" class="select-2" multiple data-dropdownparent="#subFormModal" tabindex="4"></select>
<div class="form-text">Filters to apply to this subscription's content.</div>
</div>
<div>
<!-- <div>
<label for="subMutators" class="form-label">Article Mutators</label>
<select name="subMutators" id="subMutators" class="select-2" multiple data-dropdownparent="#subFormModal" tabindex="6"></select>
<div class="form-text">Apply mutators to subscription articles.</div>
</div>
<div class="form-switch mb-4 ps-0 d-none">
</div> -->
<div class="form-switch mb-4 ps-0">
<label for="subActive" class="form-check-label mb-2">Active</label>
<br>
<input type="checkbox" id="subActive" name="subActive" class="form-check-input ms-0 mt-0" tabindex="6">
@ -57,7 +57,7 @@
<div class="modal-footer px-4">
<button type="button" id="devGenerateSub" class="btn btn-outline-info rounded-1 me-3 ms-0 form-create" tabindex="7">&#40;Dev&#41; Generate</button>
<button type="button" id="deleteEditSub" class="btn btn-danger rounded-1 me-3 ms-0 form-edit" tabindex="8">Delete</button>
<button type="button" id="subMutatorsBtn" class="btn btn-outline-primary rounded-1 me-auto ms-0" tabindex="9">Article Mutators</button>
<button type="button" class="btn btn-outline-primary rounded-1 me-auto ms-0" data-bs-toggle="modal" data-bs-target="#subAdvancedModal" tabindex="9">Advanced</button>
<button type="submit" class="btn btn-primary rounded-1 me-0" tabindex="9">
<span class="form-create">Create</span>
<span class="form-edit">Confirm Edit</span>
@ -67,4 +67,55 @@
</form>
</div>
</div>
</div>
</div>
<div id="subAdvancedModal" class="modal modal-lg fade" data-bs-backdrop="static" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content rounded-1">
<form id="subAdvancedForm" class="mb-0" novalidate>
<div class="modal-header">
<h5 class="modal-title ms-2">
<span class="form-create">Add</span>
<span class="form-edit">Edit</span>
Subscription · Advanced
</h5>
</div>
<div class="modal-body p-4">
<div class="row">
<div class="col-lg-6 pe-lg-4">
<div class="mb-4">
<label for="subMutators" class="form-label">Title Mutators</label>
<select name="subMutators" id="subMutators" class="select-2" multiple data-dropdownparent="#subAdvancedModal" tabindex="6"></select>
<div class="form-text">Apply mutators to article titles.</div>
</div>
</div>
<div class="col-lg-6 ps-lg-4">
<div class="mb-4">
<label for="subDescMutators" class="form-label">Description Mutators</label>
<select name="subDescMutators" id="subDescMutators" class="select-2" multiple data-dropdownparent="#subAdvancedModal" tabindex="6"></select>
<div class="form-text">Apply mutators to article descriptions.</div>
</div>
</div>
<div class="col-lg-6 pe-lg-4">
<label for="" class="form-label">Article Fetch Limit</label>
<input type="number" id="subFetchLimit" class="form-control rounded-1" max="10" min="1">
<div class="form-text">Limit the number of articles fetched every cycle.</div>
</div>
<div class="col-lg-6 ps-lg-4">
<div class="form-switch ps-0">
<label for="subResetFetchLimit" class="form-check-label mb-2">Max Fetch Limit after the First Cycle</label>
<br>
<input type="checkbox" id="subResetFetchLimit" name="subResetFetchLimit" class="form-check-input ms-0 mt-0" tabindex="6">
<br>
<div class="form-text">Sets the Fetch Limit to 10 after the first cycle. Helps with initial spam.</div>
</div>
</div>
</div>
</div>
<div class="modal-footer px-4">
<button type="button" class="btn btn-primary rounded-1 me-0 ms-3" data-bs-toggle="modal" data-bs-target="#subFormModal">Back</button>
</div>
</form>
</div>
</div>
</div>