mirror of https://github.com/zulip/zulip.git
group-settings: Use group_setting_value_pill_input template.
We now use group_setting_value_pill_input template for user group permission settings to avoid duplicate code.
This commit is contained in:
parent
d5a391a56b
commit
3af84d6e69
|
@ -260,28 +260,27 @@ export function set_up_handlers(): void {
|
||||||
settings_components.enable_opening_typeahead_on_clicking_label($container);
|
settings_components.enable_opening_typeahead_on_clicking_label($container);
|
||||||
|
|
||||||
can_add_members_group_widget = settings_components.create_group_setting_widget({
|
can_add_members_group_widget = settings_components.create_group_setting_widget({
|
||||||
$pill_container: $container.find(".can-add-members-group-container .pill-container"),
|
$pill_container: $("#id_new_group_can_add_members_group"),
|
||||||
setting_name: "can_add_members_group",
|
setting_name: "can_add_members_group",
|
||||||
});
|
});
|
||||||
|
|
||||||
const $pill_container = $container.find(".can-manage-group-container .pill-container");
|
|
||||||
can_manage_group_widget = settings_components.create_group_setting_widget({
|
can_manage_group_widget = settings_components.create_group_setting_widget({
|
||||||
$pill_container,
|
$pill_container: $("#id_new_group_can_manage_group"),
|
||||||
setting_name: "can_manage_group",
|
setting_name: "can_manage_group",
|
||||||
});
|
});
|
||||||
|
|
||||||
can_join_group_widget = settings_components.create_group_setting_widget({
|
can_join_group_widget = settings_components.create_group_setting_widget({
|
||||||
$pill_container: $container.find(".can-join-group-container .pill-container"),
|
$pill_container: $("#id_new_group_can_join_group"),
|
||||||
setting_name: "can_join_group",
|
setting_name: "can_join_group",
|
||||||
});
|
});
|
||||||
|
|
||||||
can_leave_group_widget = settings_components.create_group_setting_widget({
|
can_leave_group_widget = settings_components.create_group_setting_widget({
|
||||||
$pill_container: $container.find(".can-leave-group-container .pill-container"),
|
$pill_container: $("#id_new_group_can_leave_group"),
|
||||||
setting_name: "can_leave_group",
|
setting_name: "can_leave_group",
|
||||||
});
|
});
|
||||||
|
|
||||||
can_mention_group_widget = settings_components.create_group_setting_widget({
|
can_mention_group_widget = settings_components.create_group_setting_widget({
|
||||||
$pill_container: $container.find(".can-mention-group-container .pill-container"),
|
$pill_container: $("#id_new_group_can_mention_group"),
|
||||||
setting_name: "can_mention_group",
|
setting_name: "can_mention_group",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,33 +154,32 @@ function show_membership_settings(group) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_general_settings(group) {
|
function show_general_settings(group) {
|
||||||
const $edit_container = get_edit_container(group);
|
|
||||||
settings_components.create_group_setting_widget({
|
settings_components.create_group_setting_widget({
|
||||||
$pill_container: $edit_container.find(".can-add-members-group-container .pill-container"),
|
$pill_container: $("#id_can_add_members_group"),
|
||||||
setting_name: "can_add_members_group",
|
setting_name: "can_add_members_group",
|
||||||
group,
|
group,
|
||||||
});
|
});
|
||||||
|
|
||||||
settings_components.create_group_setting_widget({
|
settings_components.create_group_setting_widget({
|
||||||
$pill_container: $edit_container.find(".can-manage-group-container .pill-container"),
|
$pill_container: $("#id_can_manage_group"),
|
||||||
setting_name: "can_manage_group",
|
setting_name: "can_manage_group",
|
||||||
group,
|
group,
|
||||||
});
|
});
|
||||||
|
|
||||||
settings_components.create_group_setting_widget({
|
settings_components.create_group_setting_widget({
|
||||||
$pill_container: $edit_container.find(".can-join-group-container .pill-container"),
|
$pill_container: $("#id_can_join_group"),
|
||||||
setting_name: "can_join_group",
|
setting_name: "can_join_group",
|
||||||
group,
|
group,
|
||||||
});
|
});
|
||||||
|
|
||||||
settings_components.create_group_setting_widget({
|
settings_components.create_group_setting_widget({
|
||||||
$pill_container: $edit_container.find(".can-leave-group-container .pill-container"),
|
$pill_container: $("#id_can_leave_group"),
|
||||||
setting_name: "can_leave_group",
|
setting_name: "can_leave_group",
|
||||||
group,
|
group,
|
||||||
});
|
});
|
||||||
|
|
||||||
settings_components.create_group_setting_widget({
|
settings_components.create_group_setting_widget({
|
||||||
$pill_container: $edit_container.find(".can-mention-group-container .pill-container"),
|
$pill_container: $("#id_can_mention_group"),
|
||||||
setting_name: "can_mention_group",
|
setting_name: "can_mention_group",
|
||||||
group,
|
group,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,49 +1,24 @@
|
||||||
<div class="input-group can-manage-group-container">
|
{{> ../settings/group_setting_value_pill_input
|
||||||
<label class="group-setting-label">{{t "Who can administer this group" }}</label>
|
setting_name="can_manage_group"
|
||||||
<div class="pill-container person_picker prop-element" id="id_{{can_manage_group_widget_name}}" data-setting-widget-type="group-setting-type">
|
label=(t 'Who can administer this group')
|
||||||
<div class="input" contenteditable="true"
|
prefix=prefix }}
|
||||||
data-placeholder="{{t 'Add roles, groups or users' }}">
|
|
||||||
{{~! Squash whitespace so that placeholder is displayed when empty. ~}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="input-group can-mention-group-container">
|
{{> ../settings/group_setting_value_pill_input
|
||||||
<label class="group-setting-label">{{t "Who can mention this group" }}</label>
|
setting_name="can_mention_group"
|
||||||
<div class="pill-container person_picker prop-element" id="id_{{can_mention_group_widget_name}}" data-setting-widget-type="group-setting-type">
|
label=(t 'Who can mention this group')
|
||||||
<div class="input" contenteditable="true"
|
prefix=prefix }}
|
||||||
data-placeholder="{{t 'Add roles, groups or users' }}">
|
|
||||||
{{~! Squash whitespace so that placeholder is displayed when empty. ~}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="input-group can-add-members-group-container">
|
{{> ../settings/group_setting_value_pill_input
|
||||||
<label class="group-setting-label">{{t "Who can add members to this group" }}</label>
|
setting_name="can_add_members_group"
|
||||||
<div class="pill-container person_picker prop-element" id="id_{{can_add_members_group_widget_name}}" data-setting-widget-type="group-setting-type">
|
label=(t 'Who can add members to this group')
|
||||||
<div class="input" contenteditable="true"
|
prefix=prefix }}
|
||||||
data-placeholder="{{t 'Add roles, groups or users' }}">
|
|
||||||
{{~! Squash whitespace so that placeholder is displayed when empty. ~}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="input-group can-join-group-container">
|
{{> ../settings/group_setting_value_pill_input
|
||||||
<label class="group-setting-label">{{t "Who can join this group" }}</label>
|
setting_name="can_join_group"
|
||||||
<div class="pill-container person_picker prop-element" id="id_{{can_join_group_widget_name}}" data-setting-widget-type="group-setting-type">
|
label=(t 'Who can join this group')
|
||||||
<div class="input" contenteditable="true"
|
prefix=prefix }}
|
||||||
data-placeholder="{{t 'Add roles, groups or users' }}">
|
|
||||||
{{~! Squash whitespace so that placeholder is displayed when empty. ~}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="input-group can-leave-group-container">
|
{{> ../settings/group_setting_value_pill_input
|
||||||
<label class="group-setting-label">{{t "Who can leave this group" }}</label>
|
setting_name="can_leave_group"
|
||||||
<div class="pill-container person_picker prop-element" id="id_{{can_leave_group_widget_name}}" data-setting-widget-type="group-setting-type">
|
label=(t 'Who can leave this group')
|
||||||
<div class="input" contenteditable="true"
|
prefix=prefix }}
|
||||||
data-placeholder="{{t 'Add roles, groups or users' }}">
|
|
||||||
{{~! Squash whitespace so that placeholder is displayed when empty. ~}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -28,13 +28,7 @@
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{> group_permissions
|
{{> group_permissions prefix="id_new_group_"}}
|
||||||
can_add_members_group_widget_name="new_group_can_add_members_group"
|
|
||||||
can_join_group_widget_name="new_group_can_join_group"
|
|
||||||
can_leave_group_widget_name="new_group_can_leave_group"
|
|
||||||
can_mention_group_widget_name="new_group_can_mention_group"
|
|
||||||
can_manage_group_widget_name="new_group_can_manage_group"
|
|
||||||
}}
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -43,13 +43,7 @@
|
||||||
{{> ../settings/settings_save_discard_widget section_name="group-permissions" }}
|
{{> ../settings/settings_save_discard_widget section_name="group-permissions" }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{> group_permissions
|
{{> group_permissions prefix="id_"}}
|
||||||
can_add_members_group_widget_name="can_add_members_group"
|
|
||||||
can_join_group_widget_name="can_join_group"
|
|
||||||
can_leave_group_widget_name="can_leave_group"
|
|
||||||
can_mention_group_widget_name="can_mention_group"
|
|
||||||
can_manage_group_widget_name="can_manage_group"
|
|
||||||
}}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="group_detail_box">
|
<div class="group_detail_box">
|
||||||
|
|
Loading…
Reference in New Issue