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); data.history_public_to_subscribers = JSON.stringify(history_public_to_subscribers);
const stream_post_policy = Number.parseInt( 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, 10,
); );

View File

@ -379,7 +379,7 @@ function change_stream_privacy(e) {
const privacy_setting = $("#stream_privacy_modal input[name=privacy]:checked").val(); const privacy_setting = $("#stream_privacy_modal input[name=privacy]:checked").val();
const stream_post_policy = Number.parseInt( 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, 10,
); );

View File

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