diff --git a/addons/rose/addon/components/rose/link-button.js b/addons/rose/addon/components/rose/link-button.js index 32e084f7e..f2e283b63 100644 --- a/addons/rose/addon/components/rose/link-button.js +++ b/addons/rose/addon/components/rose/link-button.js @@ -1,14 +1,26 @@ -import Component from '@ember/component'; +import LinkComponent from '@ember/routing/link-component'; import layout from '../../templates/components/rose/link-button'; +import { computed } from '@ember/object'; /** * An achor element based on `rose-button` component styles + * An empty model cannot be passed in to `link-to` component when a route + * is defined. Thus, `link-to` component is used to generate this component. * * @example * Save * Disabled */ -export default Component.extend({ +export default LinkComponent.extend({ layout, - tagName: '', + classNames: ['rose-link-button'], + classNameBindings: [ + 'linkButtonStyle', + 'iconOnly:has-icon-only', + 'iconLeft:has-icon-left', + 'iconRight:has-icon-right', + ], + linkButtonStyle: computed(function () { + return this.style ? `rose-button-${this.style}` : ''; + }), }); diff --git a/addons/rose/addon/components/rose/link-button.stories.mdx b/addons/rose/addon/components/rose/link-button.stories.mdx index cb6b13001..0ca00a2ee 100644 --- a/addons/rose/addon/components/rose/link-button.stories.mdx +++ b/addons/rose/addon/components/rose/link-button.stories.mdx @@ -12,7 +12,7 @@ Styles supported: primary, secondary, warning, and ghost. Disabling link button is not supported as it is an action on form components only. ```html - + Content ``` @@ -21,6 +21,7 @@ Disabling link button is not supported as it is an action on form components onl {{ template: hbs` + ``` {{ template: hbs` - + `, context: { style: select( diff --git a/addons/rose/addon/templates/components/rose/link-button.hbs b/addons/rose/addon/templates/components/rose/link-button.hbs index 9db7c752c..20ea6c6a5 100644 --- a/addons/rose/addon/templates/components/rose/link-button.hbs +++ b/addons/rose/addon/templates/components/rose/link-button.hbs @@ -1,34 +1,26 @@ - + + {{#if @iconLeft}} + + {{/if}} - - {{#if @iconLeft}} - - {{/if}} - - - {{yield}} - - - {{#if @iconOnly}} - - {{/if}} - - {{#if @iconRight}} - - {{/if}} + + {{yield}} - + + {{#if @iconOnly}} + + {{/if}} + + {{#if @iconRight}} + + {{/if}} + diff --git a/addons/rose/tests/dummy/app/templates/index.hbs b/addons/rose/tests/dummy/app/templates/index.hbs index 8df466fc3..2422caa03 100644 --- a/addons/rose/tests/dummy/app/templates/index.hbs +++ b/addons/rose/tests/dummy/app/templates/index.hbs @@ -1,9 +1,9 @@ -Primary -Secondary -Warning -Ghost +Primary +Secondary +Warning +Ghost
-Left Icon -Right Icon - +Left Icon +Right Icon + diff --git a/addons/rose/tests/integration/components/rose/link-button-test.js b/addons/rose/tests/integration/components/rose/link-button-test.js index d7d3c8497..617f76ed0 100644 --- a/addons/rose/tests/integration/components/rose/link-button-test.js +++ b/addons/rose/tests/integration/components/rose/link-button-test.js @@ -7,19 +7,19 @@ module('Integration | Component | rose/link-button', function (hooks) { setupRenderingTest(hooks); test('it renders', async function (assert) { - await render(hbs``); + await render(hbs``); assert.ok(find('a')); assert.notOk(find('.rose-button')); assert.ok(find('.rose-link-button')); }); test('it renders with attributes', async function (assert) { - await render(hbs``); + await render(hbs``); assert.ok(find('#link-button')); }); test('it renders with content', async function (assert) { - await render(hbs`Link button content`); + await render(hbs`Link button content`); assert.ok( find('.rose-link-button').textContent.trim(), 'Link button content' @@ -27,28 +27,24 @@ module('Integration | Component | rose/link-button', function (hooks) { }); test('it renders with rose button styles', async function (assert) { - this.set('style', 'primary'); - await render(hbs``); - assert.ok(find(`.rose-button-primary`)); - - this.set('style', 'sample'); + await render(hbs``); assert.ok(find(`.rose-button-sample`)); }); test('it supports left icon with @iconLeft', async function (assert) { - await render(hbs``); + await render(hbs``); assert.ok(find('.rose-icon')); assert.ok(find('.has-icon-left')); }); test('it supports left icon with @iconRight', async function (assert) { - await render(hbs``); + await render(hbs``); assert.ok(find('.rose-icon')); assert.ok(find('.has-icon-right')); }); test('it supports only icon with @iconOnly', async function (assert) { - await render(hbs``); + await render(hbs``); assert.ok(find('.rose-icon')); assert.ok(find('.has-icon-only')); }); diff --git a/ui/core/app/templates/orgs/org/projects/index.hbs b/ui/core/app/templates/orgs/org/projects/index.hbs index 0ddef022c..c98116b42 100644 --- a/ui/core/app/templates/orgs/org/projects/index.hbs +++ b/ui/core/app/templates/orgs/org/projects/index.hbs @@ -9,7 +9,7 @@ - {{t 'titles.new'}} + {{t 'titles.new'}} diff --git a/ui/core/app/templates/orgs/org/projects/project/host-catalogs/host-catalog/index.hbs b/ui/core/app/templates/orgs/org/projects/project/host-catalogs/host-catalog/index.hbs index b80d3f9b0..735397eef 100644 --- a/ui/core/app/templates/orgs/org/projects/project/host-catalogs/host-catalog/index.hbs +++ b/ui/core/app/templates/orgs/org/projects/project/host-catalogs/host-catalog/index.hbs @@ -14,7 +14,7 @@ @submit={{route-action "save" @model}} @cancel={{route-action "cancel" @model}} /> - + - + {{t 'titles.new'}} - + diff --git a/ui/core/app/templates/orgs/org/projects/project/index.hbs b/ui/core/app/templates/orgs/org/projects/project/index.hbs index 5c297e624..77050cd72 100644 --- a/ui/core/app/templates/orgs/org/projects/project/index.hbs +++ b/ui/core/app/templates/orgs/org/projects/project/index.hbs @@ -22,7 +22,7 @@ @submit={{route-action "save" @model}} @cancel={{route-action "cancel" @model}} /> - +