Commit Graph

55 Commits

Author SHA1 Message Date
Evan Prodromou
ac24ed3dff add checkbox initialization 2011-04-05 11:48:53 -04:00
Brion Vibber
2707a481e4 Enhancement for 'ajax' form class: submit buttons behave more like normal submissions, submitting their name/values through a hidden field.
This should work well for simple cases, but could conceivably create false positives if there's a click handler on the specific buttons, depending on whether event processing passes it on. Double-check if you're doing such forms along with the 'ajax' class!
2011-03-23 15:21:31 -07:00
Brion Vibber
4afa3caae3 ajax load for additional inline replies; /replies variant of conversationview 2011-03-17 16:27:42 -07:00
Brion Vibber
057a831026 Fixes for race conditions between Realtime plugin and the AJAX display of inline replies.
* keep the notice-reply-placeholder around, but hidden
* insert things before the placeholder, rather than appending to the end of the list.
* append the active form after the hidden placeholder, so things inserted before the placeholder never come after it
* Realtime: check pre-existing notice visibility a second time after loading the HTML for a notice. Fixes bug where sometimes your own post would be shown twice because the Realtime notification arrived before the AJAX posting returned, but Realtime's AJAX fetch of the notice returned after.
2011-03-17 15:54:40 -07:00
Brion Vibber
7d202e9c61 Detect and show AJAX errors on FormXHR submission handling.
Previously we threw away errore reported by the actual AJAX submission and only used whatever error the browser reported to us; this didn't help if we reached the server ok but had a problem there.
We now extract the #error if given and use that in the alert().
Also should now show 'Unknown error' instead of a crappy generic 'something died in jQuery' when we get a 200 response but bogus return data.
2011-03-16 16:10:43 -07:00
Brion Vibber
096f99be16 (update util.min.js for recent changes) 2011-03-11 15:31:58 -08:00
Brion Vibber
0f3af3e3b7 Keep 'Status' tab current while showing the placeholder -- pretend like it's a mini version of the status notice form :D 2011-03-10 18:01:40 -08:00
Brion Vibber
0ee5d79739 Return to placeholder entry after successful post 2011-03-10 17:54:07 -08:00
Brion Vibber
f88689cc87 Trigger status notice form when top placeholder form gets used. Delay initialization of notice ajax forms until they get shown. 2011-03-10 17:40:39 -08:00
Brion Vibber
874804a0c4 use a data attribute instead of 'title' for geo lookup api; fixes failure of cloned forms to work 2011-03-10 16:49:24 -08:00
Brion Vibber
e43ee373ae Fix disappearing reply forms when closing geo section
Missing default-cancel in the click handler allowed the event to bubble up to the body handler, where we think the click is outside of the form because the target is no longer in the form by the time we check
Now the event no longer bubbles up, as we cancel it when we're done.
2011-03-10 16:29:13 -08:00
Brion Vibber
eef9786e36 click -> focus for reply placeholder trigger; lets keyboarders use it though not super ideal :D 2011-03-10 16:23:18 -08:00
Brion Vibber
d107164aec Tweaks for closing 2011-03-10 16:15:44 -08:00
Brion Vibber
4e1ce4e5bb Remove inline reply forms on click-away if they have initial text as well as if empty (plus whitespace stripping) 2011-03-10 16:10:58 -08:00
Brion Vibber
acca8a24b4 Fix for inline reply placeholders: only remove the one we're clicking in, not all of them! 2011-03-10 16:08:28 -08:00
Brion Vibber
6b5b6d072b Make inline reply forms close when clicking outside them if there's no text again.
(That went away when we switched to reusing the main notice form)
2011-03-10 16:06:01 -08:00
Brion Vibber
ec828a094c Update LinkPreview plugin for multiple notice forms.
* main notice form setup now encapsulated into SN.Init.NoticeForm(form) -- this can be monkeypatched by plugins to append their own setup code, as LinkPreview does
* LinkPreview now supports debugging with non-minified JS source when $config['site']['minify'] is false
* tweaked core & neo styles so 'notice-status' class gets same styles as attach-status, so we can more easily add mroe statusy things. (needs more consolidation with geo-status, etc)
* tweaked LinkPreview's preview area to use that style
2011-03-09 17:43:31 -08:00
Brion Vibber
cecc2576a5 Fixes for direct message form for JS changes to the main form 2011-03-09 16:55:52 -08:00
Brion Vibber
cbf16a4974 Bookmark and poll plugins' custom notice forms now do AJAX submit, with the resulting notice appearing in the timeline.
FormNoticeXHR now is triggered on any form labeled with class 'ajax-notice', so those other than the traditional notice form should work as long as they handle the AJAX submission and return a properly formatted notice.

Things to watch out for:
* to determine whether the resulting notice should show on the current timeline, the JS code needs to be able to check the author and such. Keeping the existing vcard bits helps for this!
* the notice form submission stuff clears out inputs from your form -- test to make sure this behaves correctly
* error messages returned from the thingy _should_ come through, but this needs more testing for consistency
* while form components that aren't in a custom form should just be ignored, this should be tested more. (eg there's no location or attachment box for poll or bookmark plugins)
* NoticeListItem isn't currently reachable via autoloader -- touch NoticeList explicitly before calling into it for now.
2011-03-08 15:10:30 -08:00
Brion Vibber
28809035d0 Replace explicit FormXHR setup for a bunch of simple AJAX form submissions with adding the 'ajax' class on them.
This avoids having to add extra custom JS bits just to initialize forms using the common AJAX submission path.
2011-03-08 13:58:28 -08:00
Brion Vibber
90f1cfcfc0 Poll plugin: make the polling response form submit via AJAX and return the results.
Now, any form marked with 'ajax' class will get the simple FormXHR treatment. Should help cut down on code that just adds that into individual forms.
2011-03-08 13:45:51 -08:00
Brion Vibber
0c2289fb2f Avoid AJAX fetch delay for inline replies when possible; we clone a copy of the notice form skeleton at initialization, then insert it in place instead of fetching a new one. 2011-03-07 12:18:46 -08:00
Evan Prodromou
cf1a4d8292 Input form switcher works
This change adds the input form switcher, which adds a navigation menu
across the top of the input form, letting you switch between different kinds of input.

The input menu doesn't yet look like a nice set of tabs; it could use some love.
2011-03-07 04:57:49 -05:00
Brion Vibber
2fa95144ed Cleanup & minification for migration to reusable notice form in inline replies. Yay! 2011-03-04 15:00:20 -08:00
Brion Vibber
b68f8643a2 Kill some more hardcoded ids... 2011-03-04 13:53:41 -08:00
Brion Vibber
56d5c4a4d1 More hardcoded id cleanup in notice form... 2011-03-04 13:40:33 -08:00
Brion Vibber
e7662bb1d9 Moving bit by bit more towards reusable forms... per-form-izing some of the location setup (not all yet) 2011-03-03 17:58:35 -08:00
Brion Vibber
cd20190ba5 Remove hardcoded #notice_action-submit from JS/CSS (prep for reusable notice forms) 2011-03-03 17:48:16 -08:00
Brion Vibber
9d40c8f835 Pulling out some more #-references to per-form items 2011-03-03 17:39:37 -08:00
Brion Vibber
b58aa29168 Notice form cleanup: removing hardcoded id from counter references; prep for reusable notice forms. 2011-03-03 17:15:17 -08:00
Brion Vibber
f94a5e1a6a Notice form cleanup: drop use of id for #notice_data-text (prep for reusable notice form) 2011-03-03 17:05:19 -08:00
Brion Vibber
1ff17f0ed9 Notice form cleanup: removing hardcoded IDs from attachment handling (prep for reusable notice forms) 2011-03-03 16:56:54 -08:00
Brion Vibber
488230c3e1 Drop auto-focusing of the notice form. 2011-03-03 16:15:28 -08:00
Brion Vibber
822f08e3ed Kill 'hit return to send'... 2011-03-03 16:14:36 -08:00
Brion Vibber
6f73b2870b Rework geolocation status display so you can actually tell what it's doing and whether a location will be posted.
Goes in along with the file attachment info, below the notice box. Still needs to be generalized to work with multiple forms.
2011-03-03 15:21:27 -08:00
Brion Vibber
5a404ee713 'Comment' -> 'Reply' in inline comment/reply messages 2011-03-03 12:26:07 -08:00
Brion Vibber
018b11a883 Fix for realtime vs threaded reply fix 2011-03-01 16:29:00 -08:00
Brion Vibber
764d069ccd Clean up threaded notices vs replies classes, and fixed realtime's threaded behavior to only run on threaded lists 2011-03-01 16:08:37 -08:00
Brion Vibber
9fd2ee86f3 Inline reply work for threaded lists in realtime 2011-03-01 16:04:11 -08:00
Brion Vibber
c6521db620 Fix for timeline insert on primary AJAX post: only insert on the first, primary timeline. Don't insert on sub-timelines for replies! 2011-03-01 15:24:44 -08:00
Brion Vibber
db4ab2cd92 When canceling out of inline reply field and there are no other replies, drop the section 2011-03-01 14:26:11 -08:00
Brion Vibber
e6c972ebcb Inline replies: drop the box if tabbing out and no text 2011-03-01 14:24:06 -08:00
Brion Vibber
c0dcd73379 Inline replies: fix replies on repeats, placeholder re-add when replying to a reply 2011-03-01 13:49:13 -08:00
Brion Vibber
d01648248e Inline replies now do ajaxy submit. Neat! Not 100% perfect though 2011-02-28 16:38:44 -08:00
Brion Vibber
f109d15c28 avoid hardcoding action & session token; pull them from the main posting form for now 2011-02-28 16:24:51 -08:00
Brion Vibber
59a0b2a82d Merge branch '1.0.x' of gitorious.org:statusnet/mainline into inline-comments
Conflicts:
	js/util.min.js
2011-02-28 16:18:38 -08:00
Brion Vibber
62712b794a More interactive magic for inline replies: placeholder at the end of list 2011-02-28 16:13:16 -08:00
Brion Vibber
e89bffc3f1 Work in progress: setting up inline reply mini-form in js 2011-02-28 15:38:54 -08:00
Brion Vibber
9fcad91d8d Ticket #3014: check upload size limits client-side in supporting browsers
Tested successfully in:
* Firefox 4.0b9
* Safari 5.0.5
* Chrome 8.0.522
2011-01-25 16:26:56 -08:00
Brion Vibber
46d9496ee6 Tickets #2112, 2333, 1677, 2362, 2831: fix AJAX form posting on SSL page views with ssl=sometimes
These have been failing for ages due to our outputting full URLs all the time, usually with the default protocol instead of the current one.
Forms would get output with an http: URL in their contents even when destined for an HTTPS page; while a regular form submission would just warn you about the secure->insecure transition, the AJAX code was failing outright and then not bothering to fall back to the regular submission.

I found it was easy to detect the mismatch -- just check the target URL and the current page's protocol before submitting.

Since failing over to non-AJAX submission to the HTTP URL throws up a warning, I figured it'd be easier (and much nicer for users) to just let it rewrite the target URL to use the secure protocol & hostname before doing the final submit.
This check is now automatically done for anything that calls SN.U.FormXHR() -- making most of our buttons on notices and profile/group headers work naturally.
The notice form setup code also runs the rewrite, which gets posting working without an error dialog.

I'd prefer in the long run to simply use relative URLs in most of our output; it avoids this problem completely and lets users simply stay in the current protocol mode instead of being constantly switched back to HTTP when clicking around.
(Note that folks using the SSLAlways extension to Firefox, for instance, will have their browsers constantly sending them back to HTTP pages, mimicking the desired user experience even though we haven't fully implemented it. These folks are likely going to be a lot happier with forms that submit correctly to go along with it!)
2010-12-16 17:02:02 -08:00