Commit Graph

64 Commits

Author SHA1 Message Date
Cynthia Lin
736388b4df user groups: Improve styling of user groups in admin view. 2018-08-13 16:13:49 -07:00
Shubham Padia
1f553a41d0 search: Higlight #searchbox on focus.
Adds box-shadow to `#searchbox` when either `#search_query` or any
of the pills have focus. Uses jquery instead of pure css as the
`:focus` event occurs on `#search_query`, while we want to add
box-shadow to `#searchbox`. This could have been done with
`:focus-within` CSS selector, but it is not supported in IE or Opera.

`#search_query` already had an onfocus/focusout listener, adding
listeners to `#searchbox.pills` for those events wouldn't have worked
as you don't want the focusout event to fire when the focus shifts
from input to pill.

Also adds `focusin`, `focusout` and `css()` to zjquery. `css` is
same as `val`, except it returns an empty object in case of no value
instead of an empty string. I don't think `css()` is valid syntax
in actual jquery.
2018-07-23 11:29:10 -07:00
Steve Howell
eeac8cfa41 zjquery: Show multiple handlers in demo code.
This also makes the error messaging for true
duplicates a bit more specific.
2018-07-18 08:25:15 -04:00
Shubham Dhama
53cd1be294 zjquery: Add clear_all_elements to remove all cached elements.
The reason to add this api is that many times some elements are
already used/cached and then their value interfere/exists in
other tests which gives false results.
2018-07-06 11:30:12 -04:00
Shubham Dhama
98e6b287b5 zjquery: Implement empty function for when there is no argument. 2018-07-03 08:48:49 -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
Shubham Dhama
8852ed588a style: Remove redundant brackets from typeof operator. 2018-06-05 09:22:26 -07:00
Shubham Dhama
c6738889a9 eslint: Add and enable space-unary-ops rule.
Info about rule at https://eslint.org/docs/rules/space-unary-ops.
2018-06-05 00:47:35 +05:30
Steve Howell
fb712027bf buddy list: Fix and simplify up/down navigation.
This introduces a generic class called list_cursor to handle the
main details of navigating the buddy list and wires it into
activity.js.  It replaces some fairly complicated code that
was coupled to stream_list and used lots of jQuery.

The new code interacts with the buddy_list API instead of jQuery
directly.  It also persists the key across redraws, so we don't
lose our place when a focus ping happens or we type more characters.

Note that we no longer cycle to the top when we hit the bottom, or
vice versa.  Cycling can be kind of an anti-feature when you want to
just lay on the arrow keys until they hit the end.

The changes to stream_list.js here do not affect the left sidebar;
they only remove code that was used for the right sidebar.
2018-04-28 11:15:14 -07:00
Steve Howell
58c67d8cba zjquery: Improve errors when handlers aren't set correctly. 2018-04-26 08:42:47 -07:00
Joshua Pan
09469026c6 zjquery: Allow removeClass() to remove multiple classes simultaneously.
removeClass() now splits class_names by spaces to get multiple
class names. Then removes each individual class name.
2018-04-19 14:56:55 -04:00
Steve Howell
6b44cdb286 zjquery: Extract make_event_store().
This pushes some of the most complex code of zjquery into its own
object.
2018-04-17 17:52:19 -07:00
Steve Howell
10d1c2fafa zjquery: Extract make_new_elem().
There was really no reason for this to be a nested function, since
we weren't closing on any variables.  Flatter is better.  Also, it
is plausible that folks will want more control over creating
individual jQuery elements (but still want this helper).
2018-04-17 17:52:19 -07:00
Rohitt Vashishtha
703351288a zjquery: Add replaceWith() and selector.location. 2018-04-13 09:13:50 -07:00
Rohitt Vashishtha
2e7f215f44 zjquery: Add option to silently ignore find() errors. 2018-04-13 09:13:50 -07:00
Steve Howell
f56b4b7ec2 zjquery: Simplify validation for $(...).
We flatten the code a bit by removing a check that type is object,
and we replace it later with a check that type is string.

We also no longer allow document-like objects to be wrapped based
on the location-attribute-is-present hack.  Instead, we want the
tests to just set document to 'document-stub'.
2018-04-12 11:37:01 -07:00
Steve Howell
368b37e198 zjquery: Add a selector attribute to our wrapped elements.
We might as well have this for debugging purposes and to simplify
the code that happens when we double-wrap DOM elements.
2018-04-12 11:37:01 -07:00
Steve Howell
f78947f2ba zjquery: Fix minor typo in comments.
This typo came from s/impl/self/ at some point :)
2018-04-12 11:37:01 -07:00
Steve Howell
174d065b2e zjquery: Add to_$ hook so elements can wrap themselves. 2018-04-12 11:37:01 -07:00
Steve Howell
f505f3de04 zjquery: Support $.fn.foo mechanism.
We can now extend zjquery using the $.fn mechanism.  This isn't
necessarily recommended for test code (since you can just stub
individual objects directly), but some of our real code does this.
2018-04-12 11:37:00 -07:00
Steve Howell
f5e0794d5c zjsquery: Give special treatment to "body" tag.
We don't do things like $('table') much in our code, but $('body')
is in the code.
2018-04-12 11:37:00 -07:00
Steve Howell
c164d07baa zjquery: Enforce only one arg for $(...) function. 2018-04-05 10:46:45 -04:00
Steve Howell
f97fe7842e zjquery: Add support for off(). 2018-03-25 08:28:04 -07:00
Shubham Padia
dd5ce49ce0 settings: Add button to cancel user group auto save on blur.
Clicking the cancel button removes all the changes and the user
group returns back to the original state. Saved button is showed
once the changes are saved on blur.
2018-03-15 17:29:12 -07:00
Steve Howell
2d8c1f6d93 zjquery: Give clear error when handlers are not set. 2018-03-01 06:46:17 -05:00
Robert Hönig
e28943cd9a zjquery: Allow attribute selector '[]'. 2018-01-07 18:49:16 +01:00
Robert Hönig
a7b35f24b9 zjquery: Add support for trigger() with string as argument. 2018-01-07 18:47:55 +01:00
Brock Whittaker
dba09c979c Restructure organization settings and permissions.
This restructures organization settings and permissions to be
more accurately grouped and for the permissions page to not be too
long.

CHANGES:

PROFILE:
    (this was split out)
    organization-profile-admin.handlebars:
        form #1:
            name
            description
            (SUBMIT)
        avatar:
            (UPLOAD)
            (DELETE)

SETTINGS:
    organization-settings-admin.handlebars:
        language (mostly untouched)
        message editing:
            time limit/history/retention
        message feed:
            mandatory-topics
            preview images
            preview websites

PERMISSIONS:
    organization-permissions-admin.handlebars
    (mostly stuff was removed)
    Joining:
        restrict domains
        require invite
    User Identity:
        name changes
        email changes
    Streams/Emoji:
        creating streams:
            waiting period (ADDED)
        adding emojis
    (SUBMIT) for whole panel

The profile group (name, description, avatar) were split into a new
page that did not previously exist, and the permissions was stripped
of message settings (message editing, message feed), but keeping the
"waiting period" input and putting it in the "Streams & custom emoji"
section.

Fixes: #5844.
2017-08-28 17:20:13 -07:00
Steve Howell
359c9aaec8 zjquery: Remove jquery_array().
This commit simplifies how our zjquery objects are constructed.

We used to have a strange array proxy (my fault) that turns out
to be unnecessary.
2017-07-09 08:31:22 -04:00
Steve Howell
7376934a77 zjquery: Add $.create() method.
This commit add $.create(), which allows you to create a
jQuery object that just has a name to identify it, as opposed
to some selector or HTML fragment.  It's useful for things that
are really used as stubs.

This also fixes a bunch of the existing tests to use $.create().

Before this fix, you could actually just do $('some-stub'), but
now we enforce that the input to $() looks like a valid selector
or HTML fragment, and we make some exceptions for things like
window-stub and document-stub.
2017-07-08 10:32:32 -04:00
Steve Howell
90777fd1fa zjquery: Add parents() and set_parents_result(). 2017-07-08 08:49:09 -04:00
Steve Howell
ccd821e29b zjquery: Rename add_child() to set_find_results().
Hopefully this will make it more explicit that zjquery does
not truly simulate DOM, but it instead allows you to dynamically
set what you want the results of $('foo').find(some_selector)
to be.
2017-07-08 08:31:18 -04:00
Steve Howell
70407e080d zjquery: Require explicit set_parent() calls.
Before this commit, we were erroneously setting up parents
as part of add_child() calls, but it's not necessarily the
case that those children are immediate children, and therefore
the first object is not necessarily the immediate parent.
2017-07-08 08:21:27 -04:00
Steve Howell
c91eca291c zjquery: Remove broken code related to remove().
The logic to remove ourself from the parent's children wasn't
correct.
2017-07-08 07:57:02 -04:00
Steve Howell
b3848ed8bd zjquery: Assert only one function gets triggered.
If multiple functions get called by trigger(), it is almost
certainly a sign of overly complex test setup.
2017-07-06 10:27:54 -04:00
Aditya Bansal
9c90a3d1a3 zjquery: Add get_on_handler(). 2017-07-06 08:37:39 -04:00
Aditya Bansal
641b38f79b zjquery: Add get_on_handlers(). 2017-07-06 08:36:38 -04:00
Aditya Bansal
3b30701844 zjquery: Add selector param option to on() function. 2017-07-06 08:29:07 -04:00
Aditya Bansal
1ed499fffc zjquery: Add stop() function. 2017-06-28 07:34:04 -04:00
Aditya Bansal
bd370993ea zjquery: Add fadeTo() function. 2017-06-28 07:34:04 -04:00
Aditya Bansal
fb723f9477 zjquery: Reorder functions in lexographic order. 2017-06-28 07:34:04 -04:00
Yago González
8ae0c90e9f zjquery: Return element in some jQuery methods.
jQuery's behavior in methods that, because of their nature, don't need to
return anything is to return the element itself in the jQuery object form.

Now the zjquery element is returned when one of these methods is called.
2017-06-26 08:38:21 -04:00
Yago González
1343216002 zjquery: Add select function. 2017-06-26 08:38:21 -04:00
Yago González
4b8a52cee0 zjquery: Handle passing elements to $().
There are some cases when the jQuery dollar
function is called with an element as argument.

If such element has already been created using
zjquery, we should simply return it.
2017-06-26 08:38:21 -04:00
Yago González
679325733d zjquery: Add extend method. 2017-06-26 08:38:21 -04:00
Yago González
a9c8efe871 zjquery: Add keydown and keyup functions. 2017-06-26 08:38:21 -04:00
Yago González
ad154da174 zjquery: Add generic event setter/handler. 2017-06-26 08:38:21 -04:00
Joshua Pan
8a6e8906bd zjquery: Add .click() function. 2017-06-20 19:49:23 -04:00
Steve Howell
e0d79acac0 zjquery: Add attr() method. 2017-06-16 14:58:27 -04:00