mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-16 21:34:25 +03:00
66 lines
1.6 KiB
JavaScript
66 lines
1.6 KiB
JavaScript
|
/**
|
||
|
* Приглашение пользователей в закрытый блог
|
||
|
*
|
||
|
* @module blog_invite_users
|
||
|
*
|
||
|
* @license GNU General Public License, version 2
|
||
|
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
|
||
|
* @author Denis Shakhov <denis.shakhov@gmail.com>
|
||
|
*/
|
||
|
|
||
|
(function($) {
|
||
|
"use strict";
|
||
|
|
||
|
$.widget( "livestreet.blog_invite_users", $.livestreet.user_list_add, {
|
||
|
/**
|
||
|
* Дефолтные опции
|
||
|
*/
|
||
|
options: {
|
||
|
urls: {
|
||
|
add: aRouter['blog'] + 'ajaxaddbloginvite/',
|
||
|
remove: aRouter['blog'] + 'ajaxremovebloginvite/',
|
||
|
reinvite: aRouter['blog'] + 'ajaxrebloginvite/'
|
||
|
},
|
||
|
selectors: {
|
||
|
// Кнопка повторного отправления инвайта
|
||
|
item_reinvite: '.js-blog-invite-user-repeat'
|
||
|
}
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* Конструктор
|
||
|
*
|
||
|
* @constructor
|
||
|
* @private
|
||
|
*/
|
||
|
_create: function () {
|
||
|
var _this = this;
|
||
|
|
||
|
this._super();
|
||
|
|
||
|
// Повторная отправка инвайта
|
||
|
this.elements.list.on('click', this.options.selectors.item_reinvite, function (e) {
|
||
|
_this.reinvite( $(this).data('user-id') );
|
||
|
e.preventDefault();
|
||
|
});
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* Отправляет инвайт заново
|
||
|
*/
|
||
|
reinvite: function (iUserId) {
|
||
|
var _this = this,
|
||
|
oParams = {
|
||
|
iUserId: iUserId
|
||
|
};
|
||
|
|
||
|
oParams = $.extend({}, oParams, this.options.params);
|
||
|
|
||
|
ls.ajax.load(this.options.urls.reinvite, oParams, function(oResponse) {
|
||
|
ls.msg.notice(null, oResponse.sMsg);
|
||
|
|
||
|
this._trigger("afterreinvite", null, { context: this, response: oResponse, oParams: oParams });
|
||
|
}.bind(this));
|
||
|
},
|
||
|
});
|
||
|
})(jQuery);
|