feat: 🎸 add doc-url helper and doc-link component
This commit is contained in:
4 files changed
+69
No files matched your search
@@ -0,0 +1,8 @@
|
||||
<a
|
||||
class="doc-link"
|
||||
href={{doc-url @doc}}
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
title={{t "actions.get-topic-help"}}>
|
||||
<Rose::Icon @name="help-circle-outline" @size={{@iconSize}} />
|
||||
</a>
|
||||
@@ -0,0 +1,18 @@
|
||||
import { helper } from '@ember/component/helper';
|
||||
import { get } from '@ember/object';
|
||||
import { assert } from '@ember/debug';
|
||||
import config from '../config/environment';
|
||||
|
||||
export default helper(function docUrl(params/*, hash*/) {
|
||||
const baseURL = config.documentation.baseURL;
|
||||
const docKey = params[0];
|
||||
const configuredPath = get(config.documentation, docKey);
|
||||
if (docKey) {
|
||||
assert(`
|
||||
Documentation for "${docKey}" could not be found. Please ensure that
|
||||
this key exists under "documentation" in your app config.
|
||||
`, configuredPath);
|
||||
}
|
||||
const path = configuredPath || '';
|
||||
return `${baseURL}${path}`;
|
||||
});
|
||||
Reference in new issue
Block a user