Commit Graph

47 Commits

Author SHA1 Message Date
Moritz Neeb 9866805937 docs: fix a typo in hashchange.js 2017-03-23 15:16:02 -07:00
Tim Abbott 2a5269baa9 docs: Document the frontend hashchange system. 2017-03-22 15:21:36 -07:00
Steve Howell d026344b37 Extract js/ui_util.js. 2017-03-19 11:05:45 -07:00
Rishi Gupta 19d8d16126 js dependencies: Split hash_util.js from hashchange.js. 2017-03-18 20:40:34 -07:00
Steve Howell 27f37e6378 Add hash_util.encodeHashComponent() shim. 2017-03-18 15:52:50 -07:00
Brock Whittaker 3bc2ed6dc9 Switch "invite users" to new component overlay.
Fixes #4036.
2017-03-15 12:29:09 -07:00
Brock Whittaker b0e5aeb313 Consolidate JavaScript modal closing in modals.js.
This consolidates all actions to close modals into modals.js and
triggers the correct cleaning/collapsing function dependent on what the
data-overlay attribute is labeled as.

It also ensures these all have an e.stopPropagation().

Fixes #4029.
2017-03-15 12:27:44 -07:00
Brock Whittaker 2e30cef8e9 Change "hashchange.exit_settings" to "hashchange.exit_modal".
Change the name of the hashignore and replace mechanism from
exit_settings to exit_modals since it is now used for more than just
the settings.
2017-03-15 12:17:27 -07:00
Tim Abbott 3b59e6c3cc subs: Rename /#subscriptions to /#streams.
Fixes #3653.
2017-03-08 16:57:58 -08:00
Brock Whittaker 461066cab9 Add deep linking to #subscriptions/new and #subscriptions/:stream_id.
This mechanism allows for a user to deep link to a particular
subscription or the form for creating a new subscription.
2017-02-23 15:34:30 -08:00
Sampriti Panda 1929cc5190 Implement persistent drafts functionality
* Created a drafts modal to display/restore/delete drafts
* Created a Draft model to support storing draft data in localstorage
* Removed existing restore-draft functionality
* Added casper and node tests for drafts functionality

Fixes #1717.
2017-02-23 02:58:23 -08:00
Brock Whittaker 1143ed7219 redesign: Change /#settings and /#administration to an overlay.
This also adds a box-shadow to the #deactivate_self_modal so that it
looks similar to the old backdrop.
2017-02-09 23:35:10 -08:00
brockwhittaker 894f0b5bf0 Fix hashchange closing #subscriptions on IE.
This fixes an issue where Array.prototype.split is called on an
undefined instance due to the EventTarget.oldURL property not being
recorded in IE. We fix this by recording it ourselves.
2017-02-02 11:40:26 -08:00
Steve Howell cd6115c24d Make nicer slugs for "sender" narrows.
Slugs are now like our "pm-with" slugs:

    narrow/sender/3-cordelia
2017-01-19 14:54:50 -08:00
Brock Whittaker eccca8fc61 Unify subs modal closing with subs.close().
The new subs.close() function should unify all closing events of the
subscriptions overlay. The function also now tracks whether the
subscription overlay is in a closed or open state.
2017-01-19 14:23:25 -08:00
Steve Howell d757f840dd Make nicer slugs for "pm-with" narrows.
The slugs for PM-with narrows now have user ids in them, so they
are more resilient to email changes, and they have less escaping
characters and are generally prettier.

Examples:

    narrow/pm-with/3-cordelia
    narrow/pm-with/3,5-group

The part of the URL that is actionable is the comma-delimited
list of one or more userids.

When we decode the slugs, we only use the part before the dash; the
stuff after the dash is just for humans.  If we don't see a number
before the dash, we fall back to the old decoding (which should only
matter during a transition period where folks may have old links).

For group PMS, we always say "group" after the dash. For single PMs,
we use the person's email userid, since it's usually fairly concise
and not noisy for a URL.  We may tinker with this later.

Basically, the heart of this change is these two new methods:

    people.emails_to_slug
    people.slug_to_emails

And then we unify the encode codepath as follows:

    narrow.pm_with_uri ->
    hashchange.operators_to_hash ->
    hashchange.encode_operand ->
    people.emails_to_slug

The decode path didn't really require much modication in this commit,
other than to have hashchange.decode_operand call people.slug_to_emails
for the pm-with case.
2017-01-17 15:13:49 -08:00
Steve Howell 3ee733eb51 Extract encode_operand/decode_operand in hashchange.js.
These are just one-liners for now, but they will set us up
to do different encodings for different narrows.
2017-01-11 18:31:17 -08:00
Steve Howell 030c6649ae tests: Improve hashchange coverage for operators.
Test round tripping of operators in hashchange.js.
2017-01-11 18:31:17 -08:00
Tim Abbott 998dff9e50 lint: Add dangling commas in JavaScript objects. 2017-01-11 15:23:42 -08:00
Brock Whittaker 660144a79d Blur the active element on settings/streams modal exit.
This blurs any focused element so that you can’t accidentally enter
into anything on a hidden modal.
2016-12-14 15:37:43 -08:00
Brock Whittaker 1886f0a015 redesign: Convert subscriptions page to overlay.
This is a major change to the /#subscriptions page, converting it to
by a side-by-side list of streams and their settings in an overlay.
There are no new features added/removed, but it's a huge changeset,
because it replaces the old navigation logic and moves the stream
creation modal to appear in the right side of this overlay.
2016-12-09 11:08:08 -08:00
lonerz dc6849952b eslint: change space-before-function-paren from warning to error.
Also fix violations.
2016-12-05 09:50:37 -08:00
AZtheAsian ed0bc831be eslint: change one-var from warning to error and fix violations 2016-12-02 11:25:16 -07:00
Brock Whittaker 1def0b6701 hashchange: Add hashchange ignore mechanism for overlays.
This will make it possible to do hash changes in soon-to-be-overlay
pages like the /#subscriptions and /#settings page.
2016-11-15 11:53:38 -08:00
Tim Abbott 28cefc4996 hashchange: Fix buggy arguments to hashchanged causing scrolltop bug.
Because jQuery passes the actual hashchange event to an onhashchange
handler, the `if reload` checks in the `hashchanged` function were
always returning true, resulting in the wrong logic being used for
computing where to send the user in the event that they edited the
hash in the browser to change their narrow.
2016-10-23 20:07:12 -07:00
Tim Abbott cb18ef07a7 Rename hashchange.zulip event to avoid jquery 1.8 interaction. 2016-07-08 11:09:09 -07:00
Steve Howell 405c3d7626 Created floating_recipient_bar.js (with code from ui.js).
(imported from commit 2b6631938b0fc8e39c14aacd92f9f1670b68b199)
2014-03-14 20:48:58 -04:00
Steve Howell 7fce920522 Move favicon-related functions to favicon.js
util.reset_favicon -> favicon.reset
util.set_favicon -> favicon.set

(imported from commit 250848ec5dc7ac58649197c8cc4b7b4e7b19f25c)
2014-03-14 20:48:55 -04:00
Jason Michalski 16df239f39 Use the first unread from server on reload
When reloading the page we want to narrow to the location that is
restored from the query parameters. This is only done if we ask narrow
to use the first unread message from the server.

(imported from commit b585ef51cbb85788b24d90d831b42c45fd188569)
2014-03-03 18:17:15 -05:00
Steve Howell 5631e7e624 Remove transitional defensive code in hashchange.js
(imported from commit b02de9a51426339f3fdbe74fb61b89f5dd4ce8d4)
2014-02-19 16:20:29 -05:00
Steve Howell 2fb7c0059d Support negated searches on staging.
Behind a feature flag you can now do searches like this:

    -pm-with:othello@example.com is:private

The "-" in front of "pm-with" tells us to exclude messages
with Othello from our search.  We support "-" in front of
all operators, although the behavior for "-search:" and
and "-near:" doesn't really change in this commit.

Note that the filtering out of "negated" predicates only
happens on the client side in this commit.  On the server
side we ignore negated predicates and send back a superset
of the results.

(imported from commit 6cdeaf32f2d493fbbb838630f0da3da880b1ca18)
2014-02-13 14:14:24 -05:00
Jason Michalski 044e3ced4f Fix how the hash URL is build for IE support
IE sometimes returns the pathname without a leading slash. Also
location.origin is not supported and must be build manually.

(imported from commit fb64478aeaac0f17d31021b7c370ff56781b48d1)
2014-02-13 12:39:24 -05:00
Jason Michalski dd345bdece Make sure the hash we change to always starts with a #
(imported from commit b27d4a3b9b89b2576d4b1339d55d54ba338a576d)
2014-02-12 16:30:07 -05:00
Tim Abbott 19dcc3f385 Disable centering narrows around first unread message on server.
(imported from commit 11b17c2874370d63528e2c9e978eb605da8005e4)
2014-02-12 15:34:33 -05:00
Jason Michalski bd9cccffce Use pushState where supported to change the URL hash
This this removed one forced relayout of the page on unnarrow. This
saves about 100ms for me.

(imported from commit 0755f425abbe3d99b8a99765549a5bbf3c620b9a)
2014-02-12 15:19:10 -05:00
Tim Abbott fcb8c106b1 Fix saving of pointer on server-initiated reload when narrowed.
Previously, we saved the current_msg_list selected id and then
restored it as the home_msg_list selected id, which could result in
the home view loading to the wrong place.

This takes some already bad code and makes it even more in need of
refactoring, but it does fix a pressing bug.  We should definitely
refactor both:

* the top of narrow.js
* the save/restore code in reload.js

after this, though.

(imported from commit bb2040219e4f545ba90bb04a696996cec2831484)
2014-02-12 14:40:38 -05:00
Tim Abbott f4c514fbf3 hashchange: Fix indentation on main switch statement.
(imported from commit 1420cc2513e1bf6b80c8e52a6c0d3d66e82a5a1d)
2014-02-12 14:40:38 -05:00
Steve Howell c87b77e52e Report errors due to legacy tuples in hashchange.operators_to_hash.
(imported from commit f639ba52f85bf103afdd26dc4f279e1f03570119)
2014-02-11 11:45:44 -05:00
Steve Howell 9c48ba43fb Do not return terms as tuples in hashchange.parse_narrow.
(imported from commit ffc4acacdd220de57e0179c9dc8272e6b5c33457)
2014-02-04 13:16:34 -05:00
Steve Howell 7fb7950f70 Support non-tuple operators in hashchange.operators_to_hash().
(imported from commit e002293c586d4ef754612feee2b7f33215cf305f)
2014-02-04 13:16:28 -05:00
Tim Abbott f26af47fb6 Center on-page-load narrows on first unread message.
This implementation is somewhat hackish in large part because I think
we're going to be wanting to redo the get_old_messages API somewhat
soon, and this may naturally become a lot cleaner as a result, but
this isn't a lot of code and fixes #2235 part (A) and substantially
mitigates #1510.

(imported from commit 47a2160a44befa9d83190c5cc95b90e92cc5b4cc)
2014-02-03 13:32:02 -05:00
Jason Michalski bf57839e85 Remove scrollTop workaround for hash changes
Now that we are not scrolling the document we can remove the workaround
to prevent browsers from scrolling on hash changes.

(imported from commit 67fdaa4980d4d54d80ca9c259bbee567b8eeb917)
2014-01-30 01:48:15 -05:00
Steve Howell c53845a69c Add unit tests for stream_list.
(imported from commit 1d04a2e6115f29b7949466260ec2ba3126b882e6)
2013-11-27 15:09:20 -05:00
Luke Faraone ecc42bc9f8 Add administrative panel to allow for user deactivations etc.
We now show a list of users and allow you to deactivate a user using the
same process as `python manage.py deactivate_user`.

We add a new menu item accessible from the gear icon which will eventually
have much more than just this, but we have a good start here.

Here we also add a property to UserProfile which determines whether you're
eligible to access the administration panel, and then have code which shows
the menu option if so.

This introduces a new JS file, admin.js.

(imported from commit 52296fdedb46b4f32d541df43022ffccfb277297)
2013-08-13 14:20:18 -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
Tim Abbott bc4d7c687d Rename our custom JS events to use Zulip, not Zephyr.
(imported from commit 61ac456d394a6dbc14f3e9183a53313990db5059)
2013-07-29 12:11:26 -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