Skip to content

Commit

Permalink
Merge pull request #1690 from griidc/release/6.66.0
Browse files Browse the repository at this point in the history
Release/6.66.0
  • Loading branch information
mickel1138 authored Dec 12, 2024
2 parents 9ff6bf1 + 5e2ab10 commit fd6ba50
Show file tree
Hide file tree
Showing 30 changed files with 756 additions and 33 deletions.
14 changes: 14 additions & 0 deletions assets/css/activeInactive.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.active {
transition: opacity 0.25s ease-in-out;
opacity: 1;
height: auto;
}
.inactive {
transition: opacity 0.25s ease-in-out;
opacity: 0.5;
height: 0;
overflow: hidden;
}
li {
margin-bottom: revert!important;
}
7 changes: 7 additions & 0 deletions assets/js/entry/landing-page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import '../../scss/landing-pages.scss';
import '../../css/activeInactive.css';
import Alpine from 'alpinejs';
import '../modules/cardClick';

window.Alpine = Alpine;
Alpine.start();
17 changes: 17 additions & 0 deletions assets/js/modules/cardClick.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const cardClick = () => {
document.querySelectorAll('.card').forEach((card) => {
const cardElement = card;
cardElement.onclick = () => {
if (window.getSelection().toString() === '') {
const link = card.querySelector('a');
if (typeof (link) !== 'undefined' && link != null) {
link.click();
}
}
};
});
};

export default { cardClick };

cardClick();
1 change: 0 additions & 1 deletion assets/js/vue/ResearchGroupApp.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div class="container" ref="formContainer">
<hr>
<b-card no-body class="main-card">
<b-tabs pills fill justified card v-if="showData" lazy vertical class="min-vh-100">
<b-tab title="Overview">
Expand Down
16 changes: 11 additions & 5 deletions assets/js/vue/components/research-group/PeopleTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
v-for="person in sortedPeople"
:key="person.id"
:title="person.person.firstName + ' ' + person.person.lastName"
:sub-title="person.label" style="min-width: 18rem; max-width: 27rem">
<b-card-text v-tooltip="{
content: person.person.organization,
placement:'top'
}">
:sub-title="person.label" style="min-width: 18rem; max-width: 27rem; cursor: pointer;"
@click="openUrl(person)">
<b-card-text>
{{ person.person.organization | truncate(75) }}
</b-card-text>
<b-card-text class="text-muted">
Expand All @@ -32,6 +30,14 @@ export default {
created() {
this.sortedPeople = this.$options.filters.sort('person.lastName', this.personResearchGroups);
},
methods: {
openUrl(person) {
window.open(
// eslint-disable-next-line no-undef
`${Routing.generate('app_person_land', { person: person.person.id })}`, '_blank',
);
},
},
};
</script>

Expand Down
21 changes: 21 additions & 0 deletions assets/scss/components/badge.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@layer components {
.badge {
@apply inline-flex items-center gap-x-1.5 py-1 px-2 rounded-md text-xs font-medium bg-blue-600 text-white shadow-sm font-bold text-[13.5px];
}

.badge-pill {
@apply rounded-full gap-x-1 py-1 px-2 min-w-8 text-center items-center justify-center;
}

.badge-primary {@apply bg-primary text-white;}
.badge-secondary {@apply bg-secondary text-white;}
.badge-alternate {@apply bg-alternate text-white;}
.badge-itemtype {@apply bg-itemtype text-white;}
.badge-restricted {@apply bg-restricted text-white;}
.badge-available {@apply bg-available text-white;}
.badge-submitted {@apply bg-submitted text-white;}
.badge-identified {@apply bg-identified text-black;}
.badge-coldstorage {@apply bg-coldstorage text-black;}
.badge-ncei {@apply bg-ncei text-white;}
.badge-erddap {@apply bg-erddap text-black;}
}
6 changes: 6 additions & 0 deletions assets/scss/components/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@layer components {
.card {
@apply p-4 rounded-lg mb-4 border border-black/[.125] hover:shadow-lg hover:transition-all;
}
}

6 changes: 6 additions & 0 deletions assets/scss/components/links.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@layer components {
.pagelink {
@apply text-blue-600 inline-flex items-center font-medium hover:underline;
}
}

7 changes: 7 additions & 0 deletions assets/scss/landing-pages.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@import 'components/card.scss';
@import 'components/badge.scss';
@import 'components/links.scss';
58 changes: 58 additions & 0 deletions src/Controller/UI/LandingController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace App\Controller\UI;

use App\Entity\FundingCycle;
use App\Entity\Person;
use App\Entity\ResearchGroup;
use App\Repository\InformationProductRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class LandingController extends AbstractController
{
#[Route('/funding-cycle/about/{fundingCycle}', name: 'app_funding_cycle_land')]
public function fundingCycleLand(FundingCycle $fundingCycle, InformationProductRepository $informationProductRepository): Response
{
$informationProducts = $informationProductRepository->findByFundingCycle($fundingCycle);

return $this->render(
'LandingPages/funding-cycle-land.html.twig',
[
'fundingCycle' => $fundingCycle,
'informationProducts' => $informationProducts,
]
);
}

#[Route('/person/about/{person}', name: 'app_person_land')]
public function personLand(Person $person, InformationProductRepository $informationProductRepository): Response
{

$informationProducts = $informationProductRepository->findByPerson($person);

return $this->render(
'LandingPages/person-land.html.twig',
[
'person' => $person,
'informationProducts' => $informationProducts,
]
);
}

#[Route('/research-group/about/{researchGroup}', name: 'pelagos_app_ui_researchgroup_about')]
public function researchGroupLand(ResearchGroup $researchGroup, InformationProductRepository $informationProductRepository): Response
{

$informationProducts = $informationProductRepository->findOneByResearchGroupId($researchGroup->getId());

return $this->render(
'LandingPages/research-group-land.html.twig',
[
'researchGroup' => $researchGroup,
'informationProducts' => $informationProducts,
]
);
}
}
2 changes: 1 addition & 1 deletion src/Controller/UI/ResearchGroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function defaultAction(EntityHandler $entityHandler, FundingOrganizationR
*
* @return Response A Response instance.
*/
#[Route(path: '/research-group/about/{id}', name: 'pelagos_app_ui_researchgroup_about', requirements: ['id' => '\d+'])]
#[Route(path: '/research-group/old/{id}', name: 'pelagos_app_ui_researchgroup_old', requirements: ['id' => '\d+'])]
public function landingPageAction(int $id)
{
return $this->render('ResearchGroup/index.html.twig', ['researchGroupId' => $id]);
Expand Down
44 changes: 44 additions & 0 deletions src/Entity/Dataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,50 @@ public function isAvailable(): bool
);
}

/**
* Check if dataset is Identified.
*/
public function isIdentified(): bool
{
return $this->getDatasetLifecycleStatus() == DatasetLifecycleStatus::IDENTIFIED;
}

/**
* Check if dataset is Submitted.
*/
public function isSubmitted(): bool
{
return $this->getDatasetLifecycleStatus() == DatasetLifecycleStatus::SUBMITTED;
}

/**
* Check if Dataset is in Cold Storage.
*/
public function isColdStored(): bool
{
if ($this->getDatasetSubmission() instanceof DatasetSubmission) {
return $this->getDatasetSubmission()->isDatasetFileInColdStorage();
}

return false;
}

/**
* Check if Dataset has ERDDAP URL.
*/
public function hasErddapUrl(): bool
{
return $this->getDatasetSubmission()?->getErddapUrl() !== null;
}

/**
* Check if Dataset has NCEI URL.
*/
public function hasNceiUrl(): bool
{
return $this->getDatasetSubmission()?->getNceiUrl() !== null;
}

/**
* Whether this Dataset is remotely hosted.
*/
Expand Down
58 changes: 41 additions & 17 deletions src/Entity/FundingCycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Enum\DatasetLifecycleStatus;
use App\Exception\NotDeletableException;
use App\Validator\Constraints as CustomAssert;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
Expand All @@ -14,8 +13,6 @@

/**
* Entity class to represent a Funding Cycle.
*
*
*/
#[ORM\Entity]
#[Assert\GroupSequence(['id', 'unique_id', 'FundingCycle', 'Entity'])]
Expand All @@ -32,8 +29,6 @@ class FundingCycle extends Entity
* Name of a funding cycle.
*
* @var string $name
*
*
*/
#[Assert\Regex(pattern: '/[<>]/', match: false, message: 'Name cannot contain angle brackets (< or >)')]
#[ORM\Column(type: 'citext')]
Expand All @@ -45,7 +40,6 @@ class FundingCycle extends Entity
* Description of a funding cycle.
*
* @var string $description
*
*/
#[Assert\Regex(pattern: '/[<>]/', match: false, message: 'Description cannot contain angle brackets (< or >)')]
#[ORM\Column(type: 'text', nullable: true)]
Expand All @@ -55,7 +49,6 @@ class FundingCycle extends Entity
* Funding cycle's Website url.
*
* @var string $url
*
*/
#[Assert\Regex(pattern: '/[<>]/', match: false, message: 'URL cannot contain angle brackets (< or >)')]
#[ORM\Column(type: 'text', nullable: true)]
Expand All @@ -81,9 +74,6 @@ class FundingCycle extends Entity
* Funding cycle's Funding Organization.
*
* @var FundingOrganization
*
*
*
*/
#[ORM\ManyToOne(targetEntity: 'FundingOrganization', inversedBy: 'fundingCycles')]
#[Serializer\Groups(['organization'])]
Expand All @@ -94,7 +84,7 @@ class FundingCycle extends Entity
/**
* Funding cycle's list of associated research groups.
*
* @var \Doctrine\Common\Collections\Collection
* @var Collection
*/
#[ORM\OneToMany(targetEntity: 'ResearchGroup', mappedBy: 'fundingCycle')]
#[ORM\OrderBy(['name' => 'ASC'])]
Expand All @@ -105,8 +95,6 @@ class FundingCycle extends Entity
* Funding cycle's UDI Prefix.
*
* @var string $udiPrefix
*
*
*/
#[ORM\Column(type: 'text', nullable: false)]
#[Assert\NotBlank(message: 'UDI Prefix is required')]
Expand Down Expand Up @@ -173,7 +161,7 @@ public function getDescription()
*
* @return void
*/
public function setFundingOrganization(FundingOrganization $fundingOrg = null)
public function setFundingOrganization(?FundingOrganization $fundingOrg = null)
{
$this->fundingOrganization = $fundingOrg;
}
Expand Down Expand Up @@ -217,7 +205,7 @@ public function getUrl()
*
* @return void
*/
public function setStartDate(\DateTime $startDate = null)
public function setStartDate(?\DateTime $startDate = null)
{
$this->startDate = $startDate;
}
Expand All @@ -239,7 +227,7 @@ public function getStartDate()
*
* @return void
*/
public function setEndDate(\DateTime $endDate = null)
public function setEndDate(?\DateTime $endDate = null)
{
$this->endDate = $endDate;
}
Expand All @@ -257,7 +245,7 @@ public function getEndDate()
/**
* Getter for getResearchGroups.
*
* @return \Doctrine\Common\Collections\Collection list of funding cycle's research groups
* @return Collection list of funding cycle's research groups
*/
public function getResearchGroups()
{
Expand All @@ -280,6 +268,42 @@ public function getDatasets(): Collection
return $datasets;
}

/**
* Return an array of people.
*/
public function getPeople(): Collection
{
$people = new ArrayCollection();

foreach ($this->getResearchGroups() as $researchGroup) {
foreach ($researchGroup->getPersonResearchGroups() as $personResearchGroup) {
$person = $personResearchGroup->getPerson();
if (!$people->contains($person)) {
$people->add($person);
}
}
}

return $people;
}

/**
* Return a collection of Publications for the Funding Cycle.
*/
public function getPublications(): Collection
{
$publications = new ArrayCollection();
foreach ($this->getDatasets() as $dataset) {
foreach ($dataset->getPublications() as $publication) {
if (!$publications->contains($publication)) {
$publications->add($publication);
}
}
}

return $publications;
}

/**
* Returns datasets by Dataset Lifecycle Status.
*/
Expand Down
Loading

0 comments on commit fd6ba50

Please sign in to comment.