refactor: 💡 apply doc-url helper to footer

and refactor to use company-name and company-copyright helpers, rather
than translations
This commit is contained in:
Randall Morey committed 2020-10-05 17:20:04 -04:00
1 parent 9d8efb2430
commit cfd8fae69a
10 files changed
+54 -14

No files matched your search

+2 -2
View File
@@ -4,7 +4,7 @@ module.exports = {
extends: 'octane',
rules: {
'no-bare-strings': true,
'no-curly-component-invocation': { allow: ['app-name'] },
'no-implicit-this': { allow: ['app-name'] }
'no-curly-component-invocation': { allow: ['app-name', 'company-name', 'company-copyright'] },
'no-implicit-this': { allow: ['app-name', 'company-name', 'company-copyright', 'doc-url'] }
}
};
+7
View File
@@ -0,0 +1,7 @@
import { helper } from '@ember/component/helper';
import config from '../config/environment';
export default helper(function companyCopyright() {
const currentYear = new Date().getFullYear();
return `© ${currentYear} ${config.companyName}`;
});
+6
View File
@@ -0,0 +1,6 @@
import { helper } from '@ember/component/helper';
import config from '../config/environment';
export default helper(function companyName() {
return config.companyName;
});
+1 -1
View File
@@ -5,7 +5,7 @@ import config from '../config/environment';
export default helper(function docUrl(params/*, hash*/) {
const baseURL = config.documentation.baseURL;
const docKey = params[0];
const docKey = params[0] || '';
const configuredPath = get(config.documentation, docKey);
if (docKey) {
assert(`
+6 -4
View File
@@ -59,11 +59,13 @@
<layout.footer>
<Rose::Footer as |footer|>
<footer.brand @logo="logo-hashi" @text={{t "hashicorp.title"}} />
<footer.text>{{t "hashicorp.copyright"}}</footer.text>
<footer.text>{{t "hashicorp.product"}}</footer.text>
<footer.brand @logo="logo-hashi" @text={{company-name}} />
<footer.text>{{company-copyright}}</footer.text>
<footer.text>{{app-name}}</footer.text>
<footer.nav as |nav|>
<nav.link @href={{t "hashicorp.documentation.link"}}>{{t "hashicorp.documentation.title"}}</nav.link>
<nav.link @href={{doc-url}}>
{{t "titles.documentation"}}
</nav.link>
</footer.nav>
</Rose::Footer>
</layout.footer>
+1
View File
@@ -32,6 +32,7 @@ module.exports = function (environment) {
},
appName: APP_NAME,
companyName: 'HashiCorp',
notifyTimeout: 4000,
sessionPollingTimeoutSeconds: 2.5,
@@ -7,6 +7,7 @@ module('Integration | Helper | app-name', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
assert.expect(1);
await render(hbs`{{app-name}}`);
assert.equal(this.element.textContent.trim(), 'Boundary');
});
@@ -0,0 +1,15 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Helper | company-copyright', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
assert.expect(1);
const currentYear = new Date().getFullYear();
await render(hbs`{{company-copyright}}`);
assert.equal(this.element.textContent.trim(), `© ${currentYear} HashiCorp`);
});
});
@@ -0,0 +1,14 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Helper | company-name', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
assert.expect(1);
await render(hbs`{{company-name}}`);
assert.equal(this.element.textContent.trim(), 'HashiCorp');
});
});
+1 -7
View File
@@ -16,15 +16,9 @@ titles:
empty-set: No Items Yet
global: Global
actions: Actions
documentation: Documentation
descriptions:
empty-set: There are no items to display yet. You may be able to add items or try back later.
questions:
delete-confirm: Are you sure you want to delete this resource?
remove-confirm: Are you sure you want to remove this association?
hashicorp:
title: HashiCorp
copyright: © 2020 HashiCorp
product: Boundary v0.1
documentation:
title: Documentation
link: https://boundaryproject.io