diff --git a/.ember-cli b/.ember-cli new file mode 100644 index 00000000..ee64cfed --- /dev/null +++ b/.ember-cli @@ -0,0 +1,9 @@ +{ + /** + Ember CLI sends analytics information by default. The data is completely + anonymous, but there are times when you might want to disable this behavior. + + Setting `disableAnalytics` to true will prevent any data from being sent. + */ + "disableAnalytics": false +} diff --git a/.eslintrc.js b/.eslintrc.js index 6cb5e605..659e1288 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -29,7 +29,7 @@ module.exports = { }, env: { browser: false, - node: true + node: true, } } ] diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..92216555 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,21 @@ +# unconventional js +/blueprints/*/files/ +/vendor/ + +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ +/node_modules/ + +# misc +/coverage/ +!.* +.eslintcache + +# ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/package.json.ember-try diff --git a/.template-lintrc.js b/.template-lintrc.js index a73e7b71..04f97818 100644 --- a/.template-lintrc.js +++ b/.template-lintrc.js @@ -15,7 +15,7 @@ module.exports = { 'no-triple-curlies': false, 'no-unused-block-params': false, 'simple-unless': false, - 'no-console': false, + 'no-log': false, 'no-bare-strings': false } }; \ No newline at end of file diff --git a/app/adapters/application.js b/app/adapters/application.js index 6fefaaf3..d5903f0e 100644 --- a/app/adapters/application.js +++ b/app/adapters/application.js @@ -1,9 +1,9 @@ -import DS from 'ember-data'; +import JSONAPIAdapter from '@ember-data/adapter/json-api'; import ENV from 'ror-app/config/environment'; import { inject as service } from '@ember/service'; import { computed } from '@ember/object'; -export default DS.JSONAPIAdapter.extend({ +export default JSONAPIAdapter.extend({ launchDarkly: service(), host: computed('launchDarkly.variation', function() { return this.launchDarkly.variation('v2_ui') ? ENV.API_URL_V2 : ENV.API_URL_V1; diff --git a/app/adapters/organization.js b/app/adapters/organization.js index 7ce9c10b..adeae6fa 100644 --- a/app/adapters/organization.js +++ b/app/adapters/organization.js @@ -1,9 +1,9 @@ -import DS from 'ember-data'; +import JSONAPIAdapter from '@ember-data/adapter/json-api'; import ENV from 'ror-app/config/environment'; import { inject as service } from '@ember/service'; import { computed } from '@ember/object'; -export default DS.JSONAPIAdapter.extend({ +export default JSONAPIAdapter.extend({ launchDarkly: service(), host: computed('launchDarkly.variation', function() { return this.launchDarkly.variation('v2_ui') ? ENV.API_URL_V2 : ENV.API_URL_V1; diff --git a/app/components/application-header.js b/app/components/application-header.js index e54c1564..2fc6eeca 100644 --- a/app/components/application-header.js +++ b/app/components/application-header.js @@ -8,10 +8,10 @@ export default Component.extend({ actions: { search() { - this.get('globalSearch').doSearch(this.query); + this.globalSearch.doSearch(this.query); }, clear() { - this.get('globalSearch').doSearch(null); + this.globalSearch.doSearch(null); } } }); diff --git a/app/components/filter-sidebar.js b/app/components/filter-sidebar.js index 23d8e37f..31374951 100644 --- a/app/components/filter-sidebar.js +++ b/app/components/filter-sidebar.js @@ -23,7 +23,7 @@ export default Component.extend({ this.filterValue = this.filterValue.slice(0, -1) this.set('model.query.filter', this.filterValue) //this.get('globalSearch').doSearch(this.query, this.allStatus) - this.get('router').transitionTo('organizations.index', { queryParams: { query: this.model.query.query, page: this.model.query.page, all_status: this.model.query.allStatus, filter: this.model.query.filter}}); + this.router.transitionTo('organizations.index', { queryParams: { query: this.model.query.query, page: this.model.query.page, all_status: this.model.query.allStatus, filter: this.model.query.filter}}); }, clearFilter() { this.filterValue = '' @@ -32,7 +32,7 @@ export default Component.extend({ this.set('withdrawnStatus', false); this.filterValue = "status:active" this.set('model.query.filter', this.filterValue) - this.get('router').transitionTo('organizations.index', { queryParams: { query: this.model.query.query, page: this.model.query.page, all_status: this.model.query.allStatus, filter: this.model.query.filter}}); + this.router.transitionTo('organizations.index', { queryParams: { query: this.model.query.query, page: this.model.query.page, all_status: this.model.query.allStatus, filter: this.model.query.filter}}); } } diff --git a/app/components/page-numbers.js b/app/components/page-numbers.js index 3e8b1780..4e615ab7 100644 --- a/app/components/page-numbers.js +++ b/app/components/page-numbers.js @@ -1,15 +1,16 @@ +import { alias } from '@ember/object/computed'; import Component from '@ember/component'; import { computed } from '@ember/object'; export default Component.extend({ tagName: 'row', - currentPage: computed.alias("model.query.page"), - totalPages: computed.alias("model.meta.totalPages"), + currentPage: alias("model.query.page"), + totalPages: alias("model.meta.totalPages"), pageItems: computed("currentPage","totalPages", function() { - const page = Number(this.get("currentPage") || 1); - const totalPages = Number(this.get("totalPages")); + const page = Number(this.currentPage || 1); + const totalPages = Number(this.totalPages); return Array.from(Array(totalPages).keys()).reduce(function (sum, i) { if (i < 2 || (i > (page - 4) && i < (page + 2)) || i > (totalPages - 3)) { @@ -24,8 +25,8 @@ export default Component.extend({ }), nextPage: computed("currentPage", "totalPages", function() { - const page = Number(this.get("currentPage")); - const totalPages = Number(this.get("totalPages")); + const page = Number(this.currentPage); + const totalPages = Number(this.totalPages); if (page < totalPages) { return page + 1; } else { @@ -34,7 +35,7 @@ export default Component.extend({ }), previousPage: computed("currentPage", function() { - const page = Number(this.get("currentPage")); + const page = Number(this.currentPage); if (page > 1) { return page - 1; } else { diff --git a/app/helpers/decimal-format.js b/app/helpers/decimal-format.js new file mode 100644 index 00000000..54a4f6df --- /dev/null +++ b/app/helpers/decimal-format.js @@ -0,0 +1,13 @@ +import { helper } from '@ember/component/helper'; + +export function decimalFormat(params) { + const [number] = params; + + if (isNaN(number) || number === '') { + return ""; + } + + return new Intl.NumberFormat().format(number); +} + +export default helper(decimalFormat); diff --git a/app/models/organization.js b/app/models/organization.js index 6d35285b..f367a26b 100644 --- a/app/models/organization.js +++ b/app/models/organization.js @@ -1,23 +1,23 @@ -import DS from 'ember-data'; +import Model, { attr } from '@ember-data/model'; -export default DS.Model.extend({ - meta: DS.attr(), +export default Model.extend({ + meta: attr(), - name: DS.attr('string'), //TODO: Remove this when v1 has been retired - names: DS.attr(), - local: DS.attr('string'), - types: DS.attr(), - links: DS.attr(), - aliases: DS.attr(), - acronyms: DS.attr(), - external_ids: DS.attr(), - wikipediaUrl: DS.attr('string'), - labels: DS.attr(), - country: DS.attr(), - addresses: DS.attr(), - relationships: DS.attr(), - status: DS.attr('string'), - admin: DS.attr(), - locations: DS.attr() + name: attr('string'), //TODO: Remove this when v1 has been retired + names: attr(), + local: attr('string'), + types: attr(), + links: attr(), + aliases: attr(), + acronyms: attr(), + external_ids: attr(), + wikipediaUrl: attr('string'), + labels: attr(), + country: attr(), + addresses: attr(), + relationships: attr(), + status: attr('string'), + admin: attr(), + locations: attr() }); diff --git a/app/serializers/application.js b/app/serializers/application.js index 4b7338fa..d6eb84aa 100644 --- a/app/serializers/application.js +++ b/app/serializers/application.js @@ -1,8 +1,8 @@ +import JSONSerializer from '@ember-data/serializer/json'; import { underscore } from '@ember/string'; import { assign } from '@ember/polyfills'; -import DS from 'ember-data'; -export default DS.JSONSerializer.extend({ +export default JSONSerializer.extend({ normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) { let total = payload.number_of_results; let totalPages = Math.min(Math.ceil(total / 20), 500); diff --git a/app/services/global-search.js b/app/services/global-search.js index 3bb6395a..cb669a5e 100644 --- a/app/services/global-search.js +++ b/app/services/global-search.js @@ -1,5 +1,4 @@ -import Service from '@ember/service'; -import { inject as service } from '@ember/service'; +import Service, { inject as service } from '@ember/service'; // import { assign } from '@ember/polyfills'; export default Service.extend({ @@ -16,6 +15,6 @@ export default Service.extend({ //let params = assign(this.model.get('query'), { query: this.query, sort: this.sort }); // this.router.transitionTo({ queryParams: params }); - this.get('router').transitionTo('organizations.index', { queryParams: { query: query, page: 1}}); + this.router.transitionTo('organizations.index', { queryParams: { query: query, page: 1}}); } }); diff --git a/app/templates/application.hbs b/app/templates/application.hbs index ae45aab0..f46c147c 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -2,6 +2,6 @@ {{outlet}} -{{application-subscribe}} -{{application-socials}} -{{application-footer}} + + + diff --git a/app/templates/components/application-header.hbs b/app/templates/components/application-header.hbs index ff07aba4..32561e6d 100755 --- a/app/templates/components/application-header.hbs +++ b/app/templates/components/application-header.hbs @@ -1,68 +1,66 @@ -{{#bs-navbar backgroundColor="white" class="navbar-expand-lg" -onCollapse=(action (mut collapsed) true) onExpand=(action (mut collapsed) false) as |navbar|}} +
Research Organization Registry logo {{navbar.toggle}} - {{#navbar.content}} - {{#navbar.nav class="ml-auto" as |nav|}} + + - {{#nav.item}} +

About

- {{/nav.item}} +
- {{#nav.item}} +

Registry

- {{/nav.item}} +
- {{#nav.item}} +

Community

- {{/nav.item}} +
- {{#nav.item}} +

Blog

- {{/nav.item}} +
- {{#nav.item}} +

Documentation

- {{/nav.item}} +
- {{/navbar.nav}} - {{/navbar.content}} +
+
-{{/bs-navbar}} -{{#if showAdvanced}} +
+{{#if this.showAdvanced}}

Show records with status:

diff --git a/app/templates/components/filter-sidebar.hbs b/app/templates/components/filter-sidebar.hbs index 98b38ff8..cf597072 100644 --- a/app/templates/components/filter-sidebar.hbs +++ b/app/templates/components/filter-sidebar.hbs @@ -3,15 +3,15 @@

Record status


- {{input class="filters-list-input" type="checkbox" id="active-status" name="activeStatus" checked=activeStatus}} +
- {{input class="filters-list-input" type="checkbox" id="inactive-status" name="inactiveStatus" checked=inactiveStatus}} +
- {{input class="filters-list-input" type="checkbox" id="withdrawn-status" name="withdrawnStatus" checked=withdrawnStatus}} +
diff --git a/app/templates/components/page-numbers.hbs b/app/templates/components/page-numbers.hbs index 2555dbdc..e3dcadff 100644 --- a/app/templates/components/page-numbers.hbs +++ b/app/templates/components/page-numbers.hbs @@ -1,15 +1,9 @@
    - {{#if previousPage}} + {{#if this.previousPage}}
  • - {{#link-to - link - (query-params - page=previousPage) - class="page-link" - aria-label="Previous" - }} - {{/link-to}} + +
  • {{else}}
  • @@ -17,7 +11,7 @@
  • {{/if}} - {{#each pageItems as |item|}} + {{#each this.pageItems as |item|}} {{#if item.dots}}
  • ... @@ -28,27 +22,16 @@
  • {{else}}
  • - {{#link-to - link - (query-params - page=item.page) - class="page-link" - }}{{item.page}} - {{/link-to}} + {{item.page}} +
  • {{/if}} {{/each}} - {{#if nextPage}} + {{#if this.nextPage}}
  • - {{#link-to - link - (query-params - page=nextPage) - class="page-link" - aria-label="Next" - }} - {{/link-to}} + +
  • {{else}}
  • diff --git a/app/templates/components/v1/organization-item.hbs b/app/templates/components/v1/organization-item.hbs index db72258a..9193843f 100644 --- a/app/templates/components/v1/organization-item.hbs +++ b/app/templates/components/v1/organization-item.hbs @@ -6,7 +6,7 @@

    - ROR ID {{#link-to "organizations.show" model.id class="card-link logo-link"}}https://ror.org/{{model.id}}{{/link-to}} + ROR ID https://ror.org/{{model.id}}

    @@ -118,7 +118,7 @@

    - {{#if inactiveStatus}} - {{#if (not isSearch)}} + {{#if this.inactiveStatus}} + {{#if (not this.isSearch)}}
    This record has - {{#if (eq model.status "withdrawn")}}been {{/if}}{{#if (eq model.status "inactive")}}become {{/if}} - {{model.status}} - {{#if (eq model.status "withdrawn")}}from {{/if}}{{#if (eq model.status "inactive")}}in{{/if}} + {{#if (eq this.model.status "withdrawn")}}been {{/if}}{{#if (eq this.model.status "inactive")}}become {{/if}} + {{this.model.status}} + {{#if (eq this.model.status "withdrawn")}}from {{/if}}{{#if (eq this.model.status "inactive")}}in{{/if}} ROR and is no longer actively maintained. - {{#each-in relationships as |relationshipType relationshipInstances|}} + {{#each-in this.relationships as |relationshipType relationshipInstances|}} {{#if (eq relationshipType "Successor")}} {{#if relationshipInstances}} This organization is succeeded by @@ -44,25 +44,25 @@
    -

    {{name}}

    +

    {{this.name}}

    - {{#if isSearch}} + {{#if this.isSearch}}
    - {{#if otherNames.values}} + {{#if this.otherNames.values}}

    Other names:

    - {{otherNames.values}} + {{this.otherNames.values}} {{/if}}
    {{/if}}

    Organization types

    - {{capitalize organizationTypes}}
    - {{#if (not isSearch)}} - {{#if otherNames.groupedNamesCount}} + {{capitalize this.organizationTypes}}
    + {{#if (not this.isSearch)}} + {{#if this.otherNames.groupedNamesCount}}

    Other names


    - {{#each-in otherNames.groupedNames as |nameType nameInstances|}} + {{#each-in this.otherNames.groupedNames as |nameType nameInstances|}} {{#if nameType}} {{#if nameInstances}} {{capitalize (pluralize nameType)}}
    @@ -76,50 +76,50 @@ {{/if}}
    - {{#if model.locations}} + {{#if this.model.locations}}

    Locations

    - {{#each model.locations as |location|}} + {{#each this.model.locations as |location|}} {{#if location.geonames_details.name}} {{location.geonames_details.name}} (GeoNames ID {{location.geonames_id}}), {{location.geonames_details.country_name}}
    {{/if}} {{/each}} {{/if}} - {{#if model.links}} + {{#if this.model.links}}

    Website

    - {{#each model.links as |link|}} + {{#each this.model.links as |link|}} {{#if (eq link.type 'website')}} {{link.value}}
    {{/if}} {{/each}} {{/if}} - {{#if (or grid display_isni fundref wikidata)}} + {{#if (or this.grid this.display_isni this.fundref this.wikidata)}}

    Other Identifiers

    - {{#if grid}} - GRID {{grid}}
    + {{#if this.grid}} + GRID {{this.grid}}
    {{/if}} - {{#if display_isni}} - ISNI {{display_isni}}
    + {{#if this.display_isni}} + ISNI {{this.display_isni}}
    {{/if}} - {{#if fundref}} - Crossref Funder ID {{fundref}}
    + {{#if this.fundref}} + Crossref Funder ID {{this.fundref}}
    {{/if}} - {{#if wikidata}} - Wikidata {{wikidata}}
    + {{#if this.wikidata}} + Wikidata {{this.wikidata}}
    {{/if}} {{/if}}
    - {{#if relationshipsCount}} + {{#if this.relationshipsCount}}
    - {{#if isSearch}} + {{#if this.isSearch}}
    -

    Relationships ({{relationshipsCount}})

    +

    Relationships ({{this.relationshipsCount}})

    {{/if}} - {{#if (not isSearch)}} + {{#if (not this.isSearch)}}

    Relationships

    - {{#each-in relationships as |relationshipType relationshipInstances|}} + {{#each-in this.relationships as |relationshipType relationshipInstances|}} {{#if relationshipType}} {{#if relationshipInstances}} {{relationshipType}} Organizations
    @@ -135,15 +135,15 @@ {{/if}}