Skip to content

Commit

Permalink
Fix merge of changes in restricted content into object actions
Browse files Browse the repository at this point in the history
  • Loading branch information
bbpennel committed Dec 2, 2024
1 parent 79ab08a commit 978ded0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
<template>
<div class="column is-narrow action-btn item-actions">
<div v-if="hasPermission(recordData, 'editDescription')" class="actionlink">
<a class="edit button action" :href="editDescriptionUrl(recordData.briefObject.id)"><i class="fa fa-edit"></i> {{ $t('full_record.edit') }}</a>
</div>
<template v-if="recordData.resourceType === 'File'">
<div v-if="restrictedContent && !isLoggedIn" class="column is-narrow item-actions">
<div class="restricted-access actions">
<h2 class="has-text-centered">{{ $t('full_record.restricted_content', { resource_type: recordData.briefObject.type.toLowerCase() }) }}</h2>
<template v-if="recordData.resourceType !== 'Work'">
<div v-if="restrictedContent && !isLoggedIn" class="column is-narrow item-actions has-text-centered">
<div class="restricted-access">
<h2>{{ $t('full_record.restricted_content', { resource_type: recordData.briefObject.type.toLowerCase() }) }}</h2>
<download-options :record-data="recordData.briefObject" :t="$t"></download-options>
</div>
</div>
<template v-else>
<div v-else class="field is-grouped is-justify-content-right">
<download-options :record-data="recordData.briefObject" :t="$t"></download-options>
<div class="actionlink" v-if="hasPermission(recordData, 'viewOriginal')">
<a class="button view action" :href="recordData.dataFileUrl">
<i class="fa fa-search" aria-hidden="true"></i> View</a>
</div>
</template>
<template v-if="hasPermission(recordData, 'viewHidden')">
<single-use-link :uuid="recordData.briefObject.id"></single-use-link>
</template>
</template>
<template v-if="recordData.resourceType === 'Folder' || recordData.resourceType === 'Collection'">
<div v-if="restrictedContent && !isLoggedIn" class="column is-narrow item-actions">
<div class="restricted-access actions">
<h2 class="has-text-centered">{{ $t('full_record.restricted_content', { resource_type: recordData.briefObject.type.toLowerCase() }) }}</h2>
<download-options :record-data="recordData.briefObject" :t="$t"></download-options>
</div>
<a class="button view action" :href="recordData.dataFileUrl" v-if="hasPermission(recordData, 'viewOriginal')">
<i class="fa fa-search" aria-hidden="true"></i> View</a>
</div>
</template>
<div v-if="hasPermission(recordData, 'editDescription')" class="field is-grouped is-justify-content-right">
<a class="edit button action is-primary" :href="editDescriptionUrl(recordData.briefObject.id)"><span class="icon"><i class="fa fa-edit"></i></span><span>{{ $t('full_record.edit') }}</span></a>
</div>
<div v-if="recordData.resourceType === 'File' && hasPermission(recordData, 'viewHidden')" class="is-justify-content-right">
<single-use-link :uuid="recordData.briefObject.id"></single-use-link>
</div>
</div>
</template>

Expand Down Expand Up @@ -62,13 +52,6 @@ export default {
}
@media (max-width: 768px) {
.actionlink {
text-align: left;
margin: auto;
justify-content: left;
width: 99%;
}
.action-btn {
padding-right: 0;
}
Expand Down
4 changes: 1 addition & 3 deletions static/js/vue-cdr-access/tests/unit/objectActions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,7 @@ describe('objectActions.vue', () => {
});

it('shows view options if a user is not logged in and access is restricted', () => {
expect(wrapper.find('.restricted-access.actions').exists()).toBe(true);
expect(wrapper.find('.restricted-access.actions .login-link').exists()).toBe(true);
expect(wrapper.find('.restricted-access.actions .contact').exists()).toBe(true);
expect(wrapper.find('.restricted-access').exists()).toBe(true);
});

it('does not show a login option if a user is not logged in and logging in does not grant further access', async () => {
Expand Down

0 comments on commit 978ded0

Please sign in to comment.