From af7e5d7adba26fadf79e18e0a4a89551da513117 Mon Sep 17 00:00:00 2001 From: Brian Pilati Date: Fri, 20 Oct 2023 10:49:44 -0600 Subject: [PATCH] Updated the abstract template to use expandable-preview and removed the component --- .../preprint-abstract/component.ts | 44 ------------------- .../preprint-abstract/template.hbs | 17 ++----- 2 files changed, 3 insertions(+), 58 deletions(-) delete mode 100644 app/preprints/-components/preprint-abstract/component.ts diff --git a/app/preprints/-components/preprint-abstract/component.ts b/app/preprints/-components/preprint-abstract/component.ts deleted file mode 100644 index c94e98586ec..00000000000 --- a/app/preprints/-components/preprint-abstract/component.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; -import { tracked } from '@glimmer/tracking'; -import PreprintModel from 'ember-osf-web/models/preprint'; - -interface InputArgs { - preprint: PreprintModel; -} - -export default class PreprintAbstract extends Component { - preprint = this.args.preprint; - - @tracked expandedAbstract = navigator.userAgent.includes('Prerender'); - - get hasShortenedDescription(): boolean { - return this.preprint.description !== undefined && this.preprint.description.length > 350; - } - - private get useShortenedDescription(): boolean { - return this.hasShortenedDescription && !this.expandedAbstract; - } - - /** - * description - * - * @description Get a shortened version of the abstract, but doesn't cut in the middle of word - * by going to the last space. - * @returns string - */ - public get description(): string { - if (this.useShortenedDescription) { - return this.preprint.description - .slice(0, 350) - .replace(/\s+\S*$/, ''); - } else { - return this.preprint.description; - } - } - - @action - public expandAbstract() { - this.expandedAbstract = !this.expandedAbstract; - } -} diff --git a/app/preprints/-components/preprint-abstract/template.hbs b/app/preprints/-components/preprint-abstract/template.hbs index feed7cda1a5..f4a1eb5ecdd 100644 --- a/app/preprints/-components/preprint-abstract/template.hbs +++ b/app/preprints/-components/preprint-abstract/template.hbs @@ -1,17 +1,6 @@

{{t 'preprints.detail.abstract'}}

-

- {{this.description}} -

- {{#if this.hasShortenedDescription}} - - {{/if}} + + {{@preprint.description}} +
\ No newline at end of file