1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-02 22:45:02 +03:00
ifhub.club/application/frontend/common/js/blog_invite_users.js

61 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.eventNamespace, this.options.selectors.item_reinvite, function (e) {
_this.reinvite( $(this).data('user-id') );
e.preventDefault();
});
},
/**
* Отправляет инвайт заново
*/
reinvite: function (iUserId) {
var oParams = $.extend({}, { iUserId: iUserId }, 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);