Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 15 additions & 0 deletions database/factories/ComponentGroupFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Cachet\Database\Factories;

use Cachet\Enums\ComponentGroupVisibilityEnum;
use Cachet\Enums\ResourceOrderColumnEnum;
use Cachet\Enums\ResourceOrderDirectionEnum;
use Cachet\Models\ComponentGroup;
use Illuminate\Database\Eloquent\Factories\Factory;

Expand All @@ -23,7 +25,20 @@ public function definition(): array
return [
'name' => fake()->word,
'order' => 0,
'order_column' => ResourceOrderColumnEnum::Manual,
'order_direction' => null,
'visible' => ComponentGroupVisibilityEnum::expanded->value,
];
}

/**
* Order the group's components by the given column and direction.
*/
public function orderedBy(ResourceOrderColumnEnum $column, ?ResourceOrderDirectionEnum $direction = ResourceOrderDirectionEnum::Asc): static
{
return $this->state(fn (array $attributes) => [
'order_column' => $column,
'order_direction' => $column === ResourceOrderColumnEnum::Manual ? null : $direction,
]);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use Cachet\Enums\ResourceOrderColumnEnum;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('component_groups', function (Blueprint $table) {
$table->string('order_column')->nullable()->after('order');
$table->char('order_direction', 4)->nullable()->after('order_column');
});

DB::table('component_groups')->update(['order_column' => ResourceOrderColumnEnum::Manual->value]);
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('component_groups', function (Blueprint $table) {
$table->dropColumn([
'order_column',
'order_direction',
]);
});
}
};
3 changes: 3 additions & 0 deletions resources/lang/de/component_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'name' => 'Name',
'visible' => 'Sichtbar',
'collapsed' => 'Ausgeklappt',
'order_column' => 'Sortierung der Komponentengruppe',
'created_at' => 'Erstellt am',
'updated_at' => 'Aktualisiert am',
],
Expand All @@ -25,5 +26,7 @@
'name_label' => 'Name',
'visible_label' => 'Sichtbar',
'collapsed_label' => 'Ausgeklappt',
'order_column_label' => 'Sortierung der Komponentengruppe',
'order_direction' => 'Sortierrichtung',
],
];
11 changes: 11 additions & 0 deletions resources/lang/de/resource.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?php

return [
'order_column' => [
'id' => 'ID',
'last_updated' => 'Zuletzt aktualisiert',
'name' => 'Name',
'manual' => 'Manuell',
'status' => 'Status',
],
'order_direction' => [
'asc' => 'Aufsteigend',
'desc' => 'Absteigend',
],
'visibility' => [
'authenticated' => 'Benutzer',
'guest' => 'Gäste',
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/de_AT/component_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'name' => 'Name',
'visible' => 'Sichtbar',
'collapsed' => 'Ausgeklappt',
'order_column' => 'Sortierung der Komponentengruppe',
'created_at' => 'Erstellt am',
'updated_at' => 'Aktualisiert am',
],
Expand All @@ -25,5 +26,7 @@
'name_label' => 'Name',
'visible_label' => 'Sichtbar',
'collapsed_label' => 'Ausgeklappt',
'order_column_label' => 'Sortierung der Komponentengruppe',
'order_direction' => 'Sortierrichtung',
],
];
11 changes: 11 additions & 0 deletions resources/lang/de_AT/resource.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?php

return [
'order_column' => [
'id' => 'ID',
'last_updated' => 'Zuletzt aktualisiert',
'name' => 'Name',
'manual' => 'Manuell',
'status' => 'Status',
],
'order_direction' => [
'asc' => 'Aufsteigend',
'desc' => 'Absteigend',
],
'visibility' => [
'authenticated' => 'Benutzer',
'guest' => 'Gäste',
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/de_CH/component_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'name' => 'Name',
'visible' => 'Sichtbar',
'collapsed' => 'Ausgeklappt',
'order_column' => 'Sortierung der Komponentengruppe',
'created_at' => 'Erstellt am',
'updated_at' => 'Aktualisiert am',
],
Expand All @@ -25,5 +26,7 @@
'name_label' => 'Name',
'visible_label' => 'Sichtbar',
'collapsed_label' => 'Ausgeklappt',
'order_column_label' => 'Sortierung der Komponentengruppe',
'order_direction' => 'Sortierrichtung',
],
];
11 changes: 11 additions & 0 deletions resources/lang/de_CH/resource.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?php

return [
'order_column' => [
'id' => 'ID',
'last_updated' => 'Zuletzt aktualisiert',
'name' => 'Name',
'manual' => 'Manuell',
'status' => 'Status',
],
'order_direction' => [
'asc' => 'Aufsteigend',
'desc' => 'Absteigend',
],
'visibility' => [
'authenticated' => 'Benutzer',
'guest' => 'Gäste',
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/en/component_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'name' => 'Name',
'visible' => 'Visible',
'collapsed' => 'Collapsed',
'order_column' => 'Component Group Order',
'created_at' => 'Created at',
'updated_at' => 'Updated at',
],
Expand All @@ -25,5 +26,7 @@
'name_label' => 'Name',
'visible_label' => 'Visible',
'collapsed_label' => 'Collapsed',
'order_column_label' => 'Component Group Order',
'order_direction' => 'Order Direction',
],
];
11 changes: 11 additions & 0 deletions resources/lang/en/resource.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?php

return [
'order_column' => [
'id' => 'ID',
'last_updated' => 'Last Updated',
'name' => 'Name',
'manual' => 'Manual',
'status' => 'Status',
],
'order_direction' => [
'asc' => 'Ascending',
'desc' => 'Descending',
],
'visibility' => [
'authenticated' => 'Users',
'guest' => 'Guests',
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/es_ES/component_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'name' => 'Nombre',
'visible' => 'Visible',
'collapsed' => 'Colapsado',
'order_column' => 'Orden del Grupo de Componentes',
'created_at' => 'Creado el',
'updated_at' => 'Actualizado el',
],
Expand All @@ -25,5 +26,7 @@
'name_label' => 'Nombre',
'visible_label' => 'Visible',
'collapsed_label' => 'Colapsado',
'order_column_label' => 'Orden del Grupo de Componentes',
'order_direction' => 'Dirección del Orden',
],
];
11 changes: 11 additions & 0 deletions resources/lang/es_ES/resource.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?php

return [
'order_column' => [
'id' => 'ID',
'last_updated' => 'Última Actualización',
'name' => 'Nombre',
'manual' => 'Manual',
'status' => 'Estado',
],
'order_direction' => [
'asc' => 'Ascendente',
'desc' => 'Descendente',
],
'visibility' => [
'authenticated' => 'Usuarios',
'guest' => 'Invitados',
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/fr/component_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'name' => 'Nom',
'visible' => 'Visible',
'collapsed' => 'Réduit',
'order_column' => 'Ordre du groupe de composants',
'created_at' => 'Créé le',
'updated_at' => 'Mis à jour le',
],
Expand All @@ -25,5 +26,7 @@
'name_label' => 'Nom',
'visible_label' => 'Visible',
'collapsed_label' => 'Réduit',
'order_column_label' => 'Ordre du groupe de composants',
'order_direction' => 'Sens du tri',
],
];
11 changes: 11 additions & 0 deletions resources/lang/fr/resource.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?php

return [
'order_column' => [
'id' => 'ID',
'last_updated' => 'Dernière mise à jour',
'name' => 'Nom',
'manual' => 'Manuel',
'status' => 'Statut',
],
'order_direction' => [
'asc' => 'Croissant',
'desc' => 'Décroissant',
],
'visibility' => [
'authenticated' => 'Utilisateurs',
'guest' => 'Invités',
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/ko/component_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'name' => '이름',
'visible' => '표시 여부',
'collapsed' => '축소 여부',
'order_column' => '구성 요소 그룹 정렬',
'created_at' => '생성 시간',
'updated_at' => '업데이트 시간',
],
Expand All @@ -25,5 +26,7 @@
'name_label' => '이름',
'visible_label' => '표시 여부',
'collapsed_label' => '축소 여부',
'order_column_label' => '구성 요소 그룹 정렬',
'order_direction' => '정렬 방향',
],
];
11 changes: 11 additions & 0 deletions resources/lang/ko/resource.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?php

return [
'order_column' => [
'id' => 'ID',
'last_updated' => '마지막 업데이트',
'name' => '이름',
'manual' => '수동',
'status' => '상태',
],
'order_direction' => [
'asc' => '오름차순',
'desc' => '내림차순',
],
'visibility' => [
'authenticated' => '사용자',
'guest' => '게스트',
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/nl/component_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'name' => 'Naam',
'visible' => 'Zichtbaar',
'collapsed' => 'Uitgevouwen',
'order_column' => 'Volgorde componentgroep',
'created_at' => 'Gemaakt op',
'updated_at' => 'Bijgewerkt op',
],
Expand All @@ -25,5 +26,7 @@
'name_label' => 'Naam',
'visible_label' => 'Zichtbaar',
'collapsed_label' => 'Uitgevouwen',
'order_column_label' => 'Volgorde componentgroep',
'order_direction' => 'Sorteerrichting',
],
];
11 changes: 11 additions & 0 deletions resources/lang/nl/resource.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?php

return [
'order_column' => [
'id' => 'ID',
'last_updated' => 'Laatst bijgewerkt',
'name' => 'Naam',
'manual' => 'Handmatig',
'status' => 'Status',
],
'order_direction' => [
'asc' => 'Oplopend',
'desc' => 'Aflopend',
],
'visibility' => [
'authenticated' => 'Gebruiker',
'guest' => 'Gasten',
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/ph/component_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'name' => 'Pangalan',
'visible' => 'Nakikita',
'collapsed' => 'Nakasara',
'order_column' => 'Pagkakasunod-sunod ng Grupo ng Komponent',
'created_at' => 'Ginawa Noong',
'updated_at' => 'Na-update Noong',
],
Expand All @@ -25,5 +26,7 @@
'name_label' => 'Pangalan',
'visible_label' => 'Nakikita',
'collapsed_label' => 'Nakasara',
'order_column_label' => 'Pagkakasunod-sunod ng Grupo ng Komponent',
'order_direction' => 'Direksyon ng Pagkakasunod-sunod',
],
];
11 changes: 11 additions & 0 deletions resources/lang/ph/resource.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?php

return [
'order_column' => [
'id' => 'ID',
'last_updated' => 'Huling Na-update',
'name' => 'Pangalan',
'manual' => 'Manu-mano',
'status' => 'Katayuan',
],
'order_direction' => [
'asc' => 'Pataas',
'desc' => 'Pababa',
],
'visibility' => [
'authenticated' => 'Mga Gumagamit',
'guest' => 'Mga Bisita',
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/pt_BR/component_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'name' => 'Nome',
'visible' => 'Visível',
'collapsed' => 'Recolhido',
'order_column' => 'Ordem do Grupo de Componentes',
'created_at' => 'Criado em',
'updated_at' => 'Atualizado em',
],
Expand All @@ -25,5 +26,7 @@
'name_label' => 'Nome',
'visible_label' => 'Visível',
'collapsed_label' => 'Recolhido',
'order_column_label' => 'Ordem do Grupo de Componentes',
'order_direction' => 'Direção da Ordenação',
],
];
Loading
Loading