FIX: The dom was slightly incorrect, messing up mobile rendering
This commit is contained in:
parent
5af834b6d0
commit
05377c62de
|
@ -224,8 +224,12 @@ createWidget('expand-post-button', {
|
||||||
createWidget('post-contents', {
|
createWidget('post-contents', {
|
||||||
buildKey: attrs => `post-contents-${attrs.id}`,
|
buildKey: attrs => `post-contents-${attrs.id}`,
|
||||||
|
|
||||||
|
defaultState() {
|
||||||
|
return { expandedFirstPost: false, repliesBelow: [] };
|
||||||
|
},
|
||||||
|
|
||||||
buildClasses(attrs) {
|
buildClasses(attrs) {
|
||||||
const classes = [];
|
const classes = ['regular'];
|
||||||
if (!this.state.repliesShown) {
|
if (!this.state.repliesShown) {
|
||||||
classes.push('contents');
|
classes.push('contents');
|
||||||
}
|
}
|
||||||
|
@ -235,43 +239,23 @@ createWidget('post-contents', {
|
||||||
return classes;
|
return classes;
|
||||||
},
|
},
|
||||||
|
|
||||||
html(attrs) {
|
|
||||||
return new PostCooked(attrs);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
createWidget('post-body', {
|
|
||||||
tagName: 'div.topic-body',
|
|
||||||
buildKey: attrs => `topic-body-${attrs.id}`,
|
|
||||||
|
|
||||||
defaultState() {
|
|
||||||
return { expandedFirstPost: false, repliesBelow: [] };
|
|
||||||
},
|
|
||||||
|
|
||||||
html(attrs, state) {
|
html(attrs, state) {
|
||||||
const extraState = { state: { repliesShown: !!state.repliesBelow.length } };
|
const result = [new PostCooked(attrs)];
|
||||||
const regular = [this.attach('post-contents', attrs, extraState)];
|
|
||||||
|
|
||||||
if (attrs.cooked_hidden) {
|
if (attrs.cooked_hidden) {
|
||||||
regular.push(this.attach('expand-hidden', attrs));
|
result.push(this.attach('expand-hidden', attrs));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!state.expandedFirstPost && attrs.expandablePost) {
|
if (!state.expandedFirstPost && attrs.expandablePost) {
|
||||||
regular.push(this.attach('expand-post-button', attrs));
|
result.push(this.attach('expand-post-button', attrs));
|
||||||
}
|
}
|
||||||
|
|
||||||
regular.push(this.attach('post-menu', attrs, extraState));
|
const extraState = { state: { repliesShown: !!state.repliesBelow.length } };
|
||||||
|
result.push(this.attach('post-menu', attrs, extraState));
|
||||||
|
|
||||||
const repliesBelow = state.repliesBelow;
|
const repliesBelow = state.repliesBelow;
|
||||||
if (repliesBelow.length) {
|
if (repliesBelow.length) {
|
||||||
regular.push(h('section.embedded-posts.bottom',
|
result.push(h('section.embedded-posts.bottom', repliesBelow.map(p => this.attach('embedded-post', p))));
|
||||||
repliesBelow.map(p => this.attach('embedded-post', p))));
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = [this.attach('post-meta-data', attrs), h('div.regular', regular)];
|
|
||||||
result.push(this.attach('actions-summary', attrs));
|
|
||||||
if (attrs.showTopicMap) {
|
|
||||||
result.push(this.attach('topic-map', attrs));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -294,6 +278,22 @@ createWidget('post-body', {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
createWidget('post-body', {
|
||||||
|
tagName: 'div.topic-body',
|
||||||
|
|
||||||
|
html(attrs) {
|
||||||
|
const postContents = this.attach('post-contents', attrs);
|
||||||
|
const result = [this.attach('post-meta-data', attrs), postContents];
|
||||||
|
|
||||||
|
result.push(this.attach('actions-summary', attrs));
|
||||||
|
if (attrs.showTopicMap) {
|
||||||
|
result.push(this.attach('topic-map', attrs));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
createWidget('post-article', {
|
createWidget('post-article', {
|
||||||
tagName: 'article.boxed.onscreen-post',
|
tagName: 'article.boxed.onscreen-post',
|
||||||
buildKey: attrs => `post-article-${attrs.id}`,
|
buildKey: attrs => `post-article-${attrs.id}`,
|
||||||
|
|
Loading…
Reference in New Issue