FEATURE: add collapse button

This commit is contained in:
Arpit Jalan 2018-01-16 00:59:46 +05:30
parent fe907aaf74
commit 6fff16a999
2 changed files with 21 additions and 4 deletions

View File

@ -299,9 +299,17 @@ createWidget('post-contents', {
const repliesBelow = state.repliesBelow;
if (repliesBelow.length) {
result.push(h('section.embedded-posts.bottom', repliesBelow.map(p => {
return this.attach('embedded-post', p, { model: this.store.createRecord('post', p) });
})));
result.push(h('section.embedded-posts.bottom', [
this.attach('button', {
title: 'post.collapse',
icon: 'chevron-up',
action: 'toggleRepliesBelow',
className: 'btn collapse-up'
}),
repliesBelow.map(p => {
return this.attach('embedded-post', p, { model: this.store.createRecord('post', p) });
})
]));
}
return result;
@ -376,7 +384,15 @@ createWidget('post-article', {
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)]));

View File

@ -1897,6 +1897,7 @@ en:
deleted_by_author:
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)"
collapse: "collapse"
expand_collapse: "expand/collapse"
gap:
one: "view 1 hidden reply"