Changeset 88d7c8f in Klonkt for src/assets/js/guardian.js
- Timestamp:
- 07/29/2026 07:15:16 AM (6 weeks ago)
- Branches:
- main
- Children:
- e27b8db
- Parents:
- 439f095
- File:
-
- 1 edited
-
src/assets/js/guardian.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/assets/js/guardian.js
r439f095 r88d7c8f 150 150 } 151 151 152 /** A gated-setting proposal (FEP-633c 5.6) a fellow guardian opened on a 153 * ward we share, forwarded here by the ward's server. Answering is the 154 * whole point: without a second voice the threshold is never met and the 155 * proposal quietly expires. */ 156 function gatedCard(g) { 157 var card = el('div', 'g-card gated'); 158 var line = g.value ? (T.gated_line_on || '') : (T.gated_line_off || ''); 159 card.appendChild(el('div', 'who', line 160 .replace('{who}', handleOf(g.proposer || '')) 161 .replace('{ward}', handleOf(g.ward)))); 162 var row = el('div', 'row'); 163 var yes = el('button', 'small', T.gated_agree || 'Agree'); 164 var no = el('button', 'quiet small', T.gated_disagree || 'Disagree'); 165 function answerGated(decision, btn) { 166 btn.disabled = true; 167 fetch('/guardian/api/gated/' + encodeURIComponent(g.id), { 168 method: 'POST', headers: { 'Content-Type': 'application/json' }, 169 body: JSON.stringify({ answer: decision, site: S.site }), 170 }).then(refresh).catch(function () { btn.disabled = false; }); 171 } 172 yes.addEventListener('click', function () { answerGated('accept', yes); }); 173 no.addEventListener('click', function () { answerGated('reject', no); }); 174 row.appendChild(yes); row.appendChild(no); 175 card.appendChild(row); 176 return card; 177 } 178 152 179 function renderPending() { 153 180 var list = document.getElementById('pending-list'); 154 181 list.textContent = ''; 155 182 var offers = S.offers || []; 183 var gated = S.gatedReviews || []; 156 184 // The offers state carries the adoption offers; the lapse proposals ride 157 185 // separately so a lapse never renders as an adoption. … … 162 190 }); 163 191 lapses.forEach(function (l) { list.appendChild(lapseCard(l)); }); 164 show('pending-section', offers.length > 0 || lapses.length > 0); 192 gated.forEach(function (g) { list.appendChild(gatedCard(g)); }); 193 show('pending-section', offers.length > 0 || lapses.length > 0 || gated.length > 0); 165 194 } 166 195
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)