Skip to content

Commit

Permalink
Migration to glimmer components/native javascript. (Remove .js if com…
Browse files Browse the repository at this point in the history
…ponent javascript support uses an empty class. Substitute '@' for 'this.' in hbs for component arguments.)
  • Loading branch information
svogt0511 committed Dec 16, 2024
1 parent a927f0f commit 3742928
Show file tree
Hide file tree
Showing 27 changed files with 41 additions and 118 deletions.
8 changes: 4 additions & 4 deletions app/components/creator-show.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{#if this.creators}}
{{#each (take (or this.showOnly this.creators.length) this.creators) as |creator index|}}
{{#if @creators}}
{{#each (take (or @showOnly @creators.length) @creators) as |creator index|}}
{{#if (and creator.orcid (feature-flag 'showResearchers'))}}
<a href="https://commons.datacite.org/orcid.org/{{creator.orcid}}">{{creator.displayName~}}</a>{{format-creator this.creators index=index}}
<a href="https://commons.datacite.org/orcid.org/{{creator.orcid}}">{{creator.displayName~}}</a>{{format-creator @creators index=index}}
{{else}}
{{creator.displayName~}}{{format-creator this.creators index=index showOnly=(or this.showOnly this.creators.length)}}
{{creator.displayName~}}{{format-creator @creators index=index showOnly=(or @showOnly @creators.length)}}
{{/if}}
{{/each}}
{{/if}}
9 changes: 0 additions & 9 deletions app/components/creator-show.js

This file was deleted.

4 changes: 2 additions & 2 deletions app/components/doi-media.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</div>
<div class="panel panel-transparent url">
<div class="panel-body">
{{#if this.model.media}}
{{#each this.model.media as |media|}}
{{#if @model.media}}
{{#each @model.media as |media|}}
<div class="row">
<div class="col-md-2">
<strong><media.media-type /></strong>
Expand Down
5 changes: 0 additions & 5 deletions app/components/doi-media.js

This file was deleted.

4 changes: 2 additions & 2 deletions app/components/list-links.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ul class={{this.class}}>
{{#each this.links as |link| }}
<ul class={{@class}}>
{{#each @links as |link| }}
<li>
<a target="_blank" rel="noopener noreferrer" href={{link.url}}>{{link.name}}</a>
</li>
Expand Down
5 changes: 0 additions & 5 deletions app/components/list-links.js

This file was deleted.

4 changes: 0 additions & 4 deletions app/components/model-validation-errors.js

This file was deleted.

10 changes: 5 additions & 5 deletions app/components/prefix-available.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<div class="panel-body">
<div class="btn-toolbar">
<div class="btn-group btn-group-sm">
{{#if this.model.repository}}
{{#if @model.repository}}
<LinkTo
@route={{this.link}}
@model={{this.model.repository.id}}
@route={{@link}}
@model={{@model.repository.id}}
class="btn btn-warning"
id="assign-prefix"
>
Expand All @@ -15,8 +15,8 @@
</LinkTo>
{{else}}
<LinkTo
@route={{this.link}}
@model={{this.model.repository.id}}
@route={{@link}}
@model={{@model.repository.id}}
class="btn btn-warning"
id="assign-prefix"
>
Expand Down
4 changes: 0 additions & 4 deletions app/components/prefix-available.js

This file was deleted.

4 changes: 0 additions & 4 deletions app/components/provider-ror.js

This file was deleted.

4 changes: 0 additions & 4 deletions app/components/provider-settings.js

This file was deleted.

10 changes: 5 additions & 5 deletions app/components/repository-issn.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
<div class="col-md-9">
<div>
<label for="issnl" class="subtitle">ISSN-L</label>
<Input @type="text" class="form-control" id="repository-issn-issnl" @value={{this.model.issn.issnl}} required={{false}} />
<Input @type="text" class="form-control" id="repository-issn-issnl" @value={{@model.issn.issnl}} required={{false}} />

{{#if (v-get this.fragment 'issnl' 'errors')}}
<div class="help-block help-block-fragment issnl-field">{{v-get this.fragment 'issnl' 'errorMessage'}}</div>
{{#if (v-get @fragment 'issnl' 'errors')}}
<div class="help-block help-block-fragment issnl-field">{{v-get @fragment 'issnl' 'errorMessage'}}</div>
{{/if}}
</div>
<div>
<label for="issnl" class="subtitle">ISSN (electronic)</label>
<Input @type="text" class="form-control" id="repository-issn-electronic" @value={{this.model.issn.electronic}} required={{false}} />
<Input @type="text" class="form-control" id="repository-issn-electronic" @value={{@model.issn.electronic}} required={{false}} />
</div>
<div>
<label for="issnl" class="subtitle">ISSN (print)</label>
<Input @type="text" class="form-control" id="repository-issn-print" @value={{this.model.issn.print}} required={{false}} />
<Input @type="text" class="form-control" id="repository-issn-print" @value={{@model.issn.print}} required={{false}} />
</div>
</div>
</div>
5 changes: 0 additions & 5 deletions app/components/repository-issn.js

This file was deleted.

5 changes: 0 additions & 5 deletions app/components/repository-settings.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/components/url-check.hbs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<a target="_blank" rel="noopener noreferrer" href={{this.url}}>{{this.url}}</a>
<a target="_blank" rel="noopener noreferrer" href={{@url}}>{{@url}}</a>
15 changes: 0 additions & 15 deletions app/components/url-check.js

This file was deleted.

12 changes: 6 additions & 6 deletions app/components/user-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
</div>
</div>
<div class="col-md-9 panel-list" id="content">
{{#if this.searchable}}
<ModelSearch @model={{this.model}} @sortable={{true}} @name="User" @link="users" />
{{#if @searchable}}
<ModelSearch @model={{@model}} @sortable={{true}} @name="User" @link="users" />
{{/if}}

{{#if this.model}}
{{#each this.model as |user|}}
{{#if @model}}
{{#each @model as |user|}}
<div class="panel panel-transparent" data-test-user>
<div class="panel-body">
<h3 class="work">
Expand All @@ -34,8 +34,8 @@
</div>
{{/each}}
<div class="text-center">
{{#if (gt this.model.meta.totalPages 1)}}
<PageNumbers @model={{this.model}} @link="users" />
{{#if (gt @model.meta.totalPages 1)}}
<PageNumbers @model={{@model}} @link="users" />
{{/if}}
</div>
{{else}}
Expand Down
5 changes: 0 additions & 5 deletions app/components/user-list.js

This file was deleted.

10 changes: 5 additions & 5 deletions app/components/user-show.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<div class="panel panel-transparent">
<div class="panel-body">
<h5>ORCID ID</h5>
<a href="{{this.model.orcid}}">{{this.model.orcid}}</a>
<a href="{{@model.orcid}}">{{@model.orcid}}</a>

{{#if this.model.givenName}}
{{#if @model.givenName}}
<h5>Given Name</h5>
{{this.model.givenName}}
{{@model.givenName}}
{{/if}}

{{#if this.model.familyName}}
{{#if @model.familyName}}
<h5>Family Name</h5>
{{this.model.familyName}}
{{@model.familyName}}
{{/if}}
</div>
</div>
Expand Down
5 changes: 0 additions & 5 deletions app/components/user-show.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/templates/repositories/show/transfer-repository.hbs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<RepositoryTransfer @model={{this.model}} />
<RepositoryTransfer @model={{this.model}} />
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@cypress/browserify-preprocessor": "^3.0.2",
"@cypress/code-coverage": "^3.12.33",
"@ember/optional-features": "^2.1.0",
"@ember/string": "^4.0.0",
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^2.9.3",
"@embroider/macros": "1.16.2",
"@glimmer/component": "^1.1.2",
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/components/creator-show-test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { hbs } from 'ember-cli-htmlbars';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Component | creator-show', function (hooks) {
setupRenderingTest(hooks);

test('it renders', async function (assert) {
this.set('creators', [
this.creators = [
{
nameType: 'Person',
displayName: 'Empbh R. Goh',
Expand All @@ -26,9 +26,9 @@ module('Integration | Component | creator-show', function (hooks) {
givenName: 'M.',
familyName: 'Barrgoe'
}
]);
];

await render(hbs` {{creator-show creators=this.creators}}`);
await render(hbs`<CreatorShow @creators={{this.creators}}/>`);

assert.dom(this.element).hasText('Empbh R. Goh, M. Barrgow & M. Barrgoe');
});
Expand Down
4 changes: 1 addition & 3 deletions tests/integration/components/doi-media-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/*
import { hbs } from 'ember-cli-htmlbars';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
Expand All @@ -7,7 +6,7 @@ import { render, find } from '@ember/test-helpers';
module('Integration | Component | doi media', function (hooks) {
setupRenderingTest(hooks);

test('it renders', async function (assert) {
test.skip('it renders', async function (assert) {
await render(hbs`{{doi-media}}`);

assert.ok(
Expand All @@ -28,4 +27,3 @@ module('Integration | Component | doi media', function (hooks) {
);
});
});
*/
2 changes: 1 addition & 1 deletion tests/integration/components/user-list-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { hbs } from 'ember-cli-htmlbars';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Component | user-list', function (hooks) {
setupRenderingTest(hooks);
Expand Down
4 changes: 2 additions & 2 deletions tests/test-helper.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Application from 'bracco/app';
import config from 'bracco/config/environment';
import * as QUnit from 'qunit';
import { setApplication } from '@ember/test-helpers';
import { setup } from 'qunit-dom';
import { start } from 'ember-qunit';
import * as QUnit from 'qunit';
import { setup } from 'qunit-dom';
import './helpers/flash-message';

setApplication(Application.create(config.APP));
Expand Down
7 changes: 1 addition & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3597,18 +3597,13 @@
ember-cli-babel "^7.26.11"
ember-modifier-manager-polyfill "^1.2.0"

"@ember/string@^3.0.0":
"@ember/string@^3.0.0", "@ember/string@^3.1.1":
version "3.1.1"
resolved "https://registry.yarnpkg.com/@ember/string/-/string-3.1.1.tgz#0a5ac0d1e4925259e41d5c8d55ef616117d47ff0"
integrity sha512-UbXJ+k3QOrYN4SRPHgXCqYIJ+yWWUg1+vr0H4DhdQPTy8LJfyqwZ2tc5uqpSSnEXE+/1KopHBE5J8GDagAg5cg==
dependencies:
ember-cli-babel "^7.26.6"

"@ember/string@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@ember/string/-/string-4.0.0.tgz#24fe5cda227c9e6634e6e0b550944a3a13437878"
integrity sha512-IMVyVE72twuAMSYcHzWSgtgYTtzlHlKSGW8vEbztnnmkU6uo7kVHmiqSN9R4RkBhzvh0VD4G76Eph+55t3iNIA==

"@ember/test-helpers@^2.9.3":
version "2.9.4"
resolved "https://registry.yarnpkg.com/@ember/test-helpers/-/test-helpers-2.9.4.tgz#985022e9ba05cfc918bcf08b77cbb355f85b723e"
Expand Down

0 comments on commit 3742928

Please sign in to comment.