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

Feature: admin labels #350

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions app/Admin/Controllers/Management/AccessController.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ public function index(Content $content)
$grid->addFields([
'description' => 'textarea',
'comment' => 'text'
], [
"comment" => "Commentaire",
], false);

$grid->column('validated_by.lastname', 'Validé par')->display(function () {
Expand All @@ -131,6 +133,9 @@ public function index(Content $content)
'validated' => 'switch',
'validated_at' => 'datetime',
'created_at' => 'datetime',
], [
"validated" => "Validé",
"validated_at" => "Validé le",
]);

$grid->tools(function ($tools) {
Expand Down
24 changes: 23 additions & 1 deletion app/Admin/Controllers/Management/UserPermissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Manage User Permissions.
*
* @author Samy Nastuzzi <[email protected]>
* @author Corentin Mercier <[email protected]>
*
* @copyright Copyright (c) 2019, SiMDE-UTC
* @license GNU GPL-3.0
Expand Down Expand Up @@ -63,6 +64,27 @@ public function getFields(bool $withAll=true)
);
}

/**
* Fields to display labels definition.
*
* @param boolean $withAll Default:true.
* @return array
*/
public function getLabels(bool $withAll=true)
{

$labels = [
'user' => 'Utilisateur',
];

if ($withAll) {
$labels['validated_by'] = "Validé par";
$labels['semester'] = 'Semestre';
}

return $labels;
}

/**
* Global display interface.
*
Expand All @@ -75,7 +97,7 @@ public function index(Content $content)
$userPermissions = Permission::where('owned_by_type', User::class)->get();
$grid::$simplePrint = true;

$grid->addFields($this->getFields());
$grid->addFields($this->getFields(), $this->getLabels());

$grid->tools(function ($tools) {
$tools->disableBatchActions();
Expand Down
25 changes: 24 additions & 1 deletion app/Admin/Controllers/Management/UserRoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Manage User roles.
*
* @author Samy Nastuzzi <[email protected]>
* @author Corentin Mercier <[email protected]>
*
* @copyright Copyright (c) 2019, SiMDE-UTC
* @license GNU GPL-3.0
Expand Down Expand Up @@ -63,6 +64,28 @@ public function getFields(bool $withAll=true)
);
}

/**
* Fields to display labels definition.
*
* @param boolean $withAll Default:true.
* @return array
*/
public function getLabels(bool $withAll=true)
{

$labels = [
'role' => 'Rôle',
'user' => 'Utilisateur',
];

if ($withAll) {
$labels['validated_by'] = "Validé par";
$labels['semester'] = 'Semestre';
}

return $labels;
}

/**
* Global display interface.
*
Expand All @@ -75,7 +98,7 @@ public function index(Content $content)
$userRoles = Role::where('owned_by_type', User::class)->get();
$grid::$simplePrint = true;

$grid->addFields($this->getFields());
$grid->addFields($this->getFields(), $this->getLabels());

$grid->tools(function ($tools) {
$tools->disableBatchActions();
Expand Down
16 changes: 16 additions & 0 deletions app/Admin/Controllers/Resource/AccessController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Manage Accesses as admin.
*
* @author Samy Nastuzzi <[email protected]>
* @author Corentin Mercier <[email protected]>
*
* @copyright Copyright (c) 2018, SiMDE-UTC
* @license GNU GPL-3.0
Expand All @@ -16,6 +17,8 @@ class AccessController extends ResourceController
{
protected $model = Access::class;

protected $name = "Accès";

/**
* Fields to display definition.
*
Expand All @@ -33,4 +36,17 @@ protected function getFields(): array
'updated_at' => 'date'
];
}

/**
* Fields to display labels definition.
*
* @return array
*/
protected function getLabels(): array
{
return [
'name' => 'Nom',
'utc_access' => 'Numéro d\'accès UTC',
];
}
}
17 changes: 17 additions & 0 deletions app/Admin/Controllers/Resource/ArticleActionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Manage ArticleActions as admin.
*
* @author Samy Nastuzzi <[email protected]>
* @author Corentin Mercier <[email protected]>
*
* @copyright Copyright (c) 2018, SiMDE-UTC
* @license GNU GPL-3.0
Expand All @@ -18,6 +19,8 @@ class ArticleActionController extends ResourceController
{
protected $model = ArticleAction::class;

protected $name = "Actions d'articles";

/**
* Fields to display definition.
*
Expand All @@ -41,6 +44,20 @@ protected function getFields(): array
];
}

/**
* Fields to display labels definition.
*
* @return array
*/
protected function getLabels(): array
{
return [
'user' => "Utilisateur",
'key' => 'Clé',
'value' => 'Valeur',
];
}

/**
* Default values definition of the fields to display.
*
Expand Down
20 changes: 20 additions & 0 deletions app/Admin/Controllers/Resource/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Manage Articles as admin.
*
* @author Samy Nastuzzi <[email protected]>
* @author Corentin Mercier <[email protected]>
*
* @copyright Copyright (c) 2018, SiMDE-UTC
* @license GNU GPL-3.0
Expand All @@ -19,6 +20,8 @@ class ArticleController extends ResourceController
{
protected $model = Article::class;

protected $name = "Article";

/**
* Fields to display definition.
*
Expand All @@ -42,6 +45,23 @@ protected function getFields(): array
];
}

/**
* Fields to display labels definition.
*
* @return array
*/
protected function getLabels(): array
{
return [
'title' => 'Titre',
'content' => 'Contenu',
'event' => 'Évènement',
'visibility' => 'Visibilité',
'created_by' => 'Créé par',
'owned_by' => 'Possédé par',
];
}

/**
* Default values definition of the fields to display.
*
Expand Down
23 changes: 23 additions & 0 deletions app/Admin/Controllers/Resource/AssoAccessController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Manage AssosAccesses as admin.
*
* @author Samy Nastuzzi <[email protected]>
* @author Corentin Mercier <[email protected]>
*
* @copyright Copyright (c) 2018, SiMDE-UTC
* @license GNU GPL-3.0
Expand All @@ -20,6 +21,8 @@ class AssoAccessController extends ResourceController
{
protected $model = AssoAccess::class;

protected $name = "Accès par association";

/**
* Fields to display definition.
*
Expand All @@ -44,6 +47,26 @@ protected function getFields(): array
];
}

/**
* Fields to display labels definition.
*
* @return array
*/
protected function getLabels(): array
{
return [
'asso' => 'Association',
'access' => 'Accès',
'member' => 'Membre',
'semester' => 'Semestre',
'confirmed_by' => 'Confirmé par',
'validated_by' => 'Validé par',
'comment' => 'Commentaire',
'validated_at' => 'Validé le',
'validated' => 'Validé',
];
}

/**
* Default values definition of the fields to display.
*
Expand Down
17 changes: 17 additions & 0 deletions app/Admin/Controllers/Resource/AssoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Manage Associations as admin.
*
* @author Samy Nastuzzi <[email protected]>
* @author Corentin Mercier <[email protected]>
*
* @copyright Copyright (c) 2018, SiMDE-UTC
* @license GNU GPL-3.0
Expand All @@ -17,6 +18,8 @@ class AssoController extends ResourceController
{
protected $model = Asso::class;

protected $name = "Association";

/**
* Fields to display definition.
*
Expand All @@ -40,6 +43,20 @@ protected function getFields(): array
];
}

/**
* Fields to display labels definition.
*
* @return array
*/
protected function getLabels(): array
{
return [
'name' => 'Nom Officiel',
'shortname' => 'Nom D\'usage',
'in_cemetery_at' => 'Mis au cimetière le',
];
}

/**
* Return dependencies.
*
Expand Down
15 changes: 15 additions & 0 deletions app/Admin/Controllers/Resource/AssoTypeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Manage Association Types as admin.
*
* @author Samy Nastuzzi <[email protected]>
* @author Corentin Mercier <[email protected]>
*
* @copyright Copyright (c) 2018, SiMDE-UTC
* @license GNU GPL-3.0
Expand All @@ -16,6 +17,8 @@ class AssoTypeController extends ResourceController
{
protected $model = AssoType::class;

protected $name = "Types d'association";

/**
* Fields to display definition.
*
Expand All @@ -31,4 +34,16 @@ protected function getFields(): array
'updated_at' => 'date',
];
}

/**
* Fields to display labels definition.
*
* @return array
*/
protected function getLabels(): array
{
return [
'name' => 'Name',
];
}
}
18 changes: 18 additions & 0 deletions app/Admin/Controllers/Resource/AuthAppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Manage Applications Authentification as admin.
*
* @author Samy Nastuzzi <[email protected]>
* @author Corentin Mercier <[email protected]>
*
* @copyright Copyright (c) 2018, SiMDE-UTC
* @license GNU GPL-3.0
Expand All @@ -17,6 +18,8 @@ class AuthAppController extends ResourceController
{
protected $model = AuthApp::class;

protected $name = "Autentification par application";

/**
* Fields to display definition.
*
Expand All @@ -35,6 +38,21 @@ protected function getFields(): array
];
}

/**
* Fields to display labels definition.
*
* @return array
*/
protected function getLabels(): array
{
return [
'user' => 'Utilisateur',
'app_id' => 'Id de l\'application',
'password' => 'Mot de passe',
'key' => 'Clé',
];
}

/**
* Return dependencies.
*
Expand Down
Loading