Quick reply option
parent
b170b1c87c
commit
41d7ec3c0c
@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
/*globals $, app, ajaxify, socket*/
|
||||
|
||||
define('persona/quickreply', ['components'], function(components) {
|
||||
var QuickReply = {};
|
||||
|
||||
QuickReply.init = function() {
|
||||
|
||||
var element = components.get('topic/quickreply/text');
|
||||
var data = {
|
||||
element: element,
|
||||
strategies: [],
|
||||
options: {
|
||||
zIndex: 100,
|
||||
listPosition: function(position) {
|
||||
this.$el.css(this._applyPlacement(position));
|
||||
this.$el.css('position', 'absolute');
|
||||
return this;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$(window).trigger('composer:autocomplete:init', data);
|
||||
data.element.textcomplete(data.strategies, data.options);
|
||||
$('.textcomplete-wrapper').css('height', '100%').find('textarea').css('height', '100%');
|
||||
|
||||
components.get('topic/quickreply/button').on('click', function(e) {
|
||||
var replyMsg = components.get('topic/quickreply/text').val();
|
||||
var replyData = {
|
||||
tid: ajaxify.data.tid,
|
||||
handle: undefined,
|
||||
content: replyMsg
|
||||
};
|
||||
|
||||
socket.emit('posts.reply', replyData, function(err, data) {
|
||||
if (err) {
|
||||
app.alertError(err.message);
|
||||
}
|
||||
|
||||
components.get('topic/quickreply/text').val('');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return QuickReply;
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
<!-- IF loggedIn -->
|
||||
<div class="clearfix quick-reply">
|
||||
<div class="icon pull-left hidden-xs">
|
||||
<a href="<!-- IF posts.user.userslug -->{config.relative_path}/user/{posts.user.userslug}<!-- ELSE -->#<!-- ENDIF posts.user.userslug -->">
|
||||
<!-- IF loggedInUser.picture -->
|
||||
<img component="user/picture" data-uid="{loggedInUser.uid}" src="{loggedInUser.picture}" align="left" itemprop="image" />
|
||||
<!-- ELSE -->
|
||||
<div component="user/picture" data-uid="{loggedInUser.uid}" class="user-icon" style="background-color: {loggedInUser.icon:bgColor};">{loggedInUser.icon:text}</div>
|
||||
<!-- ENDIF loggedInUser.picture -->
|
||||
<i component="user/status" class="fa fa-circle status {loggedInUser.status}" title="[[global:{loggedInUser.status}]]"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="quickreply-message">
|
||||
<textarea component="topic/quickreply/text" class="form-control" rows="5"></textarea>
|
||||
</div>
|
||||
<button component="topic/quickreply/button" class="btn btn-primary pull-right">Post quick reply</button>
|
||||
</div>
|
||||
<!-- ENDIF loggedIn -->
|
Loading…
Reference in New Issue