Skip to content

Commit

Permalink
move archive link button to each tab and add a download button
Browse files Browse the repository at this point in the history
  • Loading branch information
John Tordoff committed Nov 11, 2024
1 parent 4320073 commit a824196
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@
>
<div local-class='banner'>
<img src='{{@institution.bannerUrl}}' alt='{{@institution.name}}'>
{{#if @institution.linkToExternalReportsArchive}}
<div>
<OsfLink
data-test-link-to-reports-archive
data-analytics-name='Link to archived reports'
@target='_blank'
@fakeButton={{true}}
@href={{@institution.linkToExternalReportsArchive}}
>
<EmberTooltip @side='bottom'>
{{t 'institutions.dashboard.download_past_reports_label'}}
</EmberTooltip>
<FaIcon
@icon='chart-pie'
/>
</OsfLink>
</div>
{{/if}}
</div>
<ul
data-analytics-scope='Dashboard tabs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,18 @@ input:checked + .slider::before {
margin-right: 5px;
font-weight: bold;
}

.download-button-group {
display: inline-flex;
padding-left: 10px;
align-content: center;

div {
color: #2d6a9f;
}

ResponsiveDropdown {
margin-left: 3px;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,41 @@
</div>
{{/if}}
</BasicDropdown>
<div local-class='download-button-group'>
{{#if @institution.linkToExternalReportsArchive}}
<OsfLink
data-test-link-to-reports-archive
data-analytics-name='Link to archived reports'
@target='_blank'
@fakeButton={{true}}
@href={{@institution.linkToExternalReportsArchive}}
>
<EmberTooltip @side='bottom'>
{{t 'institutions.dashboard.download_past_reports_label'}}
</EmberTooltip>
<FaIcon @icon='chart-pie'/>
</OsfLink>
{{/if}}
<ResponsiveDropdown @renderInPlace={{true}} @buttonStyling={{true}} as |dd| >
<dd.trigger data-test-download-dropdown local-class='download-dropdown-trigger'>
<FaIcon @icon='download' />
</dd.trigger>
<dd.content local-class='download-dropdown-content'>
<Button local-class='download-option' {{on 'click' (queue this.downloadCsv dd.close)}}>
{{t 'institutions.dashboard.format_labels.csv'}}
</Button>
<Button local-class='download-option' {{on 'click' (queue this.downloadTsv dd.close)}}>
{{t 'institutions.dashboard.format_labels.tsv'}}
</Button>
<Button local-class='download-option' {{on 'click' (queue this.downloadJsonTable dd.close)}}>
{{t 'institutions.dashboard.format_labels.json_table'}}
</Button>
<Button local-class='download-option' {{on 'click' (queue this.downloadJsonDirect dd.close)}}>
{{t 'institutions.dashboard.format_labels.json_direct'}}
</Button>
</dd.content>
</ResponsiveDropdown>
</div>
</div>
<PaginatedList::HasMany
local-class='table'
Expand Down
14 changes: 10 additions & 4 deletions app/institutions/dashboard/-components/object-list/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

.object-table {
border-collapse: collapse;

th {
padding: 10px 15px;

Expand Down Expand Up @@ -109,12 +109,18 @@
display: flex;
margin: 0.5rem 0.2rem;
justify-content: space-between;

button {
margin-right: -5px;
}
}

.blue-text-button {
color: $color-link-dark;
.download-dropdown-trigger {
color: $color-bg-blue-dark;
}

.download-button-group {
align-content: center;
display: inline-flex;
padding-left: 10px;
}
39 changes: 39 additions & 0 deletions app/institutions/dashboard/-components/object-list/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,45 @@ as |list|>
</div>
</dd.content>
</ResponsiveDropdown>
<div local-class='download-button-group'>
{{#if @institution.linkToExternalReportsArchive}}
<div>
<OsfLink
data-test-link-to-reports-archive
data-analytics-name='Link to archived reports'
@target='_blank'
@fakeButton={{true}}
@href={{@institution.linkToExternalReportsArchive}}
>
<EmberTooltip @side='bottom'>
{{t 'institutions.dashboard.download_past_reports_label'}}
</EmberTooltip>
<FaIcon
@icon='chart-pie'
/>
</OsfLink>
</div>
{{/if}}
<ResponsiveDropdown @renderInPlace={{true}} @buttonStyling={{true}} as |dd| >
<dd.trigger data-test-download-dropdown local-class='download-dropdown-trigger'>
<FaIcon @icon='download' />
</dd.trigger>
<dd.content local-class='download-dropdown-content'>
<Button
local-class='download-option'
{{on 'click' (queue this.downloadCsv dd.close)}}
>
{{t 'institutions.dashboard.format_labels.csv'}}
</Button>
<Button
local-class='download-option'
{{on 'click' (queue this.downloadTsv dd.close)}}
>
{{t 'institutions.dashboard.format_labels.tsv'}}

Check failure on line 103 in app/institutions/dashboard/-components/object-list/template.hbs

View workflow job for this annotation

GitHub Actions / lint

Incorrect indentation for `{{t}}` beginning at L103:C43. Expected `{{t}}` to be at an indentation of 40 but was found at 43.
</Button>
</dd.content>
</ResponsiveDropdown>
</div>
</div>
</div>
<div local-class='table-wrapper'>
Expand Down
7 changes: 7 additions & 0 deletions translations/en-us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,13 @@ institutions:
title: '{institutionName} Dashboard'
download_past_reports_label: 'Previous reports'
download_csv: 'Download CSV'
download_tsv: 'Download TSV'
format_labels:
csv: '.csv'
tsv: '.tsv'
json_table: 'JSON (table)'
json_direct: 'JSON (direct)'
download: 'Download'
select_default: 'All Departments'
users_list:
name: Name
Expand Down

0 comments on commit a824196

Please sign in to comment.