Browse Source

init feed actions block

main
ghost 3 years ago
parent
commit
0b3d0d65bc
  1. 22
      src/public/css/template/default/module/feed.css
  2. 21
      src/public/js/module/feed.js

22
src/public/css/template/default/module/feed.css

@ -8,7 +8,8 @@
color: #1c1d1e; color: #1c1d1e;
background: rgb(238, 238, 238); background: rgb(238, 238, 238);
border-radius: 3px; border-radius: 3px;
min-height: 84px; cursor: pointer;
/*min-height: 84px;*/
} }
.moduleFeed .item a, .moduleFeed .item a,
@ -65,6 +66,25 @@
color: #1c1d1e; color: #1c1d1e;
} }
.moduleFeed .item .actions {
opacity: 0;
text-align: right;
margin-top: 8px
}
.moduleFeed .item:hover .actions {
opacity: 1
}
.moduleFeed .item .actions span {
cursor: pointer;
margin-left: 8px;
color: #5b646f
}
.moduleFeed .item .actions span:hover {
color: #1c1d1e
}
.moduleFeed .loadMore { .moduleFeed .loadMore {
width: 100%; width: 100%;
margin: 8px 0; margin: 8px 0;

21
src/public/js/module/feed.js

@ -29,7 +29,8 @@ var ModuleFeed = {
$(feed).append( $(feed).append(
$('<div/>', { $('<div/>', {
'class': 'item', 'class': 'item',
'data-username': item.userName, 'data-user-name': item.userName,
'data-meta': item.meta
}).append( }).append(
$('<div/>', { $('<div/>', {
'class': 'avatar' 'class': 'avatar'
@ -65,6 +66,22 @@ var ModuleFeed = {
'class': (item.message != '' ? 'quote' : '') 'class': (item.message != '' ? 'quote' : '')
}).append(item.message) }).append(item.message)
) )
).append(
$('<div/>', {
'class': 'actions'
}).append(
$('<span/>', {
'class': 'bi bi-reply-fill',
'title': 'Reply',
'onclick': 'ModuleFeed.reply($(this).closest(\'.item\').data(\'meta\'))'
})
).append(
$('<span/>', {
'class': 'bi bi-quote',
'title': 'Quote',
'onclick': 'ModuleFeed.retwist($(this).closest(\'.item\').data(\'meta\'))'
})
)
) )
); );
} }
@ -83,7 +100,7 @@ var ModuleFeed = {
if (response.success) { if (response.success) {
if (response.avatar) { if (response.avatar) {
$(feed).find('div[data-username="' + userName + '"] .avatar img').attr('src', response.avatar).show(); $(feed).find('div[data-user-name="' + userName + '"] .avatar img').attr('src', response.avatar).show();
} }
} else { } else {

Loading…
Cancel
Save