edit subscribers: Lift form tag to parent template.

For our Subscribers tab we want to enclose our
add-subscriber widget in a form for now, and we
continue to do so, but now we have the form tag
getting created in the parent template, not the
child.

Here is why:

    We want to re-use our add-subscriber widget in an
    upcoming commit for when you create streams.

    In our create-stream UI, there is already an outer
    <form>...</form> section of the HTML for the entire
    process of creating a stream.

    HTML does not yet you nest forms, and even though
    browsers just silently ignore an inner form, we won't
    want to create semantically incorrect HTML.

    Therefore, we want the child template not to have
    the form tags around them.

It's possible that we don't really even want to
enclose the input-pill widget and Add button inside
a form for the Subscribers tab, but tweaking that
for now is too risky. (We don't really take advantage
of the form tag in any meaningful way, since we
don't directly submit form data to the server, and
we can't use a single submit handler for the Enter
key and Add button due to some magic in our input
pills.)
This commit is contained in:
Steve Howell 2022-02-15 22:20:30 +00:00 committed by Tim Abbott
parent 67fe782714
commit 1e8dff6ca9
2 changed files with 14 additions and 14 deletions

View File

@ -1,5 +1,4 @@
<form>
<div class="add_subscribers_container">
<div class="add_subscribers_container">
<div class="pill-container person_picker">
<div class="input" contenteditable="true"
data-placeholder="{{t 'Add subscribers. Use usergroup or #streamname to bulk add subscribers.' }}">
@ -11,5 +10,4 @@
{{t 'Add' }}
</button>
</div>
</div>
</form>
</div>

View File

@ -8,7 +8,9 @@
<input type="text" class="search" placeholder="{{t 'Search subscribers' }}" />
</div>
<div class="subscriber_list_add float-left">
<form>
{{> add_subscribers_form}}
</form>
<div class="stream_subscription_request_result"></div>
</div>
<div class="clear-float"></div>