Start working a bit more consistently with "notice-options"
Let's get the AJAX response and present it to the user with the same mechanisms for all actions, instead of having a bunch of javascript for various circumstances (fave, repeat, delete should all be the same behaviour for example).
This commit is contained in:
parent
503c05b749
commit
6b147175bb
23
js/util.js
23
js/util.js
|
@ -575,6 +575,28 @@ var SN = { // StatusNet
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup function -- DOES NOT trigger actions immediately.
|
||||||
|
*
|
||||||
|
* Sets up event handlers on all visible notice's option <a> elements
|
||||||
|
* so they are called with AJAX enabled.
|
||||||
|
*
|
||||||
|
* (without javascript the link goes to a page that expects you to verify
|
||||||
|
* the action through a form)
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
NoticeOptionsAjax: function () {
|
||||||
|
$(document).on('click', '.notice-options > a', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var noticeEl = $(this).closest('.notice');
|
||||||
|
$.get($(this).attr('href'), {ajax: 1}, function (data, textStatus, xhr) {
|
||||||
|
noticeEl.replaceWith($('body', data).html());
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup function -- DOES NOT trigger actions immediately.
|
* Setup function -- DOES NOT trigger actions immediately.
|
||||||
*
|
*
|
||||||
|
@ -1446,6 +1468,7 @@ var SN = { // StatusNet
|
||||||
SN.U.NoticeRepeat();
|
SN.U.NoticeRepeat();
|
||||||
SN.U.NoticeReply();
|
SN.U.NoticeReply();
|
||||||
SN.U.NoticeInlineReplySetup();
|
SN.U.NoticeInlineReplySetup();
|
||||||
|
SN.U.NoticeOptionsAjax();
|
||||||
}
|
}
|
||||||
|
|
||||||
SN.U.NoticeAttachments();
|
SN.U.NoticeAttachments();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user