Merge pull request #40 from wagesj45/codex/add-bulma.css-classes-to-rules
Fix missing Bulma classes when adding rules
This commit is contained in:
commit
c370de36cc
1 changed files with 10 additions and 9 deletions
|
@ -118,9 +118,10 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
||||||
function createActionRow(action = {type: 'tag'}) {
|
function createActionRow(action = {type: 'tag'}) {
|
||||||
const row = document.createElement('div');
|
const row = document.createElement('div');
|
||||||
row.className = 'action-row field is-grouped';
|
row.className = 'action-row field is-grouped mb-2';
|
||||||
|
|
||||||
const typeSelect = document.createElement('select');
|
const typeSelect = document.createElement('select');
|
||||||
|
typeSelect.className = 'select is-small';
|
||||||
['tag','move','junk'].forEach(t => {
|
['tag','move','junk'].forEach(t => {
|
||||||
const opt = document.createElement('option');
|
const opt = document.createElement('option');
|
||||||
opt.value = t;
|
opt.value = t;
|
||||||
|
@ -135,7 +136,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
paramSpan.innerHTML = '';
|
paramSpan.innerHTML = '';
|
||||||
if (typeSelect.value === 'tag') {
|
if (typeSelect.value === 'tag') {
|
||||||
const sel = document.createElement('select');
|
const sel = document.createElement('select');
|
||||||
sel.className = 'tag-select';
|
sel.className = 'select is-small tag-select';
|
||||||
for (const t of tagList) {
|
for (const t of tagList) {
|
||||||
const opt = document.createElement('option');
|
const opt = document.createElement('option');
|
||||||
opt.value = t.key;
|
opt.value = t.key;
|
||||||
|
@ -146,7 +147,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
paramSpan.appendChild(sel);
|
paramSpan.appendChild(sel);
|
||||||
} else if (typeSelect.value === 'move') {
|
} else if (typeSelect.value === 'move') {
|
||||||
const sel = document.createElement('select');
|
const sel = document.createElement('select');
|
||||||
sel.className = 'folder-select';
|
sel.className = 'select is-small folder-select';
|
||||||
for (const f of folderList) {
|
for (const f of folderList) {
|
||||||
const opt = document.createElement('option');
|
const opt = document.createElement('option');
|
||||||
opt.value = f.id;
|
opt.value = f.id;
|
||||||
|
@ -157,7 +158,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
paramSpan.appendChild(sel);
|
paramSpan.appendChild(sel);
|
||||||
} else if (typeSelect.value === 'junk') {
|
} else if (typeSelect.value === 'junk') {
|
||||||
const sel = document.createElement('select');
|
const sel = document.createElement('select');
|
||||||
sel.className = 'junk-select';
|
sel.className = 'select is-small junk-select';
|
||||||
sel.appendChild(new Option('mark junk','true'));
|
sel.appendChild(new Option('mark junk','true'));
|
||||||
sel.appendChild(new Option('mark not junk','false'));
|
sel.appendChild(new Option('mark not junk','false'));
|
||||||
sel.value = String(action.junk ?? true);
|
sel.value = String(action.junk ?? true);
|
||||||
|
@ -185,7 +186,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
rulesContainer.innerHTML = '';
|
rulesContainer.innerHTML = '';
|
||||||
for (const rule of rules) {
|
for (const rule of rules) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.className = 'rule box';
|
div.className = 'rule box mb-4';
|
||||||
div.draggable = true;
|
div.draggable = true;
|
||||||
div.addEventListener('dragstart', ev => { dragRule = div; ev.dataTransfer.setData('text/plain', ''); });
|
div.addEventListener('dragstart', ev => { dragRule = div; ev.dataTransfer.setData('text/plain', ''); });
|
||||||
div.addEventListener('dragover', ev => ev.preventDefault());
|
div.addEventListener('dragover', ev => ev.preventDefault());
|
||||||
|
@ -208,10 +209,10 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
critInput.type = 'text';
|
critInput.type = 'text';
|
||||||
critInput.placeholder = 'Criterion';
|
critInput.placeholder = 'Criterion';
|
||||||
critInput.value = rule.criterion || '';
|
critInput.value = rule.criterion || '';
|
||||||
critInput.className = 'criterion';
|
critInput.className = 'input criterion mb-2';
|
||||||
|
|
||||||
const actionsContainer = document.createElement('div');
|
const actionsContainer = document.createElement('div');
|
||||||
actionsContainer.className = 'rule-actions';
|
actionsContainer.className = 'rule-actions mb-2';
|
||||||
|
|
||||||
for (const act of (rule.actions || [])) {
|
for (const act of (rule.actions || [])) {
|
||||||
actionsContainer.appendChild(createActionRow(act));
|
actionsContainer.appendChild(createActionRow(act));
|
||||||
|
@ -220,11 +221,11 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const addAction = document.createElement('button');
|
const addAction = document.createElement('button');
|
||||||
addAction.textContent = 'Add Action';
|
addAction.textContent = 'Add Action';
|
||||||
addAction.type = 'button';
|
addAction.type = 'button';
|
||||||
addAction.className = 'button is-small';
|
addAction.className = 'button is-small mb-2';
|
||||||
addAction.addEventListener('click', () => actionsContainer.appendChild(createActionRow()));
|
addAction.addEventListener('click', () => actionsContainer.appendChild(createActionRow()));
|
||||||
|
|
||||||
const stopLabel = document.createElement('label');
|
const stopLabel = document.createElement('label');
|
||||||
stopLabel.className = 'checkbox ml-2';
|
stopLabel.className = 'checkbox ml-2 mb-2';
|
||||||
const stopCheck = document.createElement('input');
|
const stopCheck = document.createElement('input');
|
||||||
stopCheck.type = 'checkbox';
|
stopCheck.type = 'checkbox';
|
||||||
stopCheck.className = 'stop-processing';
|
stopCheck.className = 'stop-processing';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue