mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 05:23:17 +00:00
Merge pull request #188 from dansup/frontend-ui-refactor
Fix pagination bug for like and comment events
This commit is contained in:
commit
d603cb2a36
8 changed files with 12 additions and 7 deletions
|
@ -24,7 +24,7 @@ class ApiController extends Controller
|
||||||
|
|
||||||
$likes = Like::whereProfileId($profile->id)
|
$likes = Like::whereProfileId($profile->id)
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->take(100)
|
->take(1000)
|
||||||
->pluck('status_id');
|
->pluck('status_id');
|
||||||
|
|
||||||
return response()->json($likes);
|
return response()->json($likes);
|
||||||
|
|
BIN
public/js/app.js
vendored
BIN
public/js/app.js
vendored
Binary file not shown.
BIN
public/js/timeline.js
vendored
BIN
public/js/timeline.js
vendored
Binary file not shown.
Binary file not shown.
1
resources/assets/js/bootstrap.js
vendored
1
resources/assets/js/bootstrap.js
vendored
|
@ -9,6 +9,7 @@ window.Popper = require('popper.js').default;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
window.pixelfed = {};
|
||||||
window.$ = window.jQuery = require('jquery');
|
window.$ = window.jQuery = require('jquery');
|
||||||
require('bootstrap');
|
require('bootstrap');
|
||||||
window.InfiniteScroll = require('infinite-scroll');
|
window.InfiniteScroll = require('infinite-scroll');
|
||||||
|
|
|
@ -5,7 +5,7 @@ $(document).ready(function() {
|
||||||
el.focus();
|
el.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.comment-form').submit(function(e, data) {
|
$(document).on('submit', '.comment-form', function(e, data) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
let el = $(this);
|
let el = $(this);
|
||||||
|
|
9
resources/assets/js/components/likebutton.js
vendored
9
resources/assets/js/components/likebutton.js
vendored
|
@ -11,9 +11,8 @@ $(document).ready(function() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
hydrateLikes();
|
|
||||||
|
|
||||||
function hydrateLikes() {
|
pixelfed.hydrateLikes = function() {
|
||||||
var likes = ls.get('likes');
|
var likes = ls.get('likes');
|
||||||
$('.like-form').each(function(i, el) {
|
$('.like-form').each(function(i, el) {
|
||||||
var el = $(el);
|
var el = $(el);
|
||||||
|
@ -24,9 +23,11 @@ $(document).ready(function() {
|
||||||
heart.addClass('fas fa-heart').removeClass('far fa-heart');
|
heart.addClass('fas fa-heart').removeClass('far fa-heart');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
$('.like-form').submit(function(e) {
|
pixelfed.hydrateLikes();
|
||||||
|
|
||||||
|
$(document).on('submit', '.like-form', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var el = $(this);
|
var el = $(this);
|
||||||
var id = el.data('id');
|
var id = el.data('id');
|
||||||
|
|
3
resources/assets/js/timeline.js
vendored
3
resources/assets/js/timeline.js
vendored
|
@ -6,4 +6,7 @@ $(document).ready(function() {
|
||||||
append: '.timeline-feed',
|
append: '.timeline-feed',
|
||||||
history: false,
|
history: false,
|
||||||
});
|
});
|
||||||
|
infScroll.on( 'append', function( response, path, items ) {
|
||||||
|
pixelfed.hydrateLikes();
|
||||||
|
});
|
||||||
});
|
});
|
Loading…
Reference in a new issue