Skip to content

Commit

Permalink
pkp#9914 sort services by start date and display user name and affili…
Browse files Browse the repository at this point in the history
…ation only once on editorial history page, use different text to link to the editorial history form the editorial masthead page
  • Loading branch information
bozana committed Jul 10, 2024
1 parent ce0f337 commit b30a167
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 18 deletions.
5 changes: 5 additions & 0 deletions classes/userGroup/relationships/UserUserGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,9 @@ public function scopeWithMasthead(Builder $query): Builder
{
return $query->where('user_user_groups.masthead', 1);
}

public function scopeSortBy(Builder $query, string $column, ?string $direction = 'asc')
{
return $query->orderBy('user_user_groups.' . $column, $direction);
}
}
9 changes: 9 additions & 0 deletions locale/en/common.po
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ msgstr "Principal Contact"
msgid "about.contact.supportContact"
msgstr "Support Contact"

msgid "about.editorialMasthead.linkToEditorialHistory"
msgstr "View <a href=\"{$url}\">Editorial History</a>"

msgid "about.other"
msgstr "Other"

Expand Down Expand Up @@ -160,6 +163,12 @@ msgstr "The editors express their appreciation of the reviewers for {$year} list
msgid "common.editorialHistory"
msgstr "Editorial History"

msgid "common.editorialHistory.page"
msgstr "Editorial History Page"

msgid "common.editorialHistory.page.description"
msgstr "This section lists past contributors."

msgid "common.name"
msgstr "Name"

Expand Down
1 change: 1 addition & 0 deletions pages/about/AboutContextHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public function editorialHistory($args, $request)
->withUserGroupId($mastheadUserGroup->getId())
->withEnded()
->withMasthead()
->sortBy('date_start', 'desc')
->get();
$services = [];
foreach ($userUserGroups as $userUserGroup) {
Expand Down
35 changes: 20 additions & 15 deletions templates/frontend/pages/editorialHistory.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,39 @@
<div class="page page_masthead">
{include file="frontend/components/breadcrumbs.tpl" currentTitleKey="common.editorialHistory"}

<h1>{translate key="common.editorialHistory"}</h1>
<h1>{translate key="common.editorialHistory.page"}</h1>
<p>{translate key="common.editorialHistory.page.description"}</p>
{foreach from=$mastheadRoles item="mastheadRole"}
{if array_key_exists($mastheadRole->getId(), $mastheadUsers)}
<h2>{$mastheadRole->getLocalizedName()|escape}</h2>
<ul>
{foreach from=$mastheadUsers[$mastheadRole->getId()] item="mastheadUser"}
{foreach from=$mastheadUser['services'] item="service"}
{foreach from=$mastheadUsers[$mastheadRole->getId()] item="mastheadUser"}
<li>
<ul id="commaList">
<li>{$mastheadUser['user']->getFullName()|escape}</li>
{if !empty($mastheadUser['user']->getLocalizedData('affiliation'))}
<li>{$mastheadUser['user']->getLocalizedData('affiliation')|escape}</li>
{/if}
<li>{translate key="common.fromUntil" from=$service['dateStart'] until=$service['dateEnd']}</li>
{if $mastheadUser['user']->getData('orcid')}
<span class="orcid">
{if $mastheadUser['user']->getData('orcidAccessToken')}
{$orcidIcon}
{/if}
<a href="{$mastheadUser['user']->getData('orcid')|escape}" target="_blank">
{$mastheadUser['user']->getData('orcid')|escape}
</a>
</span>
{/if}
<li>
{foreach from=$mastheadUser['services'] item="service"}
<ul>
<li>{translate key="common.fromUntil" from=$service['dateStart'] until=$service['dateEnd']}</li>
</ul>
{/foreach}
</li>
</ul>
{if $mastheadUser['user']->getData('orcid')}
<span class="orcid">
{if $mastheadUser['user']->getData('orcidAccessToken')}
{$orcidIcon}
{/if}
<a href="{$mastheadUser['user']->getData('orcid')|escape}" target="_blank">
{$mastheadUser['user']->getData('orcid')|escape}
</a>
</span>
{/if}
</li>
{/foreach}
{/foreach}
</ul>
{/if}
{/foreach}
Expand Down
5 changes: 2 additions & 3 deletions templates/frontend/pages/editorialMasthead.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@
{/foreach}

<p>
<a href="{url page="about" op="editorialHistory" router=\PKP\core\PKPApplication::ROUTE_PAGE}">
{translate key="common.editorialHistory"}
</a>
{capture assign=editorialHistoryUrl}{url page="about" op="editorialHistory" router=\PKP\core\PKPApplication::ROUTE_PAGE}{/capture}
{translate key="about.editorialMasthead.linkToEditorialHistory" url=$editorialHistoryUrl}
</p>

{if !empty($reviewers)}
Expand Down

0 comments on commit b30a167

Please sign in to comment.