Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the branded footer link for preprints #2059

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions app/preprints/-components/branded-footer/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

.branded-footer-links {
width: 100%;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin: 10px 0;
margin: 10px;
text-align: center;

.social > a {
margin: 0 4px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import PreprintModel from 'ember-osf-web/models/preprint';
import Features from 'ember-feature-flags';
import ProviderModel from 'ember-osf-web/models/provider';
import { tracked } from '@glimmer/tracking';
import Media from 'ember-responsive';

interface InputArgs {
preprint: PreprintModel;
Expand All @@ -15,6 +16,7 @@ interface InputArgs {
export default class PreprintAuthorAssertions extends Component<InputArgs> {
@service features!: Features;
@service intl!: Intl;
@service media!: Media;

@tracked displayCoi = false;
@tracked displayDataLinks = false;
Expand Down Expand Up @@ -60,5 +62,9 @@ export default class PreprintAuthorAssertions extends Component<InputArgs> {
public get hasPreregLinks(): boolean {
return typeof this.preprint.hasPreregLinks === 'string';
}

get isMobile() {
return this.media.isMobile;
}
}

29 changes: 28 additions & 1 deletion app/preprints/-components/preprint-author-assertions/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
margin: 0 10px;

.assertions-container {
justify-content: center;
display: flex;
flex-direction: row;
justify-content: center;
Expand All @@ -47,4 +46,32 @@
}
}
}

&.mobile {
padding: 10px;

.author-assertions-container {
width: calc(100% - 20px);

.author-assertions {
flex-direction: column;
align-items: flex-start;
margin: 0;
width: 100%;

.assertions-container {
width: 100%;
justify-content: flex-start;
margin-top: 5px;
margin-bottom: 5px;

.assertion-header-label {
width: 175px;
padding-left: 10px;
padding-right: 10px;
}
}
}
}
}
}
146 changes: 71 additions & 75 deletions app/preprints/-components/preprint-author-assertions/template.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#if this.shouldShowSloanIcons}}
<div local-class='author-assertions-page-container'>
<div local-class='author-assertions-page-container {{if this.isMobile 'mobile'}}'>
<div local-class='author-assertions-container'>
<div local-class='header-label'>
{{~t 'preprints.detail.author-assertions.header_label'~}}
Expand Down Expand Up @@ -48,45 +48,43 @@
<div local-class='assertion-header-label'>
{{~t 'preprints.detail.author-assertions.public_data.title'~}}
</div>
<div local-class='assertions-container'>
<Button
data-test-view-data-links
data-analytics-name='View data links'
@type='default'
{{on 'click' (action (mut this.displayDataLinks) (not this.displayDataLinks))}}
>
{{this.availableDataLinksMessage}}
<FaIcon @icon='caret-down' @prefix='fas' aria-hidden='true'/>
</Button>
<OsfDialog
@closeOnOutsideClick={{true}}
@isOpen={{this.displayDataLinks}}
@onClose={{action (mut this.displayDataLinks) false}}
as |dialog|
>
<dialog.heading>
<h3>{{t 'preprints.detail.author-assertions.public_data.title'}}</h3>
</dialog.heading>
<dialog.main>
<div>
{{#if (eq this.preprint.hasDataLinks 'available')}}
<Preprints::-Components::PreprintAssertionLink
@links={{this.preprint.dataLinks}}
@analyticsName={{ t 'preprints.detail.author-assertions.public_data.title'}}
/>
{{else if (eq this.preprint.hasDataLinks 'no')}}
{{#if this.preprint.whyNoData}}
{{this.preprint.whyNoData}}
{{else}}
{{~t 'preprints.detail.author-assertions.public_data.no'~}}
{{/if}}
<Button
data-test-view-data-links
data-analytics-name='View data links'
@type='default'
{{on 'click' (action (mut this.displayDataLinks) (not this.displayDataLinks))}}
>
{{this.availableDataLinksMessage}}
<FaIcon @icon='caret-down' @prefix='fas' aria-hidden='true'/>
</Button>
<OsfDialog
@closeOnOutsideClick={{true}}
@isOpen={{this.displayDataLinks}}
@onClose={{action (mut this.displayDataLinks) false}}
as |dialog|
>
<dialog.heading>
<h3>{{t 'preprints.detail.author-assertions.public_data.title'}}</h3>
</dialog.heading>
<dialog.main>
<div>
{{#if (eq this.preprint.hasDataLinks 'available')}}
<Preprints::-Components::PreprintAssertionLink
@links={{this.preprint.dataLinks}}
@analyticsName={{ t 'preprints.detail.author-assertions.public_data.title'}}
/>
{{else if (eq this.preprint.hasDataLinks 'no')}}
{{#if this.preprint.whyNoData}}
{{this.preprint.whyNoData}}
{{else}}
{{~t 'preprints.detail.author-assertions.public_data.not_applicable' documentType=this.documentType~}}
{{~t 'preprints.detail.author-assertions.public_data.no'~}}
{{/if}}
</div>
</dialog.main>
</OsfDialog>
</div>
{{else}}
{{~t 'preprints.detail.author-assertions.public_data.not_applicable' documentType=this.documentType~}}
{{/if}}
</div>
</dialog.main>
</OsfDialog>
</div>
{{/if}}

Expand All @@ -95,45 +93,43 @@
<div local-class='assertion-header-label'>
{{~t 'preprints.detail.author-assertions.prereg.title'~}}
</div>
<div local-class='assertions-container'>
<Button
data-test-view-prereg
data-analytics-name='View prereg'
@type='default'
{{on 'click' (action (mut this.displayPreregLinks) (not this.displayPreregLinks))}}
>
{{this.availablePreregLinksMessage}}
<FaIcon @icon='caret-down' @prefix='fas' aria-hidden='true'/>
</Button>
<OsfDialog
@closeOnOutsideClick={{true}}
@isOpen={{this.displayPreregLinks}}
@onClose={{action (mut this.displayPreregLinks) false}}
as |dialog|
>
<dialog.heading>
<h3>{{t 'preprints.detail.author-assertions.prereg.title'}}</h3>
</dialog.heading>
<dialog.main>
<div>
{{#if (eq this.preprint.hasPreregLinks 'available')}}
<Preprints::-Components::PreprintAssertionLink
@links={{this.preprint.preregLinks}}
@analyticsName={{ t 'preprints.detail.author-assertions.prereg.title'}}
/>
{{else if (eq this.preprint.hasPreregLinks 'no')}}
{{#if this.preprint.whyNoPrereg}}
{{this.preprint.whyNoPrereg}}
{{else}}
{{~t 'preprints.detail.author-assertions.prereg.no'~}}
{{/if}}
<Button
data-test-view-prereg
data-analytics-name='View prereg'
@type='default'
{{on 'click' (action (mut this.displayPreregLinks) (not this.displayPreregLinks))}}
>
{{this.availablePreregLinksMessage}}
<FaIcon @icon='caret-down' @prefix='fas' aria-hidden='true'/>
</Button>
<OsfDialog
@closeOnOutsideClick={{true}}
@isOpen={{this.displayPreregLinks}}
@onClose={{action (mut this.displayPreregLinks) false}}
as |dialog|
>
<dialog.heading>
<h3>{{t 'preprints.detail.author-assertions.prereg.title'}}</h3>
</dialog.heading>
<dialog.main>
<div>
{{#if (eq this.preprint.hasPreregLinks 'available')}}
<Preprints::-Components::PreprintAssertionLink
@links={{this.preprint.preregLinks}}
@analyticsName={{ t 'preprints.detail.author-assertions.prereg.title'}}
/>
{{else if (eq this.preprint.hasPreregLinks 'no')}}
{{#if this.preprint.whyNoPrereg}}
{{this.preprint.whyNoPrereg}}
{{else}}
{{~t 'preprints.detail.author-assertions.prereg.not_applicable' documentType=this.documentType~}}
{{~t 'preprints.detail.author-assertions.prereg.no'~}}
{{/if}}
</div>
</dialog.main>
</OsfDialog>
</div>
{{else}}
{{~t 'preprints.detail.author-assertions.prereg.not_applicable' documentType=this.documentType~}}
{{/if}}
</div>
</dialog.main>
</OsfDialog>
</div>
{{/if}}
</div>
Expand Down
6 changes: 6 additions & 0 deletions app/preprints/-components/preprint-status-banner/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import PreprintProviderModel from 'ember-osf-web/models/preprint-provider';
import { tracked } from '@glimmer/tracking';
import { ReviewsState } from 'ember-osf-web/models/provider';
import ReviewActionModel from 'ember-osf-web/models/review-action';
import Media from 'ember-responsive';

const UNKNOWN = 'unknown';
const PENDING = 'pending';
Expand Down Expand Up @@ -72,6 +73,7 @@ interface InputArgs {
export default class PreprintStatusBanner extends Component<InputArgs>{
@service intl!: Intl;
@service theme!: Theme;
@service media!: Media;

submission = this.args.submission;
isWithdrawn = this.args.submission.isWithdrawn;
Expand Down Expand Up @@ -207,4 +209,8 @@ export default class PreprintStatusBanner extends Component<InputArgs>{

this.latestAction = latestSubmissionAction;
}

get isMobile() {
return this.media.isMobile;
}
}
8 changes: 8 additions & 0 deletions app/preprints/-components/preprint-status-banner/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ $color-border-light: #ddd;
}
}
}

&.mobile {
height: fit-content;

.preprint-banner-status {
height: fit-content;
}
}
}

.status-banner-dialog {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div local-class='preprint-banner-status-container'>
<div local-class='preprint-banner-status-container {{if this.isMobile 'mobile'}}'>
{{#if (or this.submission.provider?.isPending this.loadPreprintState.isRunning) }}
{{ t 'preprints.detail.status_banner.loading' }}
{{else}}
Expand Down
12 changes: 8 additions & 4 deletions mirage/fixtures/preprint-providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ const preprintProviders: Array<Partial<PreprintProvider>> = [
name: 'Thesis Commons',
preprintWord: 'thesis',
assets: randomAssets(2),
footerLinks: 'fake footer links',
// eslint-disable-next-line max-len
footerLinks: '<p style="text-align: center;">LawArXiv:&nbsp;<a href="mailto:support+lawarxiv@osf.io">Support&nbsp;</a>|&nbsp;<a href="mailto:contact+lawarxiv@osf.io">Contact&nbsp;</a>|&nbsp;<a href="https://twitter.com/lawarxiv" target="_blank" title="LawArXiv on Twitter"><span class="fa fa-twitter fa-2x" style="vertical-align: middle;">&nbsp;</span></a></p>\n <p>LawrXiv is a trademark of Cornell University, used under license. This license should not be understood to indicate endorsement of content on LawArXiv by Cornell University or arXiv.</p>',
},
{
id: 'preprintrxiv',
name: 'PreprintrXiv',
preprintWord: 'preprint',
assets: randomAssets(3),
footerLinks: 'fake footer links',
// eslint-disable-next-line max-len
footerLinks: 'Removed in mirage scenario',
reviewsCommentsPrivate: true,
reviewsWorkflow: PreprintProviderReviewsWorkFlow.PRE_MODERATION,
},
Expand All @@ -42,14 +44,16 @@ const preprintProviders: Array<Partial<PreprintProvider>> = [
name: 'PaperXiv',
preprintWord: 'paper',
assets: randomAssets(4),
footerLinks: 'fake footer links',
// eslint-disable-next-line max-len
footerLinks: '<p style="text-align: right;" data-mce-style="text-align: right;">AgriXiv:&nbsp;<a href="mailto:support+agrixiv@osf.io" data-mce-href="mailto:support+agrixiv@osf.io">Support&nbsp;</a>|&nbsp;<a href="mailto:contact+agrixiv@osf.io" data-mce-href="mailto:contact+agrixiv@osf.io">Contact&nbsp;</a>|&nbsp;<a href="https://twitter.com/AgriXiv" target="_blank" title="AgriXiv on Twitter" rel="noopener" data-mce-href="https://twitter.com/AgriXiv"><span class="fa fa-twitter fa-2x" style="vertical-align: middle;" data-mce-style="vertical-align: middle;">&nbsp;</span></a>&nbsp;<a href="https://www.facebook.com/AgriXiv/" target="_blank" title="AgriXiv on Facebook" rel="noopener" data-mce-href="https://www.facebook.com/AgriXiv/"><span class="fa fa-facebook fa-2x" style="vertical-align: middle;" data-mce-style="vertical-align: middle;">&nbsp;</span></a>&nbsp;<a href="https://www.instagram.com/agrixiv/" target="_blank" title="AgriXiv on Instagram" rel="noopener" data-mce-href="https://www.instagram.com/agrixiv/"><span class="fa fa-2x fa-instagram" style="vertical-align: middle;" data-mce-style="vertical-align: middle;">&nbsp;</span></a><br data-mce-bogus="1"></p><p style="text-align: right;" data-mce-style="text-align: right;">arXiv is a trademark of Cornell University, used under license. This license should not be understood to indicate endorsement of content on AgriXiv by Cornell University or arXiv.</p>',
},
{
id: 'thesisrxiv',
name: 'ThesisrXiv',
preprintWord: 'thesis',
assets: randomAssets(5),
footerLinks: 'fake footer links',
// eslint-disable-next-line max-len
footerLinks: '<p style="text-align: left;" data-mce-style="text-align: left;">AgriXiv:&nbsp;<a href="mailto:support+agrixiv@osf.io" data-mce-href="mailto:support+agrixiv@osf.io">Support&nbsp;</a>|&nbsp;<a href="mailto:contact+agrixiv@osf.io" data-mce-href="mailto:contact+agrixiv@osf.io">Contact&nbsp;</a>|&nbsp;<a href="https://twitter.com/AgriXiv" target="_blank" title="AgriXiv on Twitter" rel="noopener" data-mce-href="https://twitter.com/AgriXiv"><span class="fa fa-twitter fa-2x" style="vertical-align: middle;" data-mce-style="vertical-align: middle;">&nbsp;</span></a>&nbsp;<a href="https://www.facebook.com/AgriXiv/" target="_blank" title="AgriXiv on Facebook" rel="noopener" data-mce-href="https://www.facebook.com/AgriXiv/"><span class="fa fa-facebook fa-2x" style="vertical-align: middle;" data-mce-style="vertical-align: middle;">&nbsp;</span></a>&nbsp;<a href="https://www.instagram.com/agrixiv/" target="_blank" title="AgriXiv on Instagram" rel="noopener" data-mce-href="https://www.instagram.com/agrixiv/"><span class="fa fa-2x fa-instagram" style="vertical-align: middle;" data-mce-style="vertical-align: middle;">&nbsp;</span></a><br data-mce-bogus="1"></p><p style="text-align: left;" data-mce-style="text-align: left;">arXiv is a trademark of Cornell University, used under license. This license should not be understood to indicate endorsement of content on AgriXiv by Cornell University or arXiv.</p>',
},
{
id: 'workrxiv',
Expand Down
Loading