Trigger status notice form when top placeholder form gets used. Delay initialization of notice ajax forms until they get shown.

This commit is contained in:
Brion Vibber 2011-03-10 17:40:39 -08:00
parent 771682b6eb
commit f88689cc87
2 changed files with 20 additions and 9 deletions

View File

@ -1292,7 +1292,12 @@ var SN = { // StatusNet
$('#input_form_nav_'+tag).addClass('current'); $('#input_form_nav_'+tag).addClass('current');
$('.input_form.current').removeClass('current'); $('.input_form.current').removeClass('current');
$('#input_form_'+tag).addClass('current'); $('#input_form_'+tag)
.addClass('current')
.find('.ajax-notice').each(function() {
var form = $(this);
SN.Init.NoticeFormSetup(form);
});
} }
}, },
@ -1307,9 +1312,12 @@ var SN = { // StatusNet
*/ */
NoticeForm: function() { NoticeForm: function() {
if ($('body.user_in').length > 0) { if ($('body.user_in').length > 0) {
$('.ajax-notice').each(function() { // SN.Init.NoticeFormSetup() will get run
var form = $(this); // when forms get displayed for the first time...
SN.Init.NoticeFormSetup(form);
// Hack to initialize the placeholder at top
$('#input_form_placeholder input.placeholder').focus(function() {
SN.U.switchInputFormTab("status");
}); });
// Make inline reply forms self-close when clicking out. // Make inline reply forms self-close when clicking out.
@ -1344,10 +1352,13 @@ var SN = { // StatusNet
* @param {jQuery} form * @param {jQuery} form
*/ */
NoticeFormSetup: function(form) { NoticeFormSetup: function(form) {
SN.U.NoticeLocationAttach(form); if (!form.data('NoticeFormSetup')) {
SN.U.FormNoticeXHR(form); SN.U.NoticeLocationAttach(form);
SN.U.FormNoticeEnhancements(form); SN.U.FormNoticeXHR(form);
SN.U.NoticeDataAttach(form); SN.U.FormNoticeEnhancements(form);
SN.U.NoticeDataAttach(form);
form.data('NoticeFormSetup', true);
}
}, },
/** /**

2
js/util.min.js vendored

File diff suppressed because one or more lines are too long