stream_settings: Implement dropdown widget for "stream post policy".

In stream edit and stream create replace the existing checkbox
format for choosing "stream post policy" with dropdown widget.

In "stream_types.hbs" implement the dropdown menu and remove
the checkbox format for selecting "stream post policy".

In "stream_create.js" and "stream_edit.js" edit the code for
"stream_post_policy" to extract the "stream post policy" value
from the dropdown menu after submitting the form.
This commit is contained in:
NerdyLucifer 2022-03-07 12:13:41 +05:30 committed by Tim Abbott
parent 1eb1aa70ed
commit 5f472b1607
3 changed files with 11 additions and 12 deletions

View File

@ -196,7 +196,7 @@ function create_stream() {
data.history_public_to_subscribers = JSON.stringify(history_public_to_subscribers);
const stream_post_policy = Number.parseInt(
$("#stream_creation_form input[name=stream-post-policy]:checked").val(),
$("#stream_creation_form select[name=stream-post-policy]").val(),
10,
);

View File

@ -379,7 +379,7 @@ function change_stream_privacy(e) {
const privacy_setting = $("#stream_privacy_modal input[name=privacy]:checked").val();
const stream_post_policy = Number.parseInt(
$("#stream_privacy_modal input[name=stream-post-policy]:checked").val(),
$("#stream_privacy_modal select[name=stream-post-policy]").val(),
10,
);

View File

@ -25,17 +25,16 @@
{{/if}}
<div class="input-group">
<h4>{{t 'Who can post to the stream?'}}
<label>{{t 'Who can post to the stream?'}}
{{> ../help_link_widget link="/help/stream-sending-policy" }}
</h4>
{{#each stream_post_policy_values}}
<div class="radio-input-parent">
<label class="radio">
<input type="radio" name="stream-post-policy" value="{{ this.code }}" {{#if (eq this.code ../stream_post_policy) }}checked{{/if}} />
{{ this.description }}
</label>
</div>
{{/each}}
</label>
<select name="stream-post-policy" class="stream_post_policy_setting prop-element">
{{#each stream_post_policy_values}}
<option value="{{this.code}}" {{#if (eq this.code ../stream_post_policy) }}selected{{/if}}>
{{ this.description}}
</option>
{{/each}}
</select>
</div>
{{#if (or is_owner is_stream_edit)}}