Commit Graph

88 Commits

Author SHA1 Message Date
Keegan McAllister fd7a7aaff4 Javascript: Use !== and === instead of != and ==
!= and == will perform type coercions, which can hide bugs.

(imported from commit 42d3d990a659b62e196f3755c176f83f80c9e319)
2012-09-07 15:07:43 -04:00
Keegan McAllister 1211995d2e Fix indentation
(imported from commit 8f4880ceaa2e84fa842ba195ebe40800fc168eab)
2012-09-07 15:07:38 -04:00
Keegan McAllister 7659937586 Inline a global constant which is now only used in one place
(imported from commit 2c288202f5c46ff62f6044cd23f092e4175d498a)
2012-09-06 17:01:19 -04:00
Keegan McAllister 115334c82a Don't bracket $.get with $.ajaxSetup
Instead, use the more general $.ajax which can take these options directly.

(imported from commit bb915e7d25cb6ac675d098903f7e7b57bde5006e)
2012-09-06 15:48:15 -04:00
Keegan McAllister 474f08198b Send zephyr template inline with index.html using django-jstemplate
(imported from commit 58cc8a50d463548aa283658dbe0aae366ecab39f)
2012-09-06 15:48:15 -04:00
Keegan McAllister fce5643d15 Handle Zephyr body clicks like the other clickable elements
(imported from commit 97da4b22aea4e23dd0227b0179481cb3b5f7a65e)
2012-09-06 15:48:15 -04:00
Keegan McAllister 6f269051d1 Partially consolidate the code which knows that zephyrs are <tr>s
(imported from commit ca2a208af9f1d3cc8a3f3980f55a5c008d28147a)
2012-09-06 15:48:15 -04:00
Keegan McAllister 689ab1efd6 Misc stylistic consistency
(imported from commit 624a07f50544d96f9e3c3b417b00369641bd3ae1)
2012-09-06 15:48:15 -04:00
Keegan McAllister 59ab88f886 Rename current_view -> apply_view
And related cleanups.

(imported from commit 4b1a7e7ef19b17c0887e2864f7cc2121eeda361e)
2012-09-06 15:48:15 -04:00
Keegan McAllister 1fa40e515c Style fixes
(imported from commit 311600ad8627d7060f235f59852d77f73a951e81)
2012-09-06 15:48:15 -04:00
Keegan McAllister 5e5b5986af Don't pass the global selected_zephyr_id through the narrow functions
(imported from commit a19232052913f45a6f8d3c08dd8761a6a2b5ec99)
2012-09-06 15:48:15 -04:00
Keegan McAllister a9f45e6e0e Have select_zephyr ensure that we point at a visible zephyr
(imported from commit 91e485742a040cf6c3454d1f55993a6c77a8ca09)
2012-09-06 15:48:15 -04:00
Keegan McAllister 74c97e7d59 Remove duplication between do_narrow and select_zephyr
(imported from commit 84c3e5a0d5682fd8790bd6e277e05e54a47d9aac)
2012-09-06 15:48:15 -04:00
Keegan McAllister d78e1f1bcb Remember the selected zephyr in a Javascript variable rather than querying the DOM
And related cleanups.

(imported from commit aa64980b4e66a64e92735c736159a8e2f717ea09)
2012-09-06 15:48:15 -04:00
Keegan McAllister 03d2a087a7 Organize global variables a bit
(imported from commit d3ad323bad4cda98e55a54ed3c9aec81ccd4008b)
2012-09-06 15:48:15 -04:00
Keegan McAllister 84e618a902 Use 'var' at top level consistently.
This has no effect but is stylistically consistent.

(imported from commit 71d7f615ea140195cc5081fb331677bc5d856fed)
2012-09-06 15:48:15 -04:00
Luke Faraone 3d1e956069 Don't check for class existence if we're not sending to a class.
(imported from commit 832de3f899d90ee727cebeede061de6a409b7845)
2012-09-06 15:19:56 -04:00
Luke Faraone f6b481546f Offer to subscribe / create classes if user zwrites to a non-subbed class
Here we check if a class exists. If not, we prompt the user to create, sub,
and send his message to the class. If the class exists but we're not subbed
we prompt the user to sub.

This commit also added a decorator to views.py and refactored out some
redundant code.

(imported from commit 7234ef6c080f2a6de6ff0922635dddd90032f7fe)
2012-09-06 14:33:55 -04:00
Jessica McKellar cede8e59fb Return a 400 and error message instead of 500ing on a personal to an invalid user.
(imported from commit b8cdf342f2919aa0dbd2e30764c7662b6756aa57)
2012-09-05 18:01:06 -04:00
Keegan McAllister 0788f2efe6 get_updates_longpoll: Retry indefinitely, with exponential backoff
The client still won't recognize when it's reconnected, if there is no traffic.
Probably we should have the server send periodic heartbeat messages to the
clients, and make the clients look for them.

(imported from commit 4dab3ddf20bf3c48a65b9395c1e24b635b70aa81)
2012-09-05 16:37:20 -04:00
Keegan McAllister c3aaf54468 get_updates_longpoll: Timeout and retry
We're currently proxying through Apache, which will eventually drop an idle
connection to the app server.  Before that happens, drop it on the client and
retry.  This may also help with flaky Internet connections.  This timeout isn't
really an error condition and is naturally rate-limited, so we retry
indefinitely.

(imported from commit 45fbf812af63ed331fe046d85c64c97c1ec57611)
2012-09-05 16:37:10 -04:00
Keegan McAllister 53690d757f Avoid infinite tail recursion in get_updates_longpoll
Javascript doesn't guarantee tail-call optimization.  Also we should yield
control back to the browser in case it needs to catch up on rendering.

(imported from commit 1c35c0c2c39f13311b98bfb6221a1bac1fb22de8)
2012-09-05 14:06:19 -04:00
Keegan McAllister 1f522eddac Move zephyr rendering inside longpoll success callback
(imported from commit f7c2bbb0a31b339892a033e4192e44cb53b0d62c)
2012-09-05 14:06:08 -04:00
Keegan McAllister 162cb075b7 DEBUG: report longpoll events in JS console
(imported from commit f82edf2fcec66ec119319a691281726a16a46b31)
2012-09-05 14:00:56 -04:00
Tim Abbott 8eb778dc32 Fix display of which people we're showing personals with.
(imported from commit 4e2f2554c9af4b176dcbbe6300b72c2ce69bc8bd)
2012-09-05 11:48:35 -04:00
Keegan McAllister 5ac4b4345e Point at the first zephyr if the initial pointer is invalid
(imported from commit 7661a7d23f1d161815f2a22048cd23ede76e1758)
2012-09-05 11:24:29 -04:00
Keegan McAllister 7cb3c05b40 Cleanup / local var in hotkeys
(imported from commit 8df3d84495d0d50b0987037dceb8b16023866119)
2012-09-05 11:24:28 -04:00
Keegan McAllister 49704b84f3 Clean up select_zephyr
Eliminate some global variables, and other style fixes.

(imported from commit 95dfbaa024d709f5b98238afcf904f3e92c8a260)
2012-09-05 11:24:28 -04:00
Tim Abbott 08b55de0af Add support for replying to huddle messages.
(imported from commit 21c760838fa87bf524ff178eab6473dfa3c6921c)
2012-09-05 11:19:31 -04:00
Tim Abbott d13e7d5c2a Clean up prepare_personal function.
(imported from commit 497ff1ff2162eba879728755cf37e6317530a641)
2012-09-05 11:19:31 -04:00
Tim Abbott 6e427d4aa1 Remove trailing whitespace in zephyr.js.
(imported from commit d003d9c337239e90f6dbda16f6624c42909a88b7)
2012-09-05 11:19:31 -04:00
Jessica McKellar 2694183a9d Make clicking on a personals user narrow to the conversation with that user.
Previously, clicking would narrow to all personals. The gp hotkey
combo still does that -- we'll need to think about the UI for making
both types of narrowing easy.

(imported from commit acce1da52de1b9b757ef76a9734d61f399f81a01)
2012-09-05 11:03:53 -04:00
Luke Faraone 3db1766015 Fix broken narrowing on classes with keyboard shortcuts.
(imported from commit e829c55e88a57c4dbe4693c41f15eaf27a025daa)
2012-09-05 10:56:59 -04:00
Tim Abbott 2ff6a39976 Some huddle cleanups.
(imported from commit 244bfde4da2a4faeb150182f232937f0cb3a9a85)
2012-09-04 19:41:42 -04:00
Tim Abbott 4d284d8a92 [schema] Add support for multi-user personals ("huddles").
This is controlled by listing multiple comma-separate usernames in the
personal message sending box.

(imported from commit 06c9dadb7977b98f88ad31e5df453b59f1afad96)
2012-09-04 19:15:07 -04:00
Tim Abbott 84ece4b3fe Combine the zephyr() and personal_zephyr() functions.
(imported from commit a39b70f019901d0dd6994d4c440002111e4c29e1)
2012-09-04 19:14:46 -04:00
Luke Faraone 974b560659 Add autocomplete for personals, classes, and instances.
Here we pull in the jqueryui library and a style sheet to provide a widget
to do autocomplete for various fields. We populate a list of all ever-seen
classes, instances, and people (C/I/P) into JS arrays and then pass them to
jqueryui.

Each time a new C/I/P appears, we reinitialise the autocomplete functions
so they will notice the new data.

(imported from commit f1ab69c99d21f68ccf40c015bd43960f463c6ff2)
2012-09-04 16:14:48 -04:00
Keegan McAllister ac2553cdff Replace get_state with a variable embedded into index.html
(imported from commit 3ef4a0163107248618a25e242ab30fdff5da17e0)
2012-09-04 13:01:00 -04:00
Keegan McAllister e86216dff0 Add missing semicolons
(imported from commit f562f6e63368d5cb48ccba3b72981ff36a9cff30)
2012-09-04 13:01:00 -04:00
Keegan McAllister 9b5e47cd45 Don't select a zephyr until we've loaded them.
(imported from commit 04f72ae1e2ca67dfc1220baee11940008e0d2c91)
2012-09-04 13:01:00 -04:00
Keegan McAllister 2e8b1fa14a Use client-side templating to render zephyrs
(imported from commit 5ac650c3df0fa8caa823407d9d1a65a38f7e63c6)
2012-09-04 13:01:00 -04:00
Tim Abbott d85e80483f Eliminate the dummy row.
(imported from commit 4f0cd12e77cbe4d6a29baed9902c7c7074fcff27)
2012-09-04 11:49:13 -04:00
Tim Abbott 87188e2575 Filter newly arriving messages by the current view.
(imported from commit db23824bfc584d3b1bc0d6239d04988ca1b3ca4a)
2012-09-04 11:49:13 -04:00
Tim Abbott 633aceb054 Keep track of the current narrowing rules.
(imported from commit 0af6fc38f0f17a57428f64570139171dbede30fe)
2012-09-04 11:49:13 -04:00
Jessica McKellar f556702804 Add a missing semicolon.
(imported from commit c0676f077ee8655abd33a382cd01b0330eff4e82)
2012-09-04 11:38:10 -04:00
Jessica McKellar e51ab0cdfa Get pointer state from the server on page load, and scroll to that zephyr.
(imported from commit a1387d89378494a55f084f56ed9eb33c4f719dcb)
2012-09-04 11:36:36 -04:00
Tim Abbott b784202128 Unify the various narrowing interfaces.
(imported from commit e2ddd5ae3ecaa385f1adf80b75a64534dd5b3950)
2012-08-31 17:58:20 -04:00
Tim Abbott 8506656df1 Fix bug in scroll_to_zephyr removal.
(imported from commit 4aca6534889012fd1b0e59dc88a156494b6ec51f)
2012-08-31 17:58:17 -04:00
Tim Abbott 6369da671b Clean up narrowing code to all use the same pattern.
(imported from commit 7f213ccdb31522a0fcb63cb69e2ea7677e3b352c)
2012-08-31 17:16:39 -04:00
Tim Abbott e4e3fde8a5 Rename narrow to narrow_class.
(imported from commit 8bd0f91ac7496d2da4706128b7d2c32acfad081c)
2012-08-31 17:16:09 -04:00