Commit Graph

103 Commits

Author SHA1 Message Date
Lauryn Menard 48e2482bbd popovers: Rename "profile summary" to "user card".
This is a briefer and more intuitive name for this frequently accessed
part of the Zulip UI.
2022-11-14 12:15:54 -08:00
David Rosa 64c31b7cb9 help: Rename "Add custom profile fields" -> "Custom profile fields".
Renames the help article on custom profile fields to reflect that
its content is not just about adding fields.

Adds a redirect from the old URL to the new URL and updates internal
links, linking to #add-a-custom-profile-field where appropriate.

Fixes #23170.
2022-10-19 11:58:00 -07:00
Sahil Batra 1dd3a7e2c8 settings: Uncheck display_in_profile_summary checkbox if hidden.
We should uncheck the display_in_profile_summary checkbox in the
custom field creation form if the checkbox is hidden, like for
LONG_TEXT or USER type fields which are not allowed to be
displayed in profile summary.

This solves the bug where a user initially checks the
display_in_profile_summary field and then changes the type
to LONG_TEXT or USER where the checkbox is hidden but it
still remains checked and thus the request to server is made
with display_in_profile_summary=true for which server returns
error.

Fixes #23171.
2022-10-12 09:42:32 -07:00
Sahil Batra da8817889b settings: Check "display_profile_in_summary" for Pronouns type field.
While creating a pronouns type field, "display_in_profile_summary"
checkbox is checked by default for "Pronouns" type field if the
limit is not reached.

Fixes #21271.
2022-10-06 17:56:26 -07:00
Sahil Batra 12ba5cb814 settings: Add default label and hint when creating "Prounouns" custom field.
Label and hint can be edited, but we just fill it by default values for
convenience.
2022-10-06 17:56:26 -07:00
Yogesh Sirsat a3094d0f26 custom_profile_fields: Toggle new "display_in_profile_summary" field.
Custom profile fields table `CSS` changed to fit the new "Display"
column of checkboxes, checkboxes are for select/deselect custom
profile field to display in profile popover.

New option "Display in profile summary" added in create and edit
custom profile fields form, with the help of this the user can
pick max of 2 custom profile fields except for `LONG_TEXT` and
`USER` fields to display in his user profile popover.

Checkboxes will go in a disabled state, with an explanatory tooltip,
if we've already passed the limit of 2 fields with this setting
enabled.

Fixes #21215.
2022-09-20 17:03:57 -07:00
Yogesh Sirsat 8d04e2b4c3 custom_profile_fields: Display deleted options in confirmation modal.
While editing custom profile fields, when user delete option(s) of
select type profile field, display that deleted option(s) in delete
option confirmation modal.

Follow-up: 21878
2022-09-16 15:04:01 -07:00
Yogesh Sirsat 1c2b90eae9 custom_profile_fields: Update text of delete options confirmation modal. 2022-09-16 15:04:01 -07:00
Yogesh Sirsat 2328dc0d4e custom_profile_fields: Confirmation modal for delete profile field. 2022-09-16 15:04:01 -07:00
Yogesh Sirsat c4233d2472 custom_profile_fields: Display success status after add/edit fields.
Display success status "Saved" for consistency in settings UI, after
successful request of Add or Edit custom profile fields.

Follow-up: #21878
2022-09-16 15:04:01 -07:00
Yogesh Sirsat ce14df0f4f custom_profile_fields: Display data of default external type while edit.
Display values of "name" and "hint" field in non-editable way while
editing default external account type profile fields.
2022-09-13 11:38:47 -07:00
Yogesh Sirsat c1cf691080 custom_profile_fields: Remove redundant empty val set from edit form. 2022-09-13 11:38:47 -07:00
yogesh sirsat f3578912fa custom_profile_fields: Disable "External account type" select field.
Disable "External account type" select field from External account type
profile field edit form, doing it because this select field is not
editable and it is incorrectly looks like editable.
2022-09-12 14:29:11 -07:00
Yogesh Sirsat aa7fddbc1d custom_profile_fields: Display data of default external type fields.
Display default values of "name" and "hint" field in uneditable way
while creating new default external account type profile fields.
2022-09-12 14:29:11 -07:00
Anders Kaseorg e0b593f67e js: Use .empty() instead of .html("").
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-08-17 16:04:55 -07:00
yogesh sirsat 87ba3c1549 custom_profile_fields: Convert edit profile field form into a modal.
This allows this component to follow existing design patterns, rather
than being its own unusual element with various quirks.

The implementation is approximately the same as before I just migrated
"Edit custom profile field" form into modal, like "Add new custom
profile field" form modal.

Fixes: #21634
2022-08-05 17:26:56 -07:00
yogesh sirsat 5c8fcee0a3 custom_profile_fields: Remove unnecessary field_form objects.
This commit is a preparatory commit of "custom_profile_fields: Edit
custom profile field form into modal."

The object returned by get_profile_field_info, which contained jQuery
objects for the profile-field-row and profile-field-form elements, was
just a source of unnecessary indirection, since none of the functions
consuming it accessed the row.
2022-08-05 17:26:56 -07:00
yogesh sirsat f885535a7c custom_profile_fields: Add form ID to add new custom profile field form.
This makes it easy to support submitting this form when pressing enter
by passing the `form_id` parameter to `dialog_widget.launch()`.
2022-08-05 17:26:56 -07:00
yogesh sirsat 526b55c6fc custom_profile_fields: Convert new profile field form to a modal.
This lets us remove this fairly ugly user interface widget, which was
inconsistent with the rest of the settings UI.

The implementation is approximately the same as before I just migrated
"Add new custom profile field" form into a modal, status update
notifications about these forms will be displayed inside their modal,
and made some little design changes as discussed on CZO.

Fixes part of: #21634
2022-08-05 17:26:56 -07:00
yogesh sirsat c60cdc46e3 custom_profile_fields: Change class from control-group to input-group.
This is a preparatory commit for commit "Edit custom profile
field form into modal."

Above mentioned commit will use class input-group instead of
control-group so here we are already changing it to input-group.
2022-08-05 17:26:56 -07:00
yogesh sirsat d0f5b38f65 custom_profile_fields: Control-group to input-group class correction.
There is no control-group class to hide/show in custom profile fields
list instead there is input-group class, kind of little typo I guess
from this 9e343f1 commit.
2022-08-05 17:26:56 -07:00
Sahil Batra 2b30c3c37c settings_profile_fields: Show confirmation modal when deleting option.
We show a confirmation modal when deleting option of a select-type
field mentioning number of users who are using that option. We also
show the modal if no user has selected that option. We show the modal
only in edit-form and not while creating a new profile field. We do
not show the modal when removing a newly added option during editing
the field.

Fixes #22145.
2022-07-15 16:51:24 -07:00
Sahil Batra 57e0261ff6 settings_profile_fields: Keep option value constant.
Previously, the value for an option of the select type custom
profile field was set as "order - 1". This commit changes it
to remain same even when we reorder the options or delete an
option. When we add a new option, its value is set as 1 more
than largest value already used.

This helps is eliminating various bugs in this subsystem, where
user's choice is changed unexpectedly when reordering or deleting
options.

Discussion -
https://chat.zulip.org/#narrow/stream/378-api-design/topic/custom.20profile.20fields.20option.20deletion.
2022-07-15 16:51:24 -07:00
Anders Kaseorg eb7770565a js: Fix no-jquery/no-sizzle.
The :first and :last selectors were deprecated in jQuery 3.4.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-17 13:10:23 -07:00
Anders Kaseorg f84a2c08d5 js: Prefix jQuery object variable names with $.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-16 12:52:07 -07:00
yogesh sirsat 1a15d60de4 settings: Fix external account profile field initialization order.
In open_edit_form, we had an initialization order bug where we called
set_up_external_account_field_edit_form, which clears the field name
field if the external account is of the "custom" type, after
populating the initial values for edit form.

This resulted in these fields being displayed as empty in the UI for
this field type. Fix the issue by reordering the initialization.

Fixes: #21262.
2022-02-28 16:30:49 -08:00
Anders Kaseorg 544bbd5398 docs: Fix capitalization mistakes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-10 09:57:26 -07:00
aryanshridhar 17133b5b1e template: Move `admin_profile_field_list` template to `settings` folder.
Moved `admin_profile_field_list` template to `/templates/settings/` folder
as earlier, it was inaccurately placed within the `/templates` folder
rather than the `/templates/settings` folder.
Also modified the node tests to reflect the new changes.
2021-04-26 09:37:20 -07:00
tushar912 737dbb3741 custom profile fields: Rename few functions.
Rename few functions referencing the "CHOICE" field to
instead use the new "SELECT" name. This is done so that they
can be reused in "SELECT_MULTIPLE" field.
2021-03-26 11:49:28 -07:00
tushar912 2cf51139cf custom profile fields: Rename "CHOICE" to "SELECT" in frontend.
This requires a small backend change to the label.
2021-03-26 11:49:11 -07:00
Anders Kaseorg 38ffd47b90 js: Convert static/js/page_params.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 10:17:56 -07:00
tushar912 c6d1fbd051 settings: Fix input mouse behaviour in custom profile fields.
Add input to filter in sortablejs config. This prevents drag
and drog from being called on clicking input field. Also
set preventOnFilter to false. This prevents disabling the
default behaviour on the click event.

Fixes #17619
2021-03-15 11:11:47 -07:00
Anders Kaseorg ea9ca6b7d0 js: Use jQuery as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-12 10:08:25 -08:00
Anders Kaseorg 92a46888f0 node_tests: Mock sortablejs to avoid __Rewire__.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-12 10:06:34 -08:00
Steve Howell 8006c29748 node tests: Extract create_sortable for testing. 2021-03-06 11:10:57 -05:00
Anders Kaseorg 099e8fb00e js: Convert static/js/settings_profile_fields.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg ac4e293da5 settings_profile_fields: Use named export from sortablejs.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 09920af211 js: Convert static/js/channel.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 3faae49dc0 js: Convert static/js/loading.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg e16687af83 js: Convert static/js/settings_ui.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg aa650a4c88 js: Escape strings interpolated into CSS selectors with CSS.escape.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-04 11:00:06 -08:00
Anders Kaseorg de791b82b6 eslint: Fix unicorn/no-for-loop.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/no-for-loop.md

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-10-07 16:00:33 -07:00
Anders Kaseorg fb233bd994 eslint: Fix unicorn/prefer-number-properties.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/prefer-number-properties.md

MDN says these were added to Number for modularization of globals.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-10-07 16:00:33 -07:00
Anders Kaseorg d72423ef21 eslint: Replace empty-returns with consistent-return.
Instead of prohibiting ‘return undefined’ (#8669), we require that a
function must return an explicit value always or never.  This prevents
you from forgetting to return a value in some cases.  It will also be
important for TypeScript, which distinguishes between undefined and
void.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-25 15:17:59 -07:00
Anders Kaseorg 9238813135 js: Use destructuring for require statements.
This allows import/order to auto-fix blocks including these
statements.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-23 09:06:07 -04:00
Anders Kaseorg 6ec808b8df js: Add "use strict" directive to CommonJS files.
ES and TypeScript modules are strict by default and don’t need this
directive.  ESLint will remind us to add it to new CommonJS files and
remove it from ES and TypeScript modules.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 22:09:46 -07:00
Anders Kaseorg 59ba7e38c0 settings_profile_fields: Fix sortablejs import.
Commit 114cc1ec25 (#15949) introduced a
subtle bug because sortablejs provides both a CJS module and an ES
module that expose different interfaces to CJS require() under
Webpack.  This difference will disappear when we convert
settings_profile_fields to an ES module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 20:16:26 -07:00
Anders Kaseorg 114cc1ec25 settings_profile_fields: Use SortableJS as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg 498fe285fa js: Access ‘disabled’ as a property, not an attribute.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-22 12:20:23 -07:00
Anders Kaseorg 96dcc0ce6e js: Use ES6 object literal shorthand syntax.
Generated by ESLint.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:42:22 -07:00