Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#8818 fix default checkbox checked value issue on anon config modal #8825

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions plugins/tiddlywiki/multiwikiserver/templates/anon-config-modal.tid
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@ class: mws-modal
<form class="mws-anon-config-form" method="POST" action="/admin/post-anon-config">
<div class="mws-modal-section">
<$set name="isChecked" value={{{ [[$:/config/MultiWikiServer/AllowAnonymousReads]get[text]] }}}>
<input type="checkbox" name="allowReads" checked=<<isChecked>>/> Allow anonymous reads
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I wonder why the checkbox widget cannot be used here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach here is to use wikitext to generate a static HTML form. The checkbox widget doesn't work within a static rendering because it needs the TW runtime.

<$list filter="[<isChecked>match[yes]]">
<input type="checkbox" name="allowReads" checked/> Allow anonymous reads
</$list>
<$list filter="[<isChecked>!match[yes]]">
<input type="checkbox" name="allowReads"/> Allow anonymous reads
</$list>
</$set>
</div>
<div class="mws-modal-section">
<$set name="isChecked" value={{{ [[$:/config/MultiWikiServer/AllowAnonymousWrites]get[text]] }}}>
<input type="checkbox" name="allowWrites" checked=<<isChecked>>/> Allow anonymous writes
<$list filter="[<isChecked>match[yes]]">
<input type="checkbox" name="allowWrites" checked/> Allow anonymous writes
</$list>
<$list filter="[<isChecked>!match[yes]]">
<input type="checkbox" name="allowWrites"/> Allow anonymous writes
</$list>
</$set>
</div>
<div class="mws-modal-buttons">
Expand Down
Loading