A platform for community discussion. Free, open, simple.
FEATURE: add collapse button
Arpit Jalan6fff16a9993c
diff --git a/app/assets/javascripts/discourse/widgets/post.js.es6 b/app/assets/javascripts/discourse/widgets/post.js.es6index 427b7c3baef..5e671ec56d4 100644--- a/app/assets/javascripts/discourse/widgets/post.js.es6+++ b/app/assets/javascripts/discourse/widgets/post.js.es6@@ -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)]));diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex ede17d1af9b..d0d7d622c32 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -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"