Commit Graph

26 Commits

Author SHA1 Message Date
Cory Lynch d32e89aae4 jQuery: Remove broken use of "removeAttr".
This function no longer sets properties to false, so the supported
way of doing this is to instead use prop(foo, false). Some tests
had to be fixed to accommodate this.
2017-07-24 10:54:47 -07:00
Steve Howell 8eb86335b9 Extract narrow_state.js.
Despite the length of this commit, it is a very straightforward
moving of code from narrow.js -> narrow_state.js, and then
everything else is just s/narrow.foo()/narrow_state.foo()/
(with a few tiny cleanups to remove some code duplication
in certain callers).

The only new functions are simple setter/getters that
encapsulate the current_filter variable:

    narrow_state.reset_current_filter()
    narrow_state.set_current_filter()
    narrow_state.get_current_filter()

We removed narrow.predicate() as part of this, since it was dead
code.

Also, we removed the shim for narrow_state.set_compose_defaults(),
and since that was the last shim, we removed shim.js from the app.
2017-04-25 09:57:32 -07:00
Maxim Averin 08690132fe Decrease maximum number of search suggestions.
This fixes an issue with the menu going below the bottom of screen
with non-tiny windows, and it was rare that anyone benefitted from the
extra suggestions.

Fixes: #4133.
2017-04-04 13:02:10 -07:00
Steve Howell d026344b37 Extract js/ui_util.js. 2017-03-19 11:05:45 -07:00
Raghav Jajodia c3dbce810e right-sidebar: Added clear-search button on user-list searchbar.
A clear-search option to clear the user-list searchbox has been added.
This feature was present in the main searchbar but absent elsewhere.
Fix a part of #3716.
2017-03-04 20:30:58 -08:00
Tim Abbott 998dff9e50 lint: Add dangling commas in JavaScript objects. 2017-01-11 15:23:42 -08:00
Rafid Aslam 45f39be37f lint: Fix many no-unused-vars eslint rule violations.
These have been carefully audited by tabbott to ensure they are
unlikely to cause regressions.
2016-12-14 21:34:51 -08:00
Zev Benjamin fa097a1201 Remove jquery.highlight
The one call we were making to it was actually unnecessary since highlighting is
no longer done client-side.

(imported from commit 7644a5961ca48cd57f4b65c6f698083677e0a130)
2014-01-15 16:07:20 -05:00
acrefoot 0d08acaa1b Transition from tables to divs for the message list.
This breaks our casperjs tests.

(imported from commit c63181c73a24eed4a80bfa56966d1f0871c5edb2)
2013-12-19 18:28:11 -05:00
Kevin Mehall e82f11ed46 Fix a JS error introduced by the debug logging.
Narrow.activate was called without an options object in one
obscure location. I'm not sure how it's actually triggered,
since all searches seem to go through the typeahead path with
the "Search for x" option, but someone managed to do it.

(imported from commit 5e0e1bbe7570e5f6a654949547dc164e01125efa)
2013-11-05 15:07:24 -05:00
Steve Howell c4d598b36e Move parse/unparse from narrow to Filter.
I'm trying to move well-isolated methods out of narrow.js, so that
narrow.js is more strongly focused on UI/ajax interactions and
big, heavy lifting stuff.  The logical home for parse/unparse
seemed to be Filter, and they brought along two private methods
with them.  The big code moves involved trivial follow ups
like s/exports/Filter/.

(imported from commit ace0fe5aa1c7abce0334d079ba9eb8d9a57bd10f)
2013-08-22 14:53:00 -04:00
Kevin Mehall f944a8ed0e [third] Don't move typeahead popups when the body scrolls.
Trac #1479

All our typeaheads use this, but I made it an option that must be enabled
explicitly since it is not default bootstrap behavior.

(imported from commit 97852dc407d1f6dbe46b5fdd2c56d3ed8c6718d2)
2013-08-21 16:29:12 -04:00
Steve Howell 5590eb21c0 Removed match_on_visible_text() in search.js.
It appears to have been unused for a while.

(imported from commit 04a0de9f60484da660a557ad2b9953c00b91c608)
2013-08-02 17:28:04 -04:00
Steve Howell a1531b4247 Remove dead vars in search.js
(imported from commit 7fb2fa835332bb909edf173b5f487be9bb592ff3)
2013-08-02 17:28:03 -04:00
Steve Howell b33858dd70 Created search_suggestion.js.
Moved 400+ lines out of search.js into search_suggestion.js.  This
leaves search.js primarily responsible for lots of little DOM
interactions, whereas search_suggestion is more about data.

(imported from commit 53d08b29367c0172e483064f213538d45098279e)
2013-08-02 17:28:03 -04:00
Steve Howell 95102dc1bd Refactor search_suggestions.js.
1. Change code comment in search.get_suggestion.

2. Remove side effects from search.get_suggestions.

The function get_suggestions() was updating a module-scoped variable
called search_object, but now it returns a dictionary to its caller.

3. Greatly reduce the scope of the search_object var in search.js.

I also clarified the comment around it a bit. We could squeeze
the scope of search_object even further by using a function wrapper, but
this is a big enough win for now.

(imported from commit 4b633dd30ab45d24b85ea1d10df27df5aaa0c959)
2013-08-02 17:28:03 -04:00
Steve Howell cd57a7d433 Simplify search.narrow_or_search_for_term.
For legacy reasons this function used to have convert item to
search_string via the search_object hash, because we used to
have an overly convoluted data model.  The mid-July-2013
refactoring on search.js made the data model simple, and this
little bit of cleanup follows up on that.

(imported from commit aeea629862e4307897f24eaa5fc364f2b12a7c52)
2013-08-02 17:28:03 -04:00
Tim Abbott d6acd8fce9 Add support for narrowing to a single message ID.
This is mostly useful for sending someone a link to a single Humbug
message.

(imported from commit b0994a2bf503c84690b13ce89bbcf5bab829bf0c)
2013-07-31 14:59:05 -04:00
Tim Abbott ed6f5ac470 Fix time travel by adding new near: operator.
(imported from commit 727a68016090164b586cbe59e692676a00e8cd3a)
2013-07-31 14:59:01 -04:00
Scott Feeney 8703134a23 Replace $.each with _.each
In a few cases the $.each was doing something imperatively that was
terser and easier to understand by using a different Underscore method,
so a few of these I rewrote.

Some code was using the fact that jQuery sets `this` in the callback to
be the item; I rewrote those to use an explicit parameter.

Some code was using $(some selector).each(callback). I converted these
to _.each($(some selector), callback).

One function, ui.process_condensing, was written to be a jQuery $.each
callback despite being in a totally different module from code using it.
I noticed this and updated the function's args.

(imported from commit bf5922a35f257c168cc09ec1d077415d6ef19a03)
2013-07-30 12:12:58 -04:00
Scott Feeney 375b1f9eb3 Replace $.map with _.map
(imported from commit 97c7a6612d8d56d19f8650db0ea8906afc0f20ef)
2013-07-30 12:09:18 -04:00
Scott Feeney 88952fb2b1 Replace $.grep with _.filter
(imported from commit 3a8830f697551a91f94f06b37d01a3687d8c583d)
2013-07-30 12:06:22 -04:00
Steve Howell 6cf5b64b3c Update module.exports for various modules.
(This makes them play nice with node-style unit tests.)

(imported from commit 44fa97c9d38d0b7e82366b49db1425508b6aed67)
2013-07-30 08:54:23 -04:00
Steve Howell f11cc9e6a2 Extract search.get_suggestions().
(This makes testing a bit easier, plus it dedents some code.)

(imported from commit 80532990608cc51ca55d3354bd300734afd7942e)
2013-07-30 08:54:22 -04:00
Steve Howell 546ae1023c Remove smartSpaceBar option from typeahead and search.
The option caused some race conditions on Firefox, and it is
really made moot by the naturalSearch option anyway.

(imported from commit dc7080c905ced9b2f4ad4275d82549acf09a59f7)
2013-07-29 16:42:14 -04:00
Tim Abbott 3bba0cc927 Move zephyr/static to just static.
It's not really a part of the server (aka the rest of zephyr/).

(imported from commit 27f6b6b064938ad927075a68d873e4b68710d279)
2013-07-29 12:11:26 -04:00