Merge branch '1.0.x' into profile-fixups
This commit is contained in:
commit
3bbe481695
32
js/util.js
32
js/util.js
@ -228,6 +228,9 @@ var SN = { // StatusNet
|
|||||||
* will be extracted and copied in, replacing the original form.
|
* will be extracted and copied in, replacing the original form.
|
||||||
* If there's no form, the first paragraph will be used.
|
* If there's no form, the first paragraph will be used.
|
||||||
*
|
*
|
||||||
|
* This will automatically be applied on the 'submit' event for
|
||||||
|
* any form with the 'ajax' class.
|
||||||
|
*
|
||||||
* @fixme can sometimes explode confusingly if returnd data is bogus
|
* @fixme can sometimes explode confusingly if returnd data is bogus
|
||||||
* @fixme error handling is pretty vague
|
* @fixme error handling is pretty vague
|
||||||
* @fixme can't submit file uploads
|
* @fixme can't submit file uploads
|
||||||
@ -633,17 +636,6 @@ var SN = { // StatusNet
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup function -- DOES NOT apply immediately.
|
|
||||||
*
|
|
||||||
* Sets up event handlers for favor/disfavor forms to submit via XHR.
|
|
||||||
* Uses 'live' rather than 'bind', so applies to future as well as present items.
|
|
||||||
*/
|
|
||||||
NoticeFavor: function() {
|
|
||||||
$('.form_favor').live('click', function() { SN.U.FormXHR($(this)); return false; });
|
|
||||||
$('.form_disfavor').live('click', function() { SN.U.FormXHR($(this)); return false; });
|
|
||||||
},
|
|
||||||
|
|
||||||
NoticeInlineReplyPlaceholder: function(notice) {
|
NoticeInlineReplyPlaceholder: function(notice) {
|
||||||
var list = notice.find('ul.threaded-replies');
|
var list = notice.find('ul.threaded-replies');
|
||||||
var placeholder = $('<li class="notice-reply-placeholder">' +
|
var placeholder = $('<li class="notice-reply-placeholder">' +
|
||||||
@ -1331,7 +1323,6 @@ var SN = { // StatusNet
|
|||||||
if (masterForm.length > 0) {
|
if (masterForm.length > 0) {
|
||||||
SN.C.I.NoticeFormMaster = document._importNode(masterForm[0], true);
|
SN.C.I.NoticeFormMaster = document._importNode(masterForm[0], true);
|
||||||
}
|
}
|
||||||
SN.U.NoticeFavor();
|
|
||||||
SN.U.NoticeRepeat();
|
SN.U.NoticeRepeat();
|
||||||
SN.U.NoticeReply();
|
SN.U.NoticeReply();
|
||||||
SN.U.NoticeInlineReplySetup();
|
SN.U.NoticeInlineReplySetup();
|
||||||
@ -1348,12 +1339,6 @@ var SN = { // StatusNet
|
|||||||
*/
|
*/
|
||||||
EntityActions: function() {
|
EntityActions: function() {
|
||||||
if ($('body.user_in').length > 0) {
|
if ($('body.user_in').length > 0) {
|
||||||
$('.form_user_subscribe').live('click', function() { SN.U.FormXHR($(this)); return false; });
|
|
||||||
$('.form_user_unsubscribe').live('click', function() { SN.U.FormXHR($(this)); return false; });
|
|
||||||
$('.form_group_join').live('click', function() { SN.U.FormXHR($(this)); return false; });
|
|
||||||
$('.form_group_leave').live('click', function() { SN.U.FormXHR($(this)); return false; });
|
|
||||||
$('.form_user_nudge').live('click', function() { SN.U.FormXHR($(this)); return false; });
|
|
||||||
|
|
||||||
SN.U.NewDirectMessage();
|
SN.U.NewDirectMessage();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1380,6 +1365,16 @@ var SN = { // StatusNet
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up any generic 'ajax' form so it submits via AJAX with auto-replacement.
|
||||||
|
*/
|
||||||
|
AjaxForms: function() {
|
||||||
|
$('form.ajax').live('submit', function() {
|
||||||
|
SN.U.FormXHR($(this));
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add logic to any file upload forms to handle file size limits,
|
* Add logic to any file upload forms to handle file size limits,
|
||||||
* on browsers that support basic FileAPI.
|
* on browsers that support basic FileAPI.
|
||||||
@ -1416,6 +1411,7 @@ var SN = { // StatusNet
|
|||||||
* don't start them loading until after DOM-ready time!
|
* don't start them loading until after DOM-ready time!
|
||||||
*/
|
*/
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
SN.Init.AjaxForms();
|
||||||
SN.Init.UploadForms();
|
SN.Init.UploadForms();
|
||||||
if ($('.'+SN.C.S.FormNotice).length > 0) {
|
if ($('.'+SN.C.S.FormNotice).length > 0) {
|
||||||
SN.Init.NoticeForm();
|
SN.Init.NoticeForm();
|
||||||
|
2
js/util.min.js
vendored
2
js/util.min.js
vendored
File diff suppressed because one or more lines are too long
@ -147,6 +147,6 @@ class DisfavorForm extends Form
|
|||||||
*/
|
*/
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_disfavor';
|
return 'form_disfavor ajax';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,6 +146,6 @@ class FavorForm extends Form
|
|||||||
*/
|
*/
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_favor';
|
return 'form_favor ajax';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,13 @@ class Form extends Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class of the form.
|
* Class of the form. May include space-separated list of multiple classes.
|
||||||
|
*
|
||||||
|
* If 'ajax' is included, the form will automatically be submitted with
|
||||||
|
* an 'ajax=1' parameter added, and the resulting form or error message
|
||||||
|
* will replace the form after submission.
|
||||||
|
*
|
||||||
|
* It's up to you to make sure that the target action supports this!
|
||||||
*
|
*
|
||||||
* @return string the form's class
|
* @return string the form's class
|
||||||
*/
|
*/
|
||||||
|
@ -88,7 +88,7 @@ class JoinForm extends Form
|
|||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_group_join';
|
return 'form_group_join ajax';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +88,7 @@ class LeaveForm extends Form
|
|||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_group_leave';
|
return 'form_group_leave ajax';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,7 +89,7 @@ class NudgeForm extends Form
|
|||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_user_nudge';
|
return 'form_user_nudge ajax';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class SubscribeForm extends Form
|
|||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_user_subscribe';
|
return 'form_user_subscribe ajax';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class UnsubscribeForm extends Form
|
|||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_user_unsubscribe';
|
return 'form_user_unsubscribe ajax';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,7 +83,7 @@ class PollResponseForm extends Form
|
|||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings ajax';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,7 +83,7 @@ class PollResultForm extends Form
|
|||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings ajax';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -145,7 +145,22 @@ class RespondPollAction extends Action
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
common_redirect($this->poll->bestUrl(), 303);
|
if ($this->arg('ajax')) {
|
||||||
|
header('Content-Type: text/xml;charset=utf-8');
|
||||||
|
$this->xw->startDocument('1.0', 'UTF-8');
|
||||||
|
$this->elementStart('html');
|
||||||
|
$this->elementStart('head');
|
||||||
|
// TRANS: Page title after sending a poll response.
|
||||||
|
$this->element('title', null, _m('Poll results'));
|
||||||
|
$this->elementEnd('head');
|
||||||
|
$this->elementStart('body');
|
||||||
|
$form = new PollResultForm($this->poll, $this);
|
||||||
|
$form->show();
|
||||||
|
$this->elementEnd('body');
|
||||||
|
$this->elementEnd('html');
|
||||||
|
} else {
|
||||||
|
common_redirect($this->poll->bestUrl(), 303);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -180,21 +180,6 @@ class UserFlagPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize any flagging buttons on the page
|
|
||||||
*
|
|
||||||
* @param Action $action action being shown
|
|
||||||
*
|
|
||||||
* @return boolean hook result
|
|
||||||
*/
|
|
||||||
function onEndShowScripts($action)
|
|
||||||
{
|
|
||||||
$action->inlineScript('if ($(".form_entity_flag").length > 0) { '.
|
|
||||||
'$(".form_entity_flag").bind("click", function() {'.
|
|
||||||
'SN.U.FormXHR($(this)); return false; }); }');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether a user has one of our defined rights
|
* Check whether a user has one of our defined rights
|
||||||
*
|
*
|
||||||
|
@ -54,7 +54,7 @@ class FlagProfileForm extends ProfileActionForm
|
|||||||
*/
|
*/
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_entity_flag';
|
return 'form_entity_flag ajax';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user