1
0
mirror of https://github.com/flarum/core.git synced 2025-05-06 15:35:38 +02:00

Extract method to get the permalink to a post

Necessary so that the embed extension can override it.
This commit is contained in:
Toby Zerner 2015-10-27 12:09:24 +10:30
parent bb250baddf
commit 5e2f659f54
2 changed files with 693 additions and 817 deletions

1498
js/forum/dist/app.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ export default class PostMeta extends Component {
view() { view() {
const post = this.props.post; const post = this.props.post;
const time = post.time(); const time = post.time();
const permalink = window.location.origin + app.route.post(post); const permalink = this.getPermalink(post);
const touch = 'ontouchstart' in document.documentElement; const touch = 'ontouchstart' in document.documentElement;
// When the dropdown menu is shown, select the contents of the permalink // When the dropdown menu is shown, select the contents of the permalink
@ -42,4 +42,14 @@ export default class PostMeta extends Component {
</div> </div>
); );
} }
/**
* Get the permalink for the given post.
*
* @param {Post} post
* @returns {String}
*/
getPermalink(post) {
return window.location.origin + app.route.post(post);
}
} }