Refactor project links and add click event handlers

This commit is contained in:
Andras Bacsai 2024-04-08 13:04:33 +02:00
parent 8bf0561009
commit 85fb27a631

View File

@ -19,22 +19,17 @@
@if ($projects->count() > 0) @if ($projects->count() > 0)
<div class="grid grid-cols-1 gap-2 xl:grid-cols-2"> <div class="grid grid-cols-1 gap-2 xl:grid-cols-2">
@foreach ($projects as $project) @foreach ($projects as $project)
<div class="gap-2 border border-transparent cursor-pointer box group"> <div class="gap-2 border border-transparent cursor-pointer box group"
@if (data_get($project, 'environments')->count() === 1) @if (data_get($project, 'environments')->count() === 1) onclick="gotoProject('{{ data_get($project, 'uuid') }}', '{{ data_get($project, 'environments.0.name', 'production') }}')"
<a class="flex flex-col justify-center flex-1 mx-6" @else
href="{{ route('project.resource.index', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => data_get($project, 'environments.0.name', 'production')]) }}"> onclick="window.location.href = '{{ route('project.show', ['project_uuid' => data_get($project, 'uuid')]) }}'" @endif>
<div class="box-title">{{ $project->name }}</div> <div class="flex flex-col justify-center flex-1 mx-6">
<div class="box-description"> {{ $project->description }}</div> <div class="box-title">{{ $project->name }}</div>
</a> <div class="box-description">
@else {{ $project->description }}</div>
<a class="flex flex-col justify-center flex-1 mx-6" </div>
href="{{ route('project.show', ['project_uuid' => data_get($project, 'uuid')]) }}"> <span
<div class="box-title">{{ $project->name }}</div> class="flex items-center justify-center gap-2 pt-4 pb-2 mr-4 text-xs lg:py-0 lg:justify-normal">
<div class="box-description">
{{ $project->description }}</div>
</a>
@endif
<div class="flex items-center justify-center gap-2 pt-4 pb-2 mr-4 text-xs lg:py-0 lg:justify-normal">
<a class="hover:underline" <a class="hover:underline"
href="{{ route('project.resource.create', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => data_get($project, 'environments.0.name', 'production')]) }}"> href="{{ route('project.resource.create', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => data_get($project, 'environments.0.name', 'production')]) }}">
<span class="p-2 font-bold">+ <span class="p-2 font-bold">+
@ -44,7 +39,7 @@
href="{{ route('project.edit', ['project_uuid' => data_get($project, 'uuid')]) }}"> href="{{ route('project.edit', ['project_uuid' => data_get($project, 'uuid')]) }}">
Settings Settings
</a> </a>
</div> </span>
</div> </div>
@endforeach @endforeach
</div> </div>