Merge pull request #387 from hashicorp/refactor-core-helpers
refactor: 💡 port remaining helpers and doc-link component
This commit is contained in:
20 files changed
+44
-8
No files matched your search
@@ -83,6 +83,25 @@ update the confirmation status.
|
||||
</PendingConfirmations
|
||||
```
|
||||
|
||||
## App and Company Names
|
||||
|
||||
To make use of the `app-name`, `company-name`, and `company-copyright` helpers,
|
||||
add `appName` an `companyName` keys to your Ember config
|
||||
(see admin for example).
|
||||
|
||||
## Documentation URLs
|
||||
|
||||
To render doc links in your application, be sure to configure the links in your
|
||||
Ember config (see admin). Then reference doc links by keys:
|
||||
|
||||
```html
|
||||
<DocLink @doc="account" @iconSize="large" />
|
||||
```
|
||||
|
||||
## Loading Helper
|
||||
|
||||
To make use of the `is-loading` helper, install `ember-loading` first.
|
||||
|
||||
## Yarn Commands
|
||||
|
||||
List of available project commands. `yarn run <command-name>`
|
||||
|
||||
File renamed without changes.
@@ -1,5 +1,5 @@
|
||||
import { helper } from '@ember/component/helper';
|
||||
import config from '../config/environment';
|
||||
import config from 'ember-get-config';
|
||||
|
||||
export default helper(function appName() {
|
||||
return config.appName;
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { helper } from '@ember/component/helper';
|
||||
import config from '../config/environment';
|
||||
import config from 'ember-get-config';
|
||||
|
||||
export default helper(function companyCopyright() {
|
||||
const currentYear = new Date().getFullYear();
|
||||
@@ -1,5 +1,5 @@
|
||||
import { helper } from '@ember/component/helper';
|
||||
import config from '../config/environment';
|
||||
import config from 'ember-get-config';
|
||||
|
||||
export default helper(function companyName() {
|
||||
return config.companyName;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { helper } from '@ember/component/helper';
|
||||
import { assert } from '@ember/debug';
|
||||
import config from '../config/environment';
|
||||
import config from 'ember-get-config';
|
||||
|
||||
export default helper(function docUrl(params /*, hash*/) {
|
||||
const baseURL = config.documentation.baseURL;
|
||||
File renamed without changes.
@@ -0,0 +1 @@
|
||||
export { default } from 'core/components/doc-link';
|
||||
@@ -0,0 +1 @@
|
||||
export { default, appName } from 'core/helpers/app-name';
|
||||
@@ -0,0 +1 @@
|
||||
export { default, companyCopyright } from 'core/helpers/company-copyright';
|
||||
@@ -0,0 +1 @@
|
||||
export { default, companyName } from 'core/helpers/company-name';
|
||||
@@ -0,0 +1 @@
|
||||
export { default, docUrl } from 'core/helpers/doc-url';
|
||||
@@ -0,0 +1 @@
|
||||
export { default, isLoading } from 'core/helpers/is-loading';
|
||||
@@ -59,7 +59,8 @@
|
||||
"loader.js": "^4.7.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.2",
|
||||
"qunit-dom": "^1.2.0"
|
||||
"qunit-dom": "^1.2.0",
|
||||
"rose": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": "10.* || >= 12"
|
||||
|
||||
@@ -21,6 +21,16 @@ module.exports = function (environment) {
|
||||
// Here you can pass flags/options to your application instance
|
||||
// when it is created
|
||||
},
|
||||
|
||||
appName: 'App Name',
|
||||
companyName: 'Company Name',
|
||||
|
||||
documentation: {
|
||||
baseURL: 'https://boundaryproject.io/help/admin-ui',
|
||||
topics: {
|
||||
account: '/accounts',
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (environment === "development") {
|
||||
|
||||
File renamed without changes.
+1
-1
@@ -9,6 +9,6 @@ module('Integration | Helper | app-name', function (hooks) {
|
||||
test('it renders', async function (assert) {
|
||||
assert.expect(1);
|
||||
await render(hbs`{{app-name}}`);
|
||||
assert.equal(this.element.textContent.trim(), 'Boundary');
|
||||
assert.equal(this.element.textContent.trim(), 'App Name');
|
||||
});
|
||||
});
|
||||
+1
-1
@@ -10,6 +10,6 @@ module('Integration | Helper | company-copyright', function (hooks) {
|
||||
assert.expect(1);
|
||||
const currentYear = new Date().getFullYear();
|
||||
await render(hbs`{{company-copyright}}`);
|
||||
assert.equal(this.element.textContent.trim(), `© ${currentYear} HashiCorp`);
|
||||
assert.equal(this.element.textContent.trim(), `© ${currentYear} Company Name`);
|
||||
});
|
||||
});
|
||||
+1
-1
@@ -9,6 +9,6 @@ module('Integration | Helper | company-name', function (hooks) {
|
||||
test('it renders', async function (assert) {
|
||||
assert.expect(1);
|
||||
await render(hbs`{{company-name}}`);
|
||||
assert.equal(this.element.textContent.trim(), 'HashiCorp');
|
||||
assert.equal(this.element.textContent.trim(), 'Company Name');
|
||||
});
|
||||
});
|
||||
File renamed without changes.
Reference in new issue
Block a user