Reply notice forms are functional again, but not AJAX

This commit is contained in:
Mikael Nordfeldth 2015-03-06 21:20:46 +01:00
parent 8abc2d3b8d
commit 45861c6d9c
2 changed files with 31 additions and 35 deletions

View File

@ -661,14 +661,8 @@ var SN = { // StatusNet
} }
}; };
// See if the form's already open...
replyForm = $('.notice-reply-form', list);
if (replyForm.length > 0) {
// Update the existing form...
nextStep();
} else {
// Create the reply form entry at the end // Create the reply form entry at the end
var replyItem = $('li.notice-reply > form', list); var replyItem = $('li.notice-reply', list);
if (replyItem.length == 0) { if (replyItem.length == 0) {
replyItem = $('<li class="notice-reply"></li>'); replyItem = $('<li class="notice-reply"></li>');
@ -687,15 +681,12 @@ var SN = { // StatusNet
// We've already saved a master copy of the form. // We've already saved a master copy of the form.
// Clone it in! // Clone it in!
intermediateStep(SN.C.I.NoticeFormMaster); intermediateStep(SN.C.I.NoticeFormMaster);
} else {
// Fetch a fresh copy of the notice form over AJAX.
// Warning: this can have a delay, which looks bad.
// @fixme this fallback may or may not work
var url = $('#form_notice').attr('action');
$.get(url, {ajax: 1}, function (data, textStatus, xhr) {
intermediateStep($('form', data)[0]);
});
} }
} else {
replyItem.show();
replyTextarea = replyItem.find('textarea');
if (replyTextarea) {
replyTextarea.focus();
} }
} }
}, },
@ -706,6 +697,7 @@ var SN = { // StatusNet
* Uses 'on' rather than 'live' or 'bind', so applies to future as well as present items. * Uses 'on' rather than 'live' or 'bind', so applies to future as well as present items.
*/ */
NoticeInlineReplySetup: function () { NoticeInlineReplySetup: function () {
$('#content .notice-reply').hide();
// Expand conversation links // Expand conversation links
$(document).on('click', 'li.notice-reply-comments a', function () { $(document).on('click', 'li.notice-reply-comments a', function () {
var url = $(this).attr('href'); var url = $(this).attr('href');
@ -1418,7 +1410,7 @@ var SN = { // StatusNet
// Only close if there's been no edit. // Only close if there's been no edit.
if (cur == '' || cur == textarea.data('initialText')) { if (cur == '' || cur == textarea.data('initialText')) {
var parentNotice = replyItem.closest('li.notice'); var parentNotice = replyItem.closest('li.notice');
replyItem.remove(); replyItem.hide();
parentNotice.find('li.notice-reply-placeholder').show(); parentNotice.find('li.notice-reply-placeholder').show();
} }
} }

View File

@ -79,6 +79,10 @@ option {
padding-bottom: 0px; padding-bottom: 0px;
} }
.hidden {
display: none;
}
#wrap { #wrap {
position: relative; position: relative;
width: 960px; width: 960px;