mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-16 14:46:28 +02:00
[ticket/13713] Implement avatars
PHPBB3-13713
This commit is contained in:
@ -388,6 +388,11 @@ function getCaretPosition(txtarea) {
|
|||||||
function handle_mentions(txtarea) {
|
function handle_mentions(txtarea) {
|
||||||
$(txtarea).atwho({
|
$(txtarea).atwho({
|
||||||
at: "@",
|
at: "@",
|
||||||
|
displayTpl: function(data) {
|
||||||
|
var avatar = (data.avatar.src) ? "<img src='" + data.avatar.src + "'>" :
|
||||||
|
"<span class='mention-avatar'><i class='fa fa-" + data.avatar.type + "'></i></span>";
|
||||||
|
return "<li>" + avatar + "<span>" + data.name + "</span></li>";
|
||||||
|
},
|
||||||
insertTpl: "[mention ${param}=${id}]${name}[/mention]",
|
insertTpl: "[mention ${param}=${id}]${name}[/mention]",
|
||||||
callbacks: {
|
callbacks: {
|
||||||
remoteFilter: function(query, callback) {
|
remoteFilter: function(query, callback) {
|
||||||
|
@ -20,6 +20,7 @@ services:
|
|||||||
class: phpbb\mention\source\friend
|
class: phpbb\mention\source\friend
|
||||||
arguments:
|
arguments:
|
||||||
- '@dbal.conn'
|
- '@dbal.conn'
|
||||||
|
- '@user_loader'
|
||||||
- '@user'
|
- '@user'
|
||||||
tags:
|
tags:
|
||||||
- { name: mention.source }
|
- { name: mention.source }
|
||||||
@ -28,6 +29,7 @@ services:
|
|||||||
class: phpbb\mention\source\topic
|
class: phpbb\mention\source\topic
|
||||||
arguments:
|
arguments:
|
||||||
- '@dbal.conn'
|
- '@dbal.conn'
|
||||||
|
- '@user_loader'
|
||||||
tags:
|
tags:
|
||||||
- { name: mention.source }
|
- { name: mention.source }
|
||||||
|
|
||||||
|
@ -43,10 +43,10 @@ class mention
|
|||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
if (!$this->request->is_ajax())
|
// if (!$this->request->is_ajax())
|
||||||
{
|
// {
|
||||||
redirect(append_sid($this->phpbb_root_path . 'index.' . $this->php_ext));
|
// redirect(append_sid($this->phpbb_root_path . 'index.' . $this->php_ext));
|
||||||
}
|
// }
|
||||||
|
|
||||||
$keyword = $this->request->variable('keyword', '', true);
|
$keyword = $this->request->variable('keyword', '', true);
|
||||||
$topic_id = $this->request->variable('topic_id', 0);
|
$topic_id = $this->request->variable('topic_id', 0);
|
||||||
|
@ -21,11 +21,11 @@ class friend extends user
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user)
|
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader, \phpbb\user $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
||||||
parent::__construct($db);
|
parent::__construct($db, $user_loader);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,9 +94,13 @@ abstract class group implements source_interface
|
|||||||
foreach ($group_ids as $group_id)
|
foreach ($group_ids as $group_id)
|
||||||
{
|
{
|
||||||
$names['g' . $group_id] = [
|
$names['g' . $group_id] = [
|
||||||
'name' => $groups[$group_id]['group_name'],
|
'name' => $groups[$group_id]['group_name'],
|
||||||
'param' => 'group_id',
|
'param' => 'group_id',
|
||||||
'id' => $group_id,
|
'id' => $group_id,
|
||||||
|
'avatar' => [
|
||||||
|
'type' => 'group',
|
||||||
|
'src' => phpbb_get_group_avatar($groups[$group_id]),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,12 +18,16 @@ abstract class user implements source_interface
|
|||||||
/** @var \phpbb\db\driver\driver_interface */
|
/** @var \phpbb\db\driver\driver_interface */
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
|
/** @var \phpbb\user_loader */
|
||||||
|
protected $user_loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public function __construct(\phpbb\db\driver\driver_interface $db)
|
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
$this->user_loader = $user_loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,9 +51,13 @@ abstract class user implements source_interface
|
|||||||
while ($row = $this->db->sql_fetchrow($res))
|
while ($row = $this->db->sql_fetchrow($res))
|
||||||
{
|
{
|
||||||
$names['u' . $row['user_id']] = [
|
$names['u' . $row['user_id']] = [
|
||||||
'name' => $row['username'],
|
'name' => $row['username'],
|
||||||
'param' => 'user_id',
|
'param' => 'user_id',
|
||||||
'id' => $row['user_id'],
|
'id' => $row['user_id'],
|
||||||
|
'avatar' => [
|
||||||
|
'type' => 'user',
|
||||||
|
'src' => $this->user_loader->get_avatar($row['user_id'], true),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -930,6 +930,17 @@
|
|||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mention dropdown */
|
||||||
|
.atwho-container .atwho-view ul li {
|
||||||
|
padding-right: 45px;
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mention-avatar {
|
||||||
|
right: 8px;
|
||||||
|
left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
/* Search box
|
/* Search box
|
||||||
---------------------------------------- */
|
---------------------------------------- */
|
||||||
|
|
||||||
|
@ -983,6 +983,18 @@ fieldset.fields2 dl:hover dt label {
|
|||||||
outline-color: rgba(19, 164, 236, 0.5);
|
outline-color: rgba(19, 164, 236, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.atwho-container .atwho-view ul li:hover,
|
||||||
|
.atwho-container .atwho-view ul li.cur {
|
||||||
|
background-color: #0077b3;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mention-avatar {
|
||||||
|
background-color: #0077b3;
|
||||||
|
border-color: #ffffff;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
/* input field styles */
|
/* input field styles */
|
||||||
.inputbox {
|
.inputbox {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
|
@ -284,6 +284,33 @@ fieldset.submit-buttons input {
|
|||||||
margin: 3px;
|
margin: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mention dropdown */
|
||||||
|
.atwho-container .atwho-view {
|
||||||
|
font-size: 12px;
|
||||||
|
min-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.atwho-container .atwho-view ul li {
|
||||||
|
position: relative;
|
||||||
|
padding: 15px 5px 15px 45px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mention-avatar {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 30px;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 8px;
|
||||||
|
display: inline-block;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
margin-top: -15px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Input field styles
|
/* Input field styles
|
||||||
---------------------------------------- */
|
---------------------------------------- */
|
||||||
.inputbox {
|
.inputbox {
|
||||||
|
Reference in New Issue
Block a user