mirror of
https://github.com/humhub/humhub.git
synced 2025-02-23 10:48:43 +01:00
32 lines
936 B
JavaScript
32 lines
936 B
JavaScript
humhub.module('user.picker', function(module, require, $) {
|
|
var object = require('util').object;
|
|
var Picker = require('ui.picker').Picker;
|
|
|
|
var UserPicker = function(node, options) {
|
|
Picker.call(this, node, options);
|
|
};
|
|
|
|
object.inherits(UserPicker, Picker);
|
|
|
|
UserPicker.prototype.selectSelf = function() {
|
|
var userConfig = require('config').get('user');
|
|
if (userConfig && !userConfig.isGuest) {
|
|
this.select(userConfig.guid, userConfig.text, userConfig.image);
|
|
}
|
|
};
|
|
|
|
var actionSelectSelf = function(event) {
|
|
var picker = UserPicker.instance(event.$target);
|
|
if (picker instanceof UserPicker) {
|
|
picker.selectSelf();
|
|
} else {
|
|
module.log.error('Tried self select on non picker node!', true);
|
|
}
|
|
};
|
|
|
|
module.export({
|
|
UserPicker: UserPicker,
|
|
actionSelectSelf: actionSelectSelf
|
|
});
|
|
});
|