Skip to content

Commit

Permalink
pkp/pkp-lib#9468 exclude chapters without landing page and DOI from D…
Browse files Browse the repository at this point in the history
…OI assignment
  • Loading branch information
bozana committed Aug 23, 2024
1 parent f36ba46 commit 3995c09
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/components/ListPanel/doi/DoiItemVersionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@
>
<template #default="{row}">
<TableCell :column="doiListColumns[0]" :row="row">
<label :for="row.uid">{{ row.displayType }}</label>
<label
:for="row.uid"
v-bind:class="{labelDisabled: row.disabled}"
>
{{ row.displayType }}
</label>
</TableCell>
<TableCell :column="doiListColumns[1]" :row="row">
<input
Expand All @@ -37,10 +42,14 @@
class="pkpFormField__input pkpFormField--text__input"
type="text"
:readonly="!(isEditingDois && !isSaving)"
:disabled="isEditingDois && row.disabled"
/>
</TableCell>
</template>
</PkpTable>
<span v-if="item.hasDisabled">
{{ item.hasDisabledMsg }}
</span>
</div>

<div class="doiListItem__versionContainer--actionsBar">
Expand Down Expand Up @@ -108,4 +117,8 @@ function getVersionHeader(version) {
justify-content: flex-end;
margin-top: 0.5rem;
}
.labelDisabled {
color: #4e4f4f;
}
</style>
15 changes: 14 additions & 1 deletion src/components/ListPanel/doi/DoiListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
<PkpTable :columns="doiListColumns" :rows="currentVersionDoiObjects">
<template #default="{row}">
<TableCell :column="doiListColumns[0]" :row="row">
<label :for="row.uid">{{ row.displayType }}</label>
<label :for="row.uid" :class="{labelDisabled: row.disabled}">
{{ row.displayType }}
</label>
</TableCell>
<TableCell :column="doiListColumns[1]" :row="row">
<input
Expand All @@ -81,10 +83,14 @@
class="pkpFormField__input pkpFormField--text__input"
type="text"
:readonly="!(isEditingDois && !isSaving)"
:disabled="isEditingDois && row.disabled"
/>
</TableCell>
</template>
</PkpTable>
<span v-if="item.hasDisabled">
{{ item.hasDisabledMsg }}
</span>
<div
class="listPanel__itemExpandedActions doiListPanel__itemExpandedActions"
>
Expand Down Expand Up @@ -236,6 +242,7 @@ export default {
* @property {string} uid - Unique identifier for item in list
* @property {string} updateWithNewDoiEndpoint - API endpoint to add new DOI to item if none exists
* @property {string} registrationAgency - Name of registration agency if registered, null if marked manually registered
* @property {boolean} disabled - Whether object is disabled for DOI assignment i.e. a DOI cannot be assigned to the object
*/
/**
* Details about top-level publication object and its DOIs
Expand All @@ -247,6 +254,8 @@ export default {
* @property {boolean} isPublished - Whether item published
* @property {PublicationVersionInfo} versions - Info on publication version
* @property {DoiObject[]} doiObjects - All associated publication objects than can have a DOI
* @property {boolean} hasDisabled - Whether an associated publication object is disabled for DOI assignment
* @property {string} hasDisabledMsg - Message to display if there is a disabled associated publication object
*/
/** @type {DoiListItemData} */
item: {
Expand Down Expand Up @@ -908,4 +917,8 @@ export default {
.doiListPanel__itemExpandedActions--actionsBar {
padding-right: 0.5rem;
}
.labelDisabled {
color: #4e4f4f;
}
</style>
19 changes: 19 additions & 0 deletions src/components/ListPanel/doi/DoiListPanelOMP.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default {
isCurrentVersion,
versionNumber,
updateWithNewDoiEndpoint,
disabled: !chapter.isPageEnabled && !doiObject,
}),
);
});
Expand Down Expand Up @@ -122,8 +123,26 @@ export default {
});
}
});
if (this.containsDisabled(newMappedItem)) {
newMappedItem.hasDisabled = true;
newMappedItem.hasDisabledMsg = this.t(
'manager.dois.disabledChaptersDescription',
);
}
return newMappedItem;
},
/**
* Whether this item contains objects that are disabled for DOI assignment
*
* @return {boolean}
*/
containsDisabled(item) {
const hasAnyDisabled = item.doiObjects.some(
(doiObject) =>
doiObject.type == 'chapter' && doiObject.disabled == true,
);
return hasAnyDisabled;
},
/**
* Gets the title to be used in mapped object with app-specific implementation.
*
Expand Down

0 comments on commit 3995c09

Please sign in to comment.