mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
Removed unused "active" handling in <GhPostListItem>
no issue - "active" post list items no longer exist so we can remove the code related to handling the scroll-into-view and style changes
This commit is contained in:
parent
2500cd9064
commit
9eb9e9f00e
@ -10,14 +10,8 @@ export default Component.extend({
|
||||
|
||||
tagName: 'li',
|
||||
classNames: ['gh-list-row', 'gh-posts-list-item'],
|
||||
classNameBindings: ['active'],
|
||||
|
||||
post: null,
|
||||
active: false,
|
||||
|
||||
// closure actions
|
||||
onClick() {},
|
||||
onDoubleClick() {},
|
||||
|
||||
isFeatured: alias('post.featured'),
|
||||
isPage: alias('post.page'),
|
||||
@ -47,42 +41,5 @@ export default Component.extend({
|
||||
} else {
|
||||
return `${text.slice(0, 80)}...`;
|
||||
}
|
||||
}),
|
||||
|
||||
didReceiveAttrs() {
|
||||
if (this.active) {
|
||||
this.scrollIntoView();
|
||||
}
|
||||
},
|
||||
|
||||
click() {
|
||||
this.onClick(this.post);
|
||||
},
|
||||
|
||||
doubleClick() {
|
||||
this.onDoubleClick(this.post);
|
||||
},
|
||||
|
||||
scrollIntoView() {
|
||||
let element = this.$();
|
||||
let offset = element.offset().top;
|
||||
let elementHeight = element.height();
|
||||
let container = $('.content-list');
|
||||
let containerHeight = container.height();
|
||||
let currentScroll = container.scrollTop();
|
||||
let isBelowTop, isAboveBottom, isOnScreen;
|
||||
|
||||
isAboveBottom = offset < containerHeight;
|
||||
isBelowTop = offset > elementHeight;
|
||||
|
||||
isOnScreen = isBelowTop && isAboveBottom;
|
||||
|
||||
if (!isOnScreen) {
|
||||
// Scroll so that element is centered in container
|
||||
// 40 is the amount of padding on the container
|
||||
container.clearQueue().animate({
|
||||
scrollTop: currentScroll + offset - 40 - containerHeight / 2
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
@ -359,12 +359,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 901px) {
|
||||
.content-list .active a {
|
||||
box-shadow: var(--blue) 3px 0 0 inset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Empty State
|
||||
/* ---------------------------------------------------------- */
|
||||
|
@ -96,7 +96,6 @@
|
||||
{{#each postsInfinityModel as |page|}}
|
||||
{{gh-posts-list-item
|
||||
post=page
|
||||
onDoubleClick=(action "openEditor")
|
||||
data-test-page-id=page.id}}
|
||||
{{else}}
|
||||
<li class="no-posts-box">
|
||||
|
@ -96,7 +96,6 @@
|
||||
{{#each postsInfinityModel as |post|}}
|
||||
{{gh-posts-list-item
|
||||
post=post
|
||||
onDoubleClick=(action "openEditor")
|
||||
data-test-post-id=post.id}}
|
||||
{{else}}
|
||||
<li class="no-posts-box">
|
||||
|
Loading…
Reference in New Issue
Block a user