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

pkp/pkp-lib#9744 [OJS] Migrate older Tables to newer Table API #4378

Merged
merged 10 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion lib/pkp
35 changes: 17 additions & 18 deletions templates/stats/issues.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,10 @@
</pkp-header>
<pkp-table
labelled-by="issueDetailTableLabel"
:class="tableClasses"
@sort="setOrderBy"
>
<table-header>
<table-column
<pkp-table-header>
<pkp-table-column
v-for="column in tableColumns"
:key="column.name"
:id="column.name"
Expand All @@ -166,37 +165,37 @@
<template v-else>
{{ column.label }}
</template>
</table-column>
</table-header>
<table-body>
<table-row v-for="(row) in items" :key="row.key">
<table-cell>
</pkp-table-column>
</pkp-table-header>
<pkp-table-body>
<pkp-table-row v-for="(row) in items" :key="row.key">
<pkp-table-cell>
<a
:href="row.issue.publishedUrl"
class="pkpStats__itemLink"
target="_blank"
>
<span class="pkpStats__itemTitle">{{ row.issue.identification }}</span>
</a>
</table-cell>
<table-cell>{{ row.tocViews }}</table-cell>
<table-cell>{{ row.issueGalleyViews }}</table-cell>
<table-cell>{{ row.totalViews }}</table-cell>
</table-row>
</pkp-table-cell>
<pkp-table-cell>{{ row.tocViews }}</pkp-table-cell>
<pkp-table-cell>{{ row.issueGalleyViews }}</pkp-table-cell>
<pkp-table-cell>{{ row.totalViews }}</pkp-table-cell>
</pkp-table-row>
<template #no-content v-if="!items.length">
<table-row class="pkpStats__noRecords">
<table-cell :colspan="tableColumns.length" class="!py-8 !px-4 !text-center">
<pkp-table-row class="pkpStats__noRecords">
<pkp-table-cell :colspan="tableColumns.length" class="!py-8 !px-4 !text-center">
<template v-if="isLoadingItems">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ops.. here you can just use table-cell.

Reason why we expose the components with pkp prefix globally is so plugins can use them.

On our own pages&components we always import and register them locally. So for stats you are adding table-cell via 'components:'.. therefore no need to prefix that.

Also the no-content thingy is already supposed to insert correct row and cell with correct colspan. So you should just put there the spinner. But if its not working as expected let me know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I updated the component names now to use the local version. And remove the table-row and table-cell for the no-content slot.

<spinner></spinner>
{translate key="common.loading"}
</template>
<template v-else>
{translate key="stats.issues.none"}
</template>
</table-cell>
</table-row>
</pkp-table-cell>
</pkp-table-row>
</template>
</table-body>
</pkp-table-body>
</pkp-table>
<pagination
v-if="lastPage > 1"
Expand Down