Commit Graph

1286 Commits

Author SHA1 Message Date
Keegan McAllister a3fcf3417d Move get_{next,prev,first,last}_visible into a sensible order
(imported from commit 80697ba55c1fb9bf52a4fffd2f15471b8892f07c)
2012-09-21 17:55:16 -04:00
Keegan McAllister f3ee3fa6eb Simplify get_{next,prev,first,last}_visible
Now that we have two tables, the adjacent zephyrs will always be visible.

(imported from commit a1ac000bfba32faea109d1b35a84fdd30ccc4891)
2012-09-21 17:54:11 -04:00
Keegan McAllister a53cbc9f36 Move hotkeys into a new file
(imported from commit a589cd4623c4707122d5d5936aa0bc555c38557a)
2012-09-21 17:52:02 -04:00
Waseem Daher f1aa17cf1d Change some URLs associated with subscriptions.
Put all the 'API'-ish URLs in the /json/ namespace so that
/subscriptions and /subscriptions/add, etc. can be real
user-facing URLs if we want them to be.

(imported from commit 1455a32d27e44547ab1874b6289243cb40c85dde)
2012-09-21 17:36:29 -04:00
Keegan McAllister f4483832b2 Force select_zephyr when narrowing even if id has not changed
Fixes a bug where the pointer would vanish.

(imported from commit 0ed950fbc3d5a8673b0bc62556f426cccb5a6459)
2012-09-21 17:33:00 -04:00
Tim Abbott 76c1dfc1ed Make home and end go to first and less messages, respectively.
(imported from commit f85b811f51227cd1ae113c119a430381230d141c)
2012-09-21 17:13:07 -04:00
Waseem Daher 230e725446 Allow spaces in classnames.
(imported from commit 9ef71240ee5e6e0ed9ca0b50d9461b539538b437)
2012-09-21 17:09:46 -04:00
Tim Abbott 919ddfdc31 Send recipient_id values to client and track them there.
(imported from commit 77446f7a226d8a26a287e069d08f28e4beb0b2e3)
2012-09-21 16:57:04 -04:00
Tim Abbott 12013cd7b7 Fix collapsing of huddle messages.
(imported from commit 31391a278f5fe70ab56379bf7cc3fad2d0663007)
2012-09-21 16:44:30 -04:00
Waseem Daher 5a164f19c2 Clean up subscription functions.
Now that 'manage_subscriptions' only removes subscriptions,
let's name it that. Also, since both functions now only
act on one subscription at a time, use them in the singular.

(imported from commit 52cfc7b36eb1533da7aec1bc3a6e460151a56da8)
2012-09-21 16:30:29 -04:00
Waseem Daher a27edbce7d Restyle subscriptions page.
(imported from commit 41339c5af38ae5ea4801fc1e23b7184c277145f3)
2012-09-21 16:04:44 -04:00
Tim Abbott ed46a453ba Add (mostly unstyled) settings page.
(imported from commit 492c5f498c2fec452e6c724555bc4a5a2c4c151a)
2012-09-21 14:47:26 -04:00
Tim Abbott fc12e6ffbb Fix collapsing with new email addresses instead of usernames.
(imported from commit 26a2391ac1f965f78feaff5092b42cf49f57215f)
2012-09-21 11:15:08 -04:00
Tim Abbott ee8f28a084 Use email addresses as unique identifiers rather than usernames.
Note that this code still assumes one's email address (stripped of
domain) is unique.

(imported from commit e98f96601ad109811978fc00b1165e97d8f7b185)
2012-09-21 09:43:22 -04:00
Luke Faraone 1050300ded Render Huddle titles the way Waseem detailed in his original mockup.
This actually involved refactoring a good bit of existing code; we
in this commit introduce a new property of zephyr called .reply_to, which
is the fully rendered-to-string and pretty-printable version of the person
to which any reply should be addressed.

This is useful for grouping personals, where if you simply went by the
.display_recipient or .sender you would have to check them against
eachother.

We also introduce a new narrow_classish command, which is triggered on
clicking on the "Huddle with…" text. This method intelligently determines
which sort of narrowing to do; we essentially moved out code from the 'r'
key handling section and put it in its own function.

(imported from commit 2406ee0f6f83b990eec83190d2e8858865c06238)
2012-09-20 16:36:49 -04:00
Keegan McAllister fbec2b8d76 Use DOM ids in get_zephyr
This greatly reduces lag on mouseover selection.

(imported from commit 7d9bc0ebce2aa9781c316033d3e9d21e9da6ee3f)
2012-09-20 15:23:41 -04:00
Keegan McAllister 1dabe1cf81 Give each zephyr row a unique DOM id
(imported from commit 4530d0bbbfc94fb86ebba9c6d73074de38e4a78a)
2012-09-20 15:23:41 -04:00
Keegan McAllister 48fea66e34 More consistent naming for #table and #filtered_table
(imported from commit 966ab97522a79fb5cf6dc1e215487ceba01f6d11)
2012-09-20 15:23:41 -04:00
Keegan McAllister d4985ef5f4 Optimize select_zephyr_by_id for the already-selected case
Saves a call to get_zephyr.

(imported from commit 9ce9f2af7e4d8eb5e3a76a3c0ddbfb7f5896a583)
2012-09-20 15:23:41 -04:00
Keegan McAllister a00227c864 Implicitly choose the selected zephyr for showing email address
I erroneously switched halfway in ce4f6289491722d4c1aa84fe8b88b3a5932a3f2a, so
let's just do it for real.

(imported from commit 4c09a7805f6e2322cbbab2f8534e9d362acdc826)
2012-09-20 15:23:39 -04:00
Keegan McAllister 8d994bdb21 Make sure only one email address is displayed at a time
(imported from commit 51b5b2268a154d1136b03185d6658fad7f2922aa)
2012-09-20 15:22:08 -04:00
Keegan McAllister 81ff352ac3 Simplify bookend creation
(imported from commit 8faf260037b7e0508d9e4acea24687ebc06ea0ef)
2012-09-20 00:08:46 -04:00
Keegan McAllister 7d894d8dd1 Merge update_pointer and select_zephyr
Having both is confusing.

(imported from commit becd1ac7a8bab583c4fafdd77256c57f3dc98ea1)
2012-09-19 17:55:58 -04:00
Keegan McAllister 5ff4d22859 Note get_zephyr performance
(imported from commit 215a457d30f5a355d18882a9703ff671248b054f)
2012-09-19 17:55:58 -04:00
Keegan McAllister c3f3a1ef14 Cache the selected zephyr jQuery object
(imported from commit ce4f6289491722d4c1aa84fe8b88b3a5932a3f2a)
2012-09-19 17:35:18 -04:00
Keegan McAllister 5ba760a8f3 Use the zephyr IDs we already have
(imported from commit 6506f30be02cd4d4ee660709fbf8b7530a9276a9)
2012-09-19 16:43:45 -04:00
Keegan McAllister af5282abd4 Add client-side debugging tools
(imported from commit faa87e85f366e91fe33e0f24e00ae1197403605d)
2012-09-19 16:25:23 -04:00
Keegan McAllister 72b98d1d01 Hotkeys: don't go from zephyr to zid and back
(imported from commit e7e80bdc2e0af5dfe9ec4f885cae814543c038de)
2012-09-19 16:25:23 -04:00
Luke Faraone c0805e4846 Remove spurious lines at the top, add lines to the bottom of the view.
We previously weren't actually applying collapsed_parent to any zephyrs,
switching from .children to .find fixes this.

We also don't add a bookend in front of the first zephyr.

Also, borders are handled by the zephyr trs themselves as opposed to the
bookend tr.

(imported from commit 8bdc9bd812833288c85c13a102459a5ef1e36225)
2012-09-19 13:15:12 -04:00
Luke Faraone fed4cd3891 Limit № of autocomplete results so the list doesn't fall off the screen
(imported from commit 311376c1dec35a16ddfb66fc01161501c2eafff0)
2012-09-19 13:11:13 -04:00
Luke Faraone 72eb05dfc5 Switch to Boostrap Typeahead instead of JQuery-UI Autocomplete.
This reduces the number of CSS/JS files we need to load, which is awesome.

(imported from commit 3d34276a185e61f698163402cff2fd2c75ce0bd7)
2012-09-19 11:51:53 -04:00
Luke Faraone b634d26017 Post the newly selected zephyr ID, rather than the old zephyr ID.
Previously update_pointer POSTed the selected_zephyr_id, which in reality
was the ID of the zephyr we just moved off of, rather than the current
zephyr we just higlighted.

(imported from commit 2b143b34d3042a789b3f6a999117115dd6243782)
2012-09-19 11:13:43 -04:00
Jessica McKellar 3ec50a921d Fix loading subscriptions on the live site.
For some reason on both my and Waseem's local instances the lack of a
trailing slash was not an issue, but this does fix the issue on the
live site.

This could be because we are running Django 1.4.1 and the deployment
server is running 1.4.0.

(imported from commit 613732d75f204fd654247382088d92879780560b)
2012-09-19 10:21:34 -04:00
Luke Faraone 7d4693a063 Unbreak adding messages in get_updates_longpoll.
(imported from commit 4dbf0b151c7ac243f23b74feeb85dac2b410c7b9)
2012-09-18 18:02:53 -04:00
Luke Faraone 5b32048ade Implement borders using CSS rather than brs, style the way Waseem wants.
(imported from commit f4e23721a6eb0ffdd2d6e859b28417f0fdfbfe87)
2012-09-18 17:19:29 -04:00
Luke Faraone c5d1897ab3 Reimplement collapsing, for realsies this time.
We no longer break random things! Its pretty grand, actually.

This reworks and reverts commit fbadd6e854722e41cccd2535748ee47f4efd657b.

Conflicts:
	zephyr/static/js/zephyr.js

(imported from commit 534a120290855d3bf2cf979ac174267c2d07bf68)
2012-09-18 15:56:01 -04:00
Jessica McKellar a8484cb967 Remove subscriptions with an AJAX request.
(imported from commit d34154b31a38ac66cc8f97785c312c98dd53286c)
2012-09-18 12:33:07 -04:00
Jessica McKellar 2126e38ae2 Get and display new subscriptions with an AJAX request.
(imported from commit c9efa7596898ac4b74ec9184ae773566eda65ec3)
2012-09-18 12:32:52 -04:00
Waseem Daher a70e8dee4d Refactor our different pages into separate templates.
They are all included by index.html in different divs.

(imported from commit bd8b485516007075d33c2614b1de9f08999e927c)
2012-09-18 12:26:29 -04:00
Waseem Daher 5ebac29508 Switch back to 'Home' view when composing new message.
For now the idea is that if you're in the search view (or the
subscriptions view) and you click 'New Message', we should
snap you back to the main view.

This may or may not be the right behavior in the long term.

(imported from commit 43c24e1af9e80225ff9be8a62f4c8c925960436a)
2012-09-18 12:15:24 -04:00
Waseem Daher 5f49616753 Refactor: Put the zephyr <tr>s in the template.
(imported from commit 8a822d7c8463c248d536f97f07bfb19ca242b83f)
2012-09-18 10:46:11 -04:00
Waseem Daher d5bdd84ab7 Colorize the view differently when in narrowed mode.
(imported from commit c7b2d23386ff0895caaea8e9f6e3c116e6744c53)
2012-09-17 17:04:39 -04:00
Keegan McAllister 7152fe2f73 Format messages with Markdown
(imported from commit 014a4dddd4d3db61d85c6f6bf1987aff6093fb52)
2012-09-17 15:24:41 -04:00
Jessica McKellar 72168b8275 Put focus on class field when you click New Message to compose.
Previously no focus was set and the shown tab was whichever tab you'd
last seen.

(imported from commit 2ca731373327aa71de7472220725b518cb1861d0)
2012-09-17 14:39:32 -04:00
Jessica McKellar 3d2de1fa7c Snap back to where you were in the home view upon un-narrowing.
(imported from commit 72458f4006890c392e5ca557f7178260bff7c7f9)
2012-09-17 13:26:09 -04:00
Jessica McKellar 8e1ce1c371 Shorten the compose box fade and collapse time.
(imported from commit 136f0fc02da291c85a4f4b169217a273ff496faf)
2012-09-17 13:26:09 -04:00
Luke Faraone 8a89c56b7b Iterate through an array without using 'in', remove extra spacing.
This corrects some additional bugs introduced in 9128ddd and a5f06bd
identified by Keegan.

We previously used "for i in"-style looping, which is sub-optimal. Move
to a different style.

We also had a weird spacing thing I introduced in a previous commit,
which has now been fixed.

(imported from commit 7334d8ee703564bedeb0ea939b0d64ad2d5fceba)
2012-09-17 13:12:24 -04:00
Luke Faraone de5ff99c21 Don't generate both zephyr_json and zephyr_dict_json on the server.
Previously we were iterating through all zephyrs twice on the server, now
we are moving part of that to the client so the client has an index of
Zephyrs that it generates itself as part of add_message.

(imported from commit c07a6c36911fa2eae6f216c34331be34b2aa8178)
2012-09-17 13:12:22 -04:00
Luke Faraone 50dd1c31b8 Don't directly use showToggle, instead calling upon show_compose.
(imported from commit 4f3f81edf0c19abf34cbc5f39e25bdbad50c6d9a)
2012-09-17 13:11:49 -04:00
Jessica McKellar 69cc5c02dc Make clicking anywhere in a zephyr start a reply.
Previously you had to be inside the content span.

(imported from commit 0570ddeb9bc948d278b0b1859b4a041b81ff184d)
2012-09-17 11:16:53 -04:00
Jessica McKellar e8a6fee147 Fix the ability to send zephyrs when there are no previous zephyrs.
Previously, select_zephyr was erroring out, preventing New Message
from working.

(imported from commit 570a777318a7078c0c326042876b94dcc496011f)
2012-09-17 10:42:45 -04:00
Jessica McKellar ccfc9f5889 Only register the callback for subbing to a class once.
(imported from commit a6c41f79ea8c6e2f6a6ff5a6b41b98fd53ad4e82)
2012-09-14 15:44:55 -04:00
Jessica McKellar d7f453dfb3 Only register the callback for creating a new class once.
Previously, when trying to send a zephyr to a new class, you would
actually send N zephyrs, where N is the number of times you'd created
a new class.

(imported from commit 2c36b0282c8c2291e05b5ad952f5b25e3f43d406)
2012-09-14 15:44:55 -04:00
Jessica McKellar a12f582d92 Don't let people try to send zephyrs to empty class names.
Also strip leading and trailing whitespace, so 'Bar' and 'Bar' aren't
separate classes.

(imported from commit a39c220d1a4c4d179f4adbf5e1391436eda32f4f)
2012-09-14 15:44:54 -04:00
Jessica McKellar 9a7dc0e50b Only hide the compose box on a successful zephyr.
(imported from commit a83e26ce42ae6b80872dd81ed10d5318c193f1ef)
2012-09-14 15:44:54 -04:00
Jessica McKellar 56ea3d12d5 Clear the compose box after successfully sending a zephyr.
You don't care about that content anymore. We probably want to clear
even more aggressively than this.

(imported from commit 29f6910a12e1b722f5801db644b04f54cf5bfd63)
2012-09-14 15:44:54 -04:00
Keegan McAllister 67b337ce07 Get rid of selectors like span.foo
Just write .foo.  We shouldn't have to care what type of tag it is.

(imported from commit 86c4eeecbe4f5c9875002e3fd81757cd49050268)
2012-09-13 16:32:21 -04:00
Keegan McAllister 8b691ec0b2 Don't update pointer when it hasn't actually changed
(imported from commit 41c8b1cd2a586bb9d82b0ff194c076e93f34d98a)
2012-09-13 16:29:47 -04:00
Keegan McAllister 3694ecaf4c Only display email while hovering on fullname
(imported from commit 0f366deb69ba49bfda998dd993e32de0d29affe4)
2012-09-13 16:29:47 -04:00
Luke Faraone 17537ffe17 Use zephyr_dict as the authoritative source for data about zephyrs.
Previously we would extract zephyr data from a TR. In the NWO where
sometimes this data is ommitted, we instead need to use the zephyr_dict
object.

(imported from commit a5f06bdadc4fbe13f1718d6dcb41046d0ed040cd)
2012-09-13 14:36:54 -04:00
Luke Faraone 4821175dd5 Provide both a sequential list of zephyrs and an associative array.
The purpose of this is to ensure that we can reference a zephyr by its ID
and get all the data about the zephyr; in the future we may not have all
such data stored in TRs as we do now.

(imported from commit 9128ddd01b46396fd276124ca1e6430538d3dd63)
2012-09-13 14:31:02 -04:00
Keegan McAllister ea42342031 Distinguish the selected zephyr in CSS
(imported from commit 42e243ff95de5427e78dbc532dfe9e50e9677438)
2012-09-13 11:57:26 -04:00
Keegan McAllister a8dcf09f1e Use get_zephyr
(imported from commit 160eb772992cb18450b859637935f1039c576832)
2012-09-13 11:44:51 -04:00
Keegan McAllister 16b8258924 Fix bad merge
(imported from commit 6d6a4e7da0e3e3dacd732cde19009b427aa813cb)
2012-09-13 11:42:23 -04:00
Jessica McKellar 09bb68e52c Have the pointer follow the mouse.
(imported from commit cfd6bcd7ba506c440f74bd7e40eaacadc06b10c8)
2012-09-13 11:06:29 -04:00
Jessica McKellar 08904cae43 Clicking on a zephyr pops up the compose window and prepares a response.
(imported from commit 00139f7b0c6d1ded198064689f1a1bd8038e72f9)
2012-09-13 11:06:28 -04:00
Waseem Daher 3e5008b143 Remove searchbar from narrowed view.
Today I'm of the mindset that searching is a fundamentally
distinct operation than narrowing, so this reflects that.
(There would be a separate screen and UI for searching,
 I guess.)

(imported from commit 432a4088612dafd06184bec228b63056961325dd)
2012-09-13 10:36:29 -04:00
Keegan McAllister 51e109d043 Show full date hovering over timestamp
(imported from commit 486cd85b4ec21ad8468ced207c541372f341c200)
2012-09-13 01:00:28 -04:00
Keegan McAllister b0d8f30d91 Make Esc hide the compose pane in every hotkey mode
(imported from commit 487f19265053780a322ea741a08b3bf318821574)
2012-09-12 18:06:28 -04:00
Keegan McAllister a236e29afa Factor out hiding/showing compose pane
And avoid slideToggle, so that we don't have to care about the current state.

(imported from commit 52ddcfda50baa297c56114574600c5a5e0ee47f2)
2012-09-12 18:06:28 -04:00
Waseem Daher e8a1ecad94 Renaming some divs for additional clarity.
unhide -> show_all_messages
narrow_indicator -> currently_narrowed_to
narrow -> searchbox

This is a little clearer about what these buttons/functions
do, which will be useful as we add a little more complexity
associated with searching.

(imported from commit b51e745ea71c212d6735e04011eaea5e71bf6d5a)
2012-09-12 17:31:48 -04:00
Keegan McAllister 7d4fd5b14f Zero-pad hour and minute
(imported from commit 404600ce3cb2233acb1b2e69cdd87c64604d9826)
2012-09-12 17:07:13 -04:00
Keegan McAllister ae5137b5c9 Show timestamps on zephyrs
We use the browser's local timezone.

(imported from commit 6ed6444df6edf2093b9399adb1511dd3ee80def3)
2012-09-12 17:00:02 -04:00
Keegan McAllister 714eec5594 Select zephyr rows by class
This fixes the bug where the reply box is hidden when narrowed.

(imported from commit 0673b9063818946b7da70f6109ca17403240737d)
2012-09-12 11:47:56 -04:00
Waseem Daher 85398abba3 My take on a prettier pointer.
(imported from commit 7d0c37c85781bdd48efb4cf9cec49bb6df7f0954)
2012-09-11 17:38:05 -04:00
Jessica McKellar f5e8f025b7 Bring back preparing a personal when you click on a user.
(imported from commit b9081cb77dafa590605ee3a0892b359cc7ac6d06)
2012-09-11 16:35:01 -04:00
Jessica McKellar 49af4ec000 Don't hide the New Message button when you click on it.
It's not part of the original WaseemUI scheme, and it doesn't ever
reappear.

(imported from commit 3417fae31fc8d1b87d0d8b463548c24f5c2d260c)
2012-09-11 16:35:01 -04:00
Jessica McKellar f52ec24926 For now, compose zephyrs to usernames.
We'll eventually need to normalize emails, autocompleted names,
etc. to one entity we use when talking to the server about senders and
personals recipients, but for now since we've hardcoded usernames
everywhere, just use those.

(imported from commit 4a0e033b301b8dec55d97157eb4993982f6b2641)
2012-09-11 16:35:01 -04:00
Jessica McKellar 06711afa51 Add a block of whitespace at the bottom of the zephyr feed.
That way you can see new zephyrs as they come in.

(imported from commit 6b72a7f2116130edc0444f601423453801ddb6b5)
2012-09-11 16:27:12 -04:00
Waseem Daher cca0e8f521 Restyle narrowbar slightly.
I have some serious concerns with this implementation,
but I think it's still an incremental improvement.

(imported from commit 6ed8d2545c727e25bf85b98a1528dbf3d155bc92)
2012-09-11 16:20:16 -04:00
Keegan McAllister b4103798f5 Speed up narrowing
(imported from commit e1f06866ebc7d3dae3a5813565002853a6f6d8ba)
2012-09-11 15:37:09 -04:00
Luke Faraone 34a7ad5be0 Revert "Collapse duplicate instance names, add breaks."
This reverts commit 8c47682cd80fec0d221a519abc593f4d83dc90b5.

I accidentally broke.. a lot of things in my last commit. Lets fix those
issues before pushing to master again.

(imported from commit fbadd6e854722e41cccd2535748ee47f4efd657b)
2012-09-11 15:19:51 -04:00
Keegan McAllister 75c34a7f1b Fix a bunch of code style problems
(imported from commit 473ae8fdd64783f7a0989b17cae39826de42d30d)
2012-09-11 14:38:33 -04:00
Luke Faraone c5238e4af5 Collapse duplicate instance names, add breaks.
(imported from commit 8c47682cd80fec0d221a519abc593f4d83dc90b5)
2012-09-11 14:37:24 -04:00
Luke Faraone 34b594b96b Reimplement the narrow bar.
(imported from commit 19e41c1238dff404813a21b9dc318458d5f29c64)
2012-09-11 12:12:02 -04:00
Luke Faraone 1da8c16367 Make "new message" open the compose window.
(imported from commit d63f4915f884dfa2bc11653d17782e5ee4c6191e)
2012-09-11 10:54:25 -04:00
Keegan McAllister 7b8544a53f Get class/instance for narrowing more uniformly
(imported from commit 1e9622cb93cf5954cf94f38c77c191524a6e72bc)
2012-09-10 14:46:03 -04:00
Luke Faraone cfc42b1d82 Implement portions of Waseem's new UI.
This is mostly working; things that need to be implemented:
 - Ask users for their Real Name
 - Personal replies need skinning
 - Miscl UI changes to match mockups

(imported from commit 3638cf5ec2ba2306004ba6db6fa4c25c47f76517)
2012-09-10 14:32:42 -04:00
Keegan McAllister afee8630aa Implement hotkey state as a state machine
(imported from commit d4f52cbc6bc9e66643e89c5b49a2201e4c938265)
2012-09-10 11:36:17 -04:00
Keegan McAllister 2798f83dbe Use switch-case for hotkeys
(imported from commit c269119d6e1034508303b1c67f5e7a59376674da)
2012-09-10 11:36:17 -04:00
Keegan McAllister e3307aff39 Factor out hotkey processing
(imported from commit bb7a7269b39481cbe831a9a5872b4e32f0f04234)
2012-09-10 11:36:17 -04:00
Keegan McAllister 11b5a8e193 Add JSLint options
(imported from commit ff01274558cf1145a6ab057218bc16bac5628b2e)
2012-09-07 15:15:16 -04:00
Keegan McAllister b4c2aba14d Reparenthesize an expression
This was supposed to be (x && (y || z)) but was written as
(x && y || z) i.e. ((x && y) || z).

(imported from commit c2d6d385f71e6bc4b8933f6426d88aeee0123f66)
2012-09-07 15:07:50 -04:00
Keegan McAllister 52b6ed0ba4 Move scroll_to_selected definition before first use
(imported from commit 22f3274f8f636950784f241b9b61dc3785b370b0)
2012-09-07 15:07:50 -04:00
Keegan McAllister 8c9d29842d Fix formatting of nested functions
(imported from commit 7777d6bcc3d249d6c5dd51305c88220e5ec6e469)
2012-09-07 15:07:50 -04:00
Keegan McAllister c31e7903e9 Missing semicolons
(imported from commit 76bfb622f5e6a90b4c14dc4db78ab16e7a935df0)
2012-09-07 15:07:50 -04:00
Keegan McAllister b7d7d3da26 Declare all variables at the top of each function
Javascript has function scope only, not block scope, so the block use of 'var'
is misleading.

(imported from commit 6763fa241408e5893392f622fd92b2664a993ed0)
2012-09-07 15:07:43 -04:00
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
Keegan McAllister 115edb57b2 Eliminate tab characters from source code
(imported from commit 60c0742b8998ee08189b576b38cd0b4416f22b66)
2012-08-31 16:51:46 -04:00
Luke Faraone cd5b623cfd Reply to the recipient instead of the sender if replying to my own personal
Previously, if hamlet wrote to iago, and then hit "r" on his own message,
the form would prompt hamlet to reply to himself. Now, Humbug will DTRT and
prefill the form with iago instead.

(imported from commit cb3260d1d0bc89b184dac84ebf1e5642d0bc1606)
2012-08-31 16:50:24 -04:00
Luke Faraone 29a41d992e Blur buttons on submitting a zephyrgram.
This way the user can continue using the keyboard to navigate
after sending a message, without pressing additional keys.

(imported from commit 014997194f546fe56da063e19d3818e949a3ee7e)
2012-08-31 16:29:00 -04:00
Luke Faraone 3223d2e0ba Make scrolling Correct (a la Barnowl) without losing messages
Previously the wedge sometimes got lost when you scroll. Now, on a
scrolling action the selected message is moved in to the middle.

We also now use scroll_to_selected as opposed to scroll_to_zephyr because
there wasn't really a usecase for scrolling to a non-selected zephyr.

(imported from commit 5091b3a715f2253dfe302d4c7ea8a087ff9d508e)
2012-08-31 16:20:20 -04:00
Keegan McAllister 2d30c9440d Retry if long polling fails
(imported from commit fc2d09976231974bf48efbcf5dfc480be36e26ec)
2012-08-31 15:33:04 -04:00
Keegan McAllister d07a1b914c Code style consistency
(imported from commit a5345b0fda9701c62b65c367f71ac871a7e15d60)
2012-08-31 15:04:15 -04:00
Keegan McAllister 57bdc40b87 Fix superfluous use of .html
(imported from commit 4f165669c1d09efa811169c26e1e7541fbfb45f6)
2012-08-31 14:55:28 -04:00
Luke Faraone 8342c2c2ee Ensure that the ▶ stays after clicking on a selected message.
(imported from commit 2af024f0090383f429bd5727fe3ceb8b32cd2021)
2012-08-31 14:43:49 -04:00
Luke Faraone 6a7b183e06 Clicking on a Zephyr now sets the pointer to that Zephyr.
(imported from commit 2707f22997892c1414965c988a80609ef8d93388)
2012-08-31 11:10:19 -04:00
Luke Faraone 266f6397a2 Correctly handle 'r' for personals.
(imported from commit 7f60fbc6aa737d32d710b2ec2c5c9d6fe9b047e4)
2012-08-30 17:45:06 -04:00
Luke Faraone 148738447c Select the value of "content" when replying to a zephyr.
(imported from commit ef8759911b602a67b594f085772d33251ad94dde)
2012-08-30 17:45:06 -04:00
Luke Faraone 833cf8b1ff Implement hotkeys for filters, let ESC break out of input boxes.
Here we added code to enable users to use shortcuts like "g-c" or "g-a" to
go between zoomed-to-class and showing-all and related forms.

Documented on the wiki in (Hotkeys).

(imported from commit ee3bdf070a560d503c6537ccb1d213707bc11f66)
2012-08-30 17:45:06 -04:00
Luke Faraone e9ee6e365a Only allow hotkeys when not focused on input/textarea/button elements.
Here we bind to the focus and blur events to keep track of when elements
we care about are in focus. Elsewhere, we test whether hotkeys are allowed
before... using hotkeys.

(imported from commit 50f8f8cb4874209411db59512f77c8dd33d837f5)
2012-08-30 17:45:05 -04:00
Keegan McAllister 41adbfc92d Allow the user to dismiss send errors
(imported from commit bcce5f0a1cdc0d5eec2586e72f8a5945574697ad)
2012-08-30 16:41:09 -04:00
Keegan McAllister 2313498891 Build zephyrs using DOM manipulation rather than string munging
(imported from commit 521fafe3a393ffffa215cee42519edeee8d48b3f)
2012-08-30 16:41:09 -04:00
Keegan McAllister d57d19e562 Move all zephyr HTML generation to the client
(imported from commit 3afec768a5cd220c14ce615e03c29ee22754fdf2)
2012-08-30 16:41:09 -04:00
Keegan McAllister ddacce81b7 More responsive UI for sending messages
(imported from commit 8a6c4e78788f46dde4fe166e17828eb9e7bdcaff)
2012-08-30 16:19:44 -04:00
Keegan McAllister a1a7291fe5 Send zephyrs via Ajax
(imported from commit cdfd69079212d36a9e4e9d2d01dc7b6a93b6a4e0)
2012-08-30 16:19:44 -04:00
Tim Abbott 9afd63692f Implement long polling using Tornado.
(imported from commit 4385304b27d7fe55a57a23133cd214fe8fc33482)
2012-08-30 14:29:34 -04:00
Keegan McAllister 9714cf920e Focus first text field on tab switch
(imported from commit 10b03b741f689d6dc80c968c7e057d72a88fb12e)
2012-08-29 17:25:04 -04:00
Keegan McAllister 556837d3a6 Indicate clickability on labels
(imported from commit cc3c48879d50c0808d465492c20a887bef408a91)
2012-08-29 17:25:04 -04:00
Jessica McKellar a47adef065 Add missing recipient textarea to check for focus.
(imported from commit e7af941dbc0e76d54f573b3b6dd92ae3331394d8)
2012-08-29 17:23:28 -04:00
Jessica McKellar d85c0d6ad8 Suppress displaying the 'r' in the content box on r-to-start-composing-zephyr.
(imported from commit 1216b3739737a9dbf203fe105b16c6672bccd272)
2012-08-29 17:09:33 -04:00
Jessica McKellar ebb08446e2 When you hit 'r', only try to start a zephyr if you weren't in the middle of one.
(imported from commit 36779bf955e28c3a10713829e93cd207fbbb36f3)
2012-08-29 17:08:16 -04:00
Jessica McKellar a8fa6b156a Turn newlines into linebreaks.
(imported from commit 67999641a8cff471be1430e421f259b1c558444d)
2012-08-29 16:47:53 -04:00
Keegan McAllister 13ee85f886 Enforce minimum height for main_div
(imported from commit 291e5e0fc8680db63dec55b7339c4fe72d6acb76)
2012-08-29 16:32:12 -04:00
Keegan McAllister a0e59fbbc9 Narrow on all personals together
(imported from commit 2dc2646344767acbda7f1d8d6f847f8a69d597cf)
2012-08-29 16:23:56 -04:00
Keegan McAllister 452b218ab6 Hide personals when narrowing on class or instance
(imported from commit 1bd5a8ea05fcb6e3d8c7b68821faa9664cf5586b)
2012-08-29 16:02:26 -04:00
Keegan McAllister 03a087a654 Rework display of personals
Code cleanup, and add an arrow to indicate sender and recipient

(imported from commit 24881ee1e5f3bc9209f9ec485195dcd7178d86fb)
2012-08-29 15:53:38 -04:00
Keegan McAllister 6e88482977 Remove debugging code
(imported from commit 6e128f9f97fd433464bf14fc728d577e7e4fa0e4)
2012-08-29 15:40:30 -04:00
Keegan McAllister 6832fa9489 Use 'BLACK RIGHT-POINTING TRIANGLE' for the 'selected' indicator
(imported from commit 713b24521f080e7772991d2d9808324ef6219ac5)
2012-08-29 15:40:10 -04:00
Keegan McAllister 738ed46941 Factor out the HTML for #selected
(imported from commit 2de461dca6ee22bcb701e0c5c2ec49bbcad496e4)
2012-08-29 15:40:09 -04:00
Keegan McAllister a2777eaed4 Resize main_div to exactly take up remaining vertical space
Unfortunately, it's not so easy to do this with CSS only.

(imported from commit 93b58a53e20aae9ee651aa66b3163f68549a3982)
2012-08-29 15:40:09 -04:00
Keegan McAllister a1d852d124 Jump to personals tab on prepare_personal
(imported from commit 5f3fbc7a84a0af6742ceb1f1ab8806234870445f)
2012-08-29 15:40:09 -04:00
Keegan McAllister 395001d8db Indicate narrowing
(imported from commit 19682fc07393f0848481abf72339eefd56b30ab2)
2012-08-29 15:40:09 -04:00
Keegan McAllister 1b587fc2c6 Style class / instance / username labels
(imported from commit 2e0c9d72aa17971bdc12750dad62a59c46f646f1)
2012-08-29 15:40:09 -04:00
Keegan McAllister 3ef5334d9b Focus username field on loading login/register pages
(imported from commit 004a98ffaa59aebab34057cbe34f5e1038e44b62)
2012-08-29 15:16:28 -04:00
Jessica McKellar 1f56ac9e60 Make the zephyr highlighting for new zephyrs consistent with those on page load.
(imported from commit 28dbdb564b4dff479af1f71551a393f8dd54d597)
2012-08-29 14:54:00 -04:00
Tim Abbott cc01ad04bf Move javascript into its own file.
(imported from commit b0e9a5e2700e85f31f8cd5922ab489000c96781c)
2012-08-29 12:04:57 -04:00