Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

custom_profile_fields: Add edit button with tooltip for select choice.

Shubham Padia701e7a11077a
diff --git a/web/src/settings_profile_fields.ts b/web/src/settings_profile_fields.ts
index 614b0bbab54..982b512f62c 100644
--- a/web/src/settings_profile_fields.ts
+++ b/web/src/settings_profile_fields.ts
@@ -569,6 +569,7 @@ function set_up_select_field_edit_form(
render_settings_profile_field_choice({
text: choice.text,
value: choice.value,
+ is_existing_choice: true,
}),
),
);
@@ -669,6 +670,18 @@ function open_custom_profile_field_edit_form_modal(this: HTMLElement): void {
delete_choice_row_for_edit(this, $profile_field_form, field);
},
);
+ $edit_profile_field_choices_container.on(
+ "click",
+ "button.edit-choice",
+ function (this: HTMLElement) {
+ $(this)
+ .closest(".choice-row")
+ .find("input")
+ .prop("disabled", false)
+ .trigger("focus");
+ $(this).hide();
+ },
+ );
$profile_field_form.on(
"click",
".profile-field-choices-wrapper > button.alphabetize-choices-button",
diff --git a/web/templates/settings/profile_field_choice.hbs b/web/templates/settings/profile_field_choice.hbs
index 0b799a5d976..afc85842567 100644
--- a/web/templates/settings/profile_field_choice.hbs
+++ b/web/templates/settings/profile_field_choice.hbs
@@ -3,6 +3,9 @@
<i class="fa fa-ellipsis-v" aria-hidden="true"></i>
<i class="fa fa-ellipsis-v" aria-hidden="true"></i>
</span>
- <input type='text' class="modal_text_input" placeholder='{{t "New option" }}' value="{{ text }}" />
+ <input type='text' class="modal_text_input" placeholder='{{t "New option" }}' value="{{ text }}" {{#if is_existing_choice}}disabled{{/if}} />
+ {{#if is_existing_choice}}
+ {{> ../components/icon_button intent="neutral" custom_classes="edit-choice tippy-zulip-tooltip" icon="edit" data-tippy-content=(t "Making changes to this choice will modify the profiles of the users who've selected it.") aria-label=(t "Edit choice") }}
+ {{/if}}
{{> ../components/icon_button intent="danger" custom_classes="delete-choice tippy-zulip-tooltip" hidden=new_empty_choice_row icon="trash" data-tippy-content=(t "Delete") aria-label=(t "Delete") }}
</div>