Commit Graph

4374 Commits

Author SHA1 Message Date
Shubham Dhama 5b18a381fb list_render: Extract sort handler function from data-sort click handler. 2018-06-22 09:21:47 -04:00
Shubham Dhama 92d843add9 list_render: Remove redundant `list_render.delete` method. 2018-06-22 09:21:47 -04:00
Shubham Dhama 2aba7c239f list_render: Make list creation logic as an export in list_render module.
This changes how we create lists i.e.
    from `list_render($container, list, opts)`
        to `list_render.create($container, list, opts)`
2018-06-22 09:21:47 -04:00
Marco Burstein 9643c8ed26 hotkeys: Deactivate `ctrl + shift` hotkeys.
This disables `ctrl + shift + [`, while `ctrl + [` will still trigger
an action.

Also, add a test for ensuring that the `ctrl + shift` combinations fall
through.
2018-06-22 09:10:23 -04:00
Marco Burstein 56f711d5ff hotkeys: Deactivate `cmd-or-ctrl + shift` hotkeys.
This disables `cmd-or-ctrl + shift + k` and `cmd-or-ctrl + shift + s`,
while `cmd-or-ctrl + k` and `cmd-or-ctrl + s` will still trigger
actions.

Also, add tests for ensuring that the `cmd-or-ctrl + shift`
combinations fall through.

Fix #9779.
2018-06-22 09:10:23 -04:00
Shubham Padia 6853530eba search: Add search_pill.js with basic operations.
Adds search_pill.js to the static asset pipeline. The items
for search pill contain 2 keys, display_value and search_string.
Adding all the operator information i.e the operator, operand and
negated fields along with the search_string and description was tried out.
It was dropped because it didn't provide any advantage as one had to
always calculate the search_string and the description from the operator.
2018-06-22 09:05:36 -04:00
Shubham Dhama 42f9ecb841 search: Remove a redundant preventDefault & export is_using_input_method.
Return false is equivalent to preventDefault and stopPropogation.
is_using_input_method is exported for node testing.
2018-06-22 07:58:06 -04:00
Shubham Dhama 35be5a88ac search: Remove redundant re-declaration of variables for search box.
This is just a minor refactor.
2018-06-22 07:58:06 -04:00
Shubham Dhama 053b5a0da6 search: Refactor update_buttons_with_focus.
This just change `attr` to `prop` as it is more preferred.
Also, a minor renaming of variable is done here.
2018-06-22 07:58:06 -04:00
Rhea Parekh d066c11b47 zcommand: Strip the slash in the backend.
The slash in command is stripped in the backend,
rather than in the client to make the client code
cleaner.
This would make client code cleaner in the slash
commands which include parameters.
2018-06-20 16:49:29 -04:00
Shubham Dhama 9b5986d320 search: Fix "Enter to search" while using an input method.
NOTE:   To test this locally I've used Google Chrome input tool.
        This change will not affect users who don't use input tools.

Here is the algorithm used to deal with this case and other important
points:

* Here I've used `compositionend` event which is triggered
as soon as an input tool completes a word or user press "enter"
to get the suggested text. (There was a situation where it is
triggered even when input tool wasn't closed, that is when we
press space, but it also triggers another `compositionstart`
event simultaneously so our logic can't be affected by this.)

* We are using a variable `is_using_input_method` which sets to
`true` when `compositionend` event is triggered.

* Basically our searching is initiated by `keyup` event which
is triggered by the same keypress which triggers `compositionend`
event to get the text, so our main goal is to suppress the searching
triggered by this key pressing.

* Observation shows that `compositionend` is triggered before the
`keyup` and calling of callback `narrow_or_search_for_term`
used by typeahead.
    i.e. chronological order of triggering of this event is
`compositionend` > calling of `narrow_or_search_for_term` > `keyup`.

* So the main logic is to set `is_using_input_method` to `false`
by default and if used the input tool then when we press enter
to get the suggested text we set it to `true` which indicate
further events triggered after it to skip the searching and
finally in `keyup` we set it to default `false` so when pressed
enter again we have it set to false and we have a successful
search.

Fixes: #9396.
2018-06-20 16:32:51 -04:00
Shubham Dhama 9387efc399 scroll_bar: Initialize scroll_bar in ui_init.js.
This will help in making the order of ui modules initialization
more explicit and clear.
2018-06-20 07:38:22 -04:00
Cynthia Lin dcfc2e10b8 help: Fix broken anchor link scrolling in documentation pages.
Whenever a link is clicked, the page link changes, and the content
of the `.markdown .content` node updates, preventing the old
listener to catch any future anchor link clicks. 

We attach the listener to the document instead and only activate
it when the target element is a proper anchor link heading.

Fixes #9767.
2018-06-19 14:19:23 -07:00
Vishnu Ks 3dd9f61851 signup: Show profile details during settings import. 2018-06-19 11:25:23 -07:00
Shubham Dhama 8e032376f9 guest: Restrict guest access to user group creation and updation. 2018-06-19 11:04:14 -07:00
Shubham Dhama 05323e776e user groups: Refactor settings_user_groups.can_edit. 2018-06-19 11:04:14 -07:00
Shubham Dhama acd2528038 transmit: Refactor logic for deferring the socket initialization.
This makes sure that CSRF token is available while initializing
Socket, irrespective of the order of execution of deferred callbacks
after document becomes ready.

This is part of #9416.
2018-06-18 06:51:42 -07:00
Shubham Dhama 6eaa54a876 sockets: Remove redundant defering in `_setup_sockjs_callbacks`.
This deferment is redundant because we are already waiting for document
ready in transmit.js where we initialize this Socket object.
2018-06-18 06:51:42 -07:00
Shubham Dhama e42e3af7a1 settings_org: Refactor 'get_property_value' to be more readable. 2018-06-17 09:28:19 -04:00
Yashashvi Dave 8909cb1d15 custom fields: Allow list of users in user type of custom fields.
Allow user to add more than one user-value in user type of custom
fields.

Tweaked by tabbott to improve the models.py code and type annotations.
2018-06-16 09:37:49 -07:00
Jack Zhang ac76935f25 integrations: Hide page content until all data has loaded.
Set the initial visibility of the page content to hidden via
the stylesheet, and allow any data fetching and rendering to
complete before making content visible.

Adjust the conditional logic within `render` to first check for
the case in which a user goes to a doc link, the case in which
we asynchronously fetch data prior making content visible.

Fixes #9577.
2018-06-16 08:50:16 -07:00
Shubham Dhama 417f01386d bots: Hide UI for adding new bots for guest users. 2018-06-16 06:33:14 -07:00
Shubham Dhama 603139500a settings_bots: Extract logic for ability to create bots.
This is a minor refactor/deduplication and renaming of
'admin_only_bot_creation' to 'can_create_new_bots'
2018-06-16 06:33:14 -07:00
Shubham Dhama d40c2bb166 emoji: Make uploading new realm emoji inaccessible for guest users. 2018-06-16 06:33:14 -07:00
Shubham Dhama 596ce5b60f invite: Make inviting new users inaccessible for guest users. 2018-06-16 06:33:13 -07:00
Shubham Padia 5f9cdf9b08 popovers: Enable keyboard navigation on user profile menu.
Fixes #9318.
Calls popovers.user_info_popover_handle_keyboard in process_hotkey.js.
Makes popovers.message_info_popped public.
2018-06-13 05:57:14 -04:00
Shubham Padia 655175c9f7 hotkey: Rename actions_dropdown_hotkeys to menu_dropdown_hotkeys.
actions_dropdown_hotkeys are also to be used for user profile menu
keyboard navigation, so renaming it to a more generic name.
2018-06-13 05:57:14 -04:00
Shubham Padia 5481dd11bc popovers: Focus on first menu item when user profile opened by hotkey.
Adds focus_user_info_popover_item to popovers.js. When menus are
opened by hotkeys, first menu item is focused to enable further
keyboard navigation.
2018-06-13 05:57:14 -04:00
Shubham Padia 4516a72676 popovers: Add get_user_info_popover_items.
Gets menu items for the user profile popover. To be used to add
keyboard navigation to user_profile_menu.
2018-06-13 05:57:14 -04:00
Shubham Padia 68d58b92cc popovers: Refactor functions using get_action_menu_menu_items.
actions_menu_handle_keyboard now only gets the action menu items
and passes them to the newly added popover_items_handle_keyboard.
popover_items_handle_keyboard takes the key and menu items as its
parameters. The function can be used when handling keyboard input
like user profile popover. Similar refactor has been carried out in
focus_first_action_popover_item. This refactor is a part of adding
the missing support of keyboard navigation to user profile popover.
2018-06-13 05:57:14 -04:00
Shubham Dhama d060101cfa message: Fix opening of compose box on mobile webapp. 2018-06-12 13:31:42 -04:00
Steve Howell 31a8eca4d0 refactor: Extract do_populate_profile_fields.
This makes it easier to write tests (since you
can't set meta.loaded to true directly) and
separates out the concern of short-circuiting
updates.
2018-06-12 10:15:18 -04:00
Shubham Dhama 80a2d5bc59 eslint: Enable `conditionalAssign` config of no-trailing-spaces rule. 2018-06-11 07:51:24 -04:00
Shubham Dhama dcb6254a4e eslint: Enable `no-extra-parens` rule.
Following sub-configuration is disabled:
                "nestedBinaryExpressions": false,
2018-06-11 07:51:24 -04:00
Yashashvi Dave 40590bb6b9 custom fields: Fix exception in rendering custom profile field template.
The function `settings_account.add_custom_profile_fields_to_settings`
called twice, which resulted in two templates objects being
rendered.

The function also didn't check whether settings overlay was open or
not when processing new events, and thus would throw an "undefined"
error if a custom profile field was editing while the overlay was not
open.

Fixes #9668.
2018-06-10 13:50:38 -07:00
Shubham Dhama 51ae82fbcf left-sidebar: Fix opening of compose box on narrowing using hotkeys.
Explaining the problem a bit: When we narrow to a stream/private message
using `q+Enter`/`w+Enter` compose box opens which isn't desirable here.
The bug here was the propagation of event after getting handled in
`keydown_util.handle` to `hotkeys.process_enter_key`.

Fixes: #9679.
2018-06-09 12:53:24 -04:00
Felix Yan 974f015837 js: Fix a typo in search.js. 2018-06-08 12:14:55 -07:00
Akash Nimare 64c668b881 help: Update default article heading on help pages.
We should only open the default article heading which is "Guides",
if the user is on the index page i.e. /help/. For non index pages
we don't need to open this heading.
2018-06-07 11:21:12 -07:00
Akash Nimare 4b3309f3f0 help: Close other article headings on click.
This commit adds a minor improvment in clicking
the left sidebar behaviour. So if you click on
an article heading then other opened headings will
be closed automatically. This makes the toggle
experience better.
2018-06-07 11:20:10 -07:00
Akash Nimare 733b1a14bb help: Highlight article heading in left-sidebar.
This fixes a bug where we don't toggle the article heading
if you open it direclty.

Fixes: #9700.
2018-06-07 10:51:59 -07:00
Yashashvi Dave f7f039e772 custom fields: Add endpoint to delete value of custom profile data.
Add delete endpoint at `users/me/profile_data` to delete value of
custom profile data.

Fixes #9669
2018-06-07 08:35:04 -07:00
Yashashvi Dave b9b923aab6 user profile: Display local date format in user profile.
Display local date format in date type of inputs in user profile
popover, i.e. joined_date, date-type-custom-field.
2018-06-06 15:06:26 -07:00
Anupam Dagar 8939767452 message view: Add loading indicator to bankruptcy modal.
Tweaked by tabbott to remove the old logic, which wasn't be displayed
and regardless didn't look as nice.

Fixes: #9629.
2018-06-06 15:06:05 -07:00
Steve Howell 3065bf0c58 settings: Make the enter key go to panels.
This is less than perfect, but for most settings hitting
the enter key will now take you to the first element in
the right panel.

The two exceptions are below.  They have checkboxes with
kind of strange markup:

    Notifications
    Authentication methods
2018-06-06 09:42:33 -07:00
Steve Howell 8af04ac3cd toggler: Stop supporting payload target.
We no longer need the payload target for our callbacks.
2018-06-06 09:42:33 -07:00
Steve Howell e7e38253ec settings: Add better keyboard navigation for panel menus.
You can now use all four arrow keys intuitively in the
Settings/Organization panel menus.
2018-06-06 09:42:33 -07:00
Steve Howell a5f0163a67 Keep track of which settings sections are open.
If you toggle between Settings and Organization now, it
will remember where you were the last time (not counting
reload).  Likewise if you go in and out of settings.

The old code always put you in the first section, which I
think was an accident of implementation.  Of course, we'll
continue to default to the first row if you haven't gone
anywhere else.
2018-06-06 09:42:33 -07:00
Steve Howell beecee4b8c Move panel click handler into settings_panel_menu.js.
This is mostly a code move, but because things are more
modular now, we don't need the two conditionals to find
out what kind of panel menu we're inside of, and our
selectors are less brittle.
2018-06-06 09:42:33 -07:00
Steve Howell 8ce8e93645 refactor: Extract settings_panel_menu.js. 2018-06-06 09:42:33 -07:00
Steve Howell db514002ec settings: Use separate lists for the two sidebar panels.
The list with the options for normal settings now has
the class normal-settings-list.

The list with the options for org settings now has
the class org-settings-list.

The new markup helps us avoid code like this:

    $(".settings-list li:not(.admin)")

We also have funny hacks in our key handlers related
to the old combined-list approach, which we can
eventually eliminate.
2018-06-06 09:42:33 -07:00