mirror of
https://github.com/flarum/core.git
synced 2025-07-29 04:30:56 +02:00
committed by
GitHub
parent
300015927f
commit
f23a3833fa
@@ -20,23 +20,12 @@ extend(ForumApplication.prototype, 'mount', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m.route.mode = 'pathname';
|
override(m.route.Link, 'view', function (original, vnode) {
|
||||||
|
vnode.attrs.href = vnode.attrs.href.replace('/embed', '/d');
|
||||||
override(m, 'route', function(original, root, arg1, arg2, vdom) {
|
vnode.attrs.target = '_blank';
|
||||||
if (arguments.length === 1) {
|
|
||||||
|
|
||||||
} else if (arguments.length === 4 && typeof arg1 === 'string') {
|
|
||||||
|
|
||||||
} else if (root.addEventListener || root.attachEvent) {
|
|
||||||
root.href = vdom.attrs.href.replace('/embed', '/d');
|
|
||||||
root.target = '_blank';
|
|
||||||
|
|
||||||
// TODO: If href leads to a post within this discussion that we have
|
// TODO: If href leads to a post within this discussion that we have
|
||||||
// already loaded, then scroll to it?
|
// already loaded, then scroll to it?
|
||||||
return;
|
return original(vnode);
|
||||||
}
|
|
||||||
|
|
||||||
return original.apply(this, Array.prototype.slice.call(arguments, 1));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Trim the /embed prefix off of post permalinks
|
// Trim the /embed prefix off of post permalinks
|
||||||
@@ -44,7 +33,7 @@ override(PostMeta.prototype, 'getPermalink', (original, post) => {
|
|||||||
return original(post).replace('/embed', '/d');
|
return original(post).replace('/embed', '/d');
|
||||||
});
|
});
|
||||||
|
|
||||||
app.pageInfo = m.prop({});
|
app.pageInfo = m.stream({});
|
||||||
|
|
||||||
const reposition = function() {
|
const reposition = function() {
|
||||||
const info = app.pageInfo();
|
const info = app.pageInfo();
|
||||||
@@ -73,16 +62,15 @@ extend(DiscussionPage.prototype, 'sidebarItems', function(items) {
|
|||||||
const count = this.discussion.replyCount();
|
const count = this.discussion.replyCount();
|
||||||
|
|
||||||
items.add('replies', <h3>
|
items.add('replies', <h3>
|
||||||
<a href={app.route.discussion(this.discussion).replace('/embed', '/d')} config={m.route}>
|
<a route={app.route.discussion(this.discussion).replace('/embed', '/d')}>
|
||||||
{count} comment{count == 1 ? '' : 's'}
|
{count} comment{count == 1 ? '' : 's'}
|
||||||
</a>
|
</a>
|
||||||
</h3>, 100);
|
</h3>, 100);
|
||||||
|
|
||||||
const props = items.get('controls').props;
|
const attrs = items.get('controls').attrs;
|
||||||
props.className = props.className.replace('App-primaryControl', '');
|
attrs.className = attrs.className.replace('App-primaryControl', '');
|
||||||
});
|
});
|
||||||
|
|
||||||
delete app.routes['index.filter'];
|
app.routes['discussion'] = {path: '/embed/:id', component: DiscussionPage};
|
||||||
app.routes['discussion'] = {path: '/embed/:id', component: DiscussionPage.component()};
|
app.routes['discussion.near'] = {path: '/embed/:id/:near', component: DiscussionPage};
|
||||||
app.routes['discussion.near'] = {path: '/embed/:id/:near', component: DiscussionPage.component()};
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user