Merge branch 'embedded-posts'

This commit is contained in:
Arpit Jalan 2018-01-19 12:54:34 +05:30
commit 73dea4e7eb
5 changed files with 66 additions and 11 deletions

View File

@ -299,9 +299,17 @@ createWidget('post-contents', {
const repliesBelow = state.repliesBelow; const repliesBelow = state.repliesBelow;
if (repliesBelow.length) { if (repliesBelow.length) {
result.push(h('section.embedded-posts.bottom', repliesBelow.map(p => { result.push(h('section.embedded-posts.bottom', [
repliesBelow.map(p => {
return this.attach('embedded-post', p, { model: this.store.createRecord('post', p) }); return this.attach('embedded-post', p, { model: this.store.createRecord('post', p) });
}))); }),
this.attach('button', {
title: 'post.collapse',
icon: 'chevron-up',
action: 'toggleRepliesBelow',
className: 'btn collapse-up'
})
]));
} }
return result; return result;
@ -376,7 +384,15 @@ createWidget('post-article', {
return this.attach('embedded-post', p, { model: this.store.createRecord('post', p), state: { above: true } }); return this.attach('embedded-post', p, { model: this.store.createRecord('post', p), state: { above: true } });
}); });
rows.push(h('div.row', h('section.embedded-posts.top.topic-body.offset2', replies))); rows.push(h('div.row', h('section.embedded-posts.top.topic-body.offset2', [
this.attach('button', {
title: 'post.collapse',
icon: 'chevron-down',
action: 'toggleReplyAbove',
className: 'btn collapse-down'
}),
replies
])));
} }
rows.push(h('div.row', [this.attach('post-avatar', attrs), this.attach('post-body', attrs)])); rows.push(h('div.row', [this.attach('post-avatar', attrs), this.attach('post-body', attrs)]));

View File

@ -433,7 +433,7 @@ blockquote > *:last-child {
} }
.small-action-desc { .small-action-desc {
padding: 1em 1em 1.25em 1em; padding: 1em;
text-transform: uppercase; text-transform: uppercase;
font-weight: bold; font-weight: bold;
font-size: $font-down-1; font-size: $font-down-1;

View File

@ -207,7 +207,7 @@ nav.post-controls {
.topic-body { .topic-body {
box-sizing: border-box; box-sizing: border-box;
width: calc(100% - 60px); // [100% - .topic-avatar width] width: calc(100% - 70px); // [100% - .topic-avatar width]
// WARNING: overflow hide is required for quoted / embedded images // WARNING: overflow hide is required for quoted / embedded images
// which expect "normal" post width, but expansions are narrower // which expect "normal" post width, but expansions are narrower
overflow: hidden; overflow: hidden;
@ -221,10 +221,27 @@ nav.post-controls {
} }
.topic-avatar { .topic-avatar {
padding-left: 15px; padding-left: 25px;
padding-top: 15px; padding-top: 15px;
} }
.row {
border: 1px solid $primary-low;
}
.collapse-down, .collapse-up {
position: absolute;
color: $primary-medium;
background: $secondary;
border: 1px solid $primary-low;
padding: 6px 9px 8px;
z-index: 99; // Needs to be higher than topic-avatar
&:hover {
background: $primary-low;
color: $primary;
}
}
// bottom means "reply expansion" below a post // bottom means "reply expansion" below a post
&.bottom { &.bottom {
&.hidden { &.hidden {
@ -233,15 +250,32 @@ nav.post-controls {
} }
} }
&.bottom { &.bottom {
.collapse-up {
transform: translate(-50%, -164%);
}
.row { .row {
padding-top: 7px; padding-bottom: .5em;
border-top: none;
border-bottom: none;
.topic-avatar, .topic-body {
border-top: 1px solid $primary-low;
}
} }
} }
// top means "in reply to expansion" above a post // top means "in reply to expansion" above a post
&.top { &.top {
.collapse-down {
transform: translate(-50%, 55%);
}
margin-left: 56px; margin-left: 56px;
width: 701px; width: 701px;
.row {
border-bottom: none;
.topic-avatar, .topic-body {
border-top: 1px solid $primary-low;
}
}
} }
&.top.topic-body { &.top.topic-body {
padding: 0; padding: 0;
@ -615,7 +649,7 @@ $topic-avatar-width: 45px;
position: relative; position: relative;
z-index: z("base"); z-index: z("base");
border-top: 1px solid $primary-low; border-top: 1px solid $primary-low;
padding: 12px $topic-body-width-padding 15px $topic-body-width-padding; padding: 12px $topic-body-width-padding 0 $topic-body-width-padding;
} }
.topic-avatar { .topic-avatar {
@ -636,6 +670,11 @@ $topic-avatar-width: 45px;
border-top: none; border-top: none;
} }
.time-gap + .topic-post .embedded-posts.top {
border-bottom: 1px solid $primary-low;
}
.posts-wrapper { .posts-wrapper {
position: relative; position: relative;
-webkit-font-smoothing: subpixel-antialiased; -webkit-font-smoothing: subpixel-antialiased;

View File

@ -10,8 +10,7 @@
} }
.post-menu-area { .post-menu-area {
margin-bottom: 10px; margin: 20px 0;
margin-top: 20px;
} }
.edits {margin-right: 5px;} .edits {margin-right: 5px;}

View File

@ -1897,6 +1897,7 @@ en:
deleted_by_author: deleted_by_author:
one: "(post withdrawn by author, will be automatically deleted in %{count} hour unless flagged)" one: "(post withdrawn by author, will be automatically deleted in %{count} hour unless flagged)"
other: "(post withdrawn by author, will be automatically deleted in %{count} hours unless flagged)" other: "(post withdrawn by author, will be automatically deleted in %{count} hours unless flagged)"
collapse: "collapse"
expand_collapse: "expand/collapse" expand_collapse: "expand/collapse"
gap: gap:
one: "view 1 hidden reply" one: "view 1 hidden reply"