Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
.FileList__item__options {
display: flex;
align-items: center;
flex: 1;
padding-right: 2vw;
}

.FileList__item__name {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
data-test-file-list-download-count
local-class='FileList__item__download_count'
>
{{t 'osf-components.file-browser.download_count' count=@item.fileModel.extra.downloads}}
{{#if (has-key @item.fileModel.extra 'downloads')}}
{{t 'osf-components.file-browser.download_count' count=@item.fileModel.extra.downloads}}
{{/if}}
</div>
<div
data-test-file-list-size
Expand All @@ -78,7 +80,10 @@
{{/if}}
</div>
{{/if}}
<div data-test-file-list-options local-class='FileList__item__options'>
<div
data-test-file-list-options
local-class='FileList__item__options'
>
{{#unless @manager.selectedFiles}}
<FileActionsMenu @item={{@item}} @onDelete={{@manager.reload}} @manager={{@manager}} @allowRename={{true}} />
{{/unless}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
.FileList__item__options {
display: flex;
align-items: center;
flex: 1;
padding-right: 2vw;
}

.MobileDropdownTrigger {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
{{#if this.showActionsDropdown}}
<div
data-test-file-list-date
local-class='FileList__item__options NoShrink {{if (or this.media.isTablet this.media.isMobile) 'MobileDropdownTrigger'}}'
local-class='
FileList__item__options
NoShrink
{{if (or this.media.isTablet this.media.isMobile) 'MobileDropdownTrigger'}}
'
>
<ResponsiveDropdown
local-class='DownloadShareDropdown'
Expand Down
10 changes: 10 additions & 0 deletions lib/osf-components/addon/helpers/has-key.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { helper } from '@ember/component/helper';

export function hasKey([object, key]: [any, any]): any {
if (object) {
return (key in object);
}
return false;
}

export default helper(hasKey);
1 change: 1 addition & 0 deletions lib/osf-components/app/helpers/has-key.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'osf-components/helpers/has-key';
19 changes: 19 additions & 0 deletions tests/unit/helpers/has-key-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { hasKey } from 'osf-components/helpers/has-key';
import { module, test } from 'qunit';

module('Unit | Helper | has-key', () => {
test('returns correct boolean value', assert => {
const object = { itzy: 'hey' };
const absentKey = 'twice';
const existingKey = 'itzy';
assert.equal(hasKey([object, absentKey]), false);
assert.equal(hasKey([object, existingKey]), true);
});

test('returns false when object is null or undefined', assert => {
// eslint-disable-next-line no-undef-init
const object = undefined;
assert.equal(hasKey([null, 'a']), false);
assert.equal(hasKey([object, 'b']), false);
});
});