fix user authorized projects custom methods
This commit is contained in:
parent
ef6375f4cc
commit
699c0bfa1d
4 changed files with 29 additions and 23 deletions
|
|
@ -10,30 +10,20 @@ tabs:
|
||||||
extends: sections/projects
|
extends: sections/projects
|
||||||
headline: Brouillons
|
headline: Brouillons
|
||||||
status: draft
|
status: draft
|
||||||
- width: 1/2
|
|
||||||
sections:
|
|
||||||
unlisted:
|
|
||||||
extends: sections/projects
|
|
||||||
headline: Archivés
|
|
||||||
status: unlisted
|
|
||||||
- width: 1/2
|
- width: 1/2
|
||||||
sections:
|
sections:
|
||||||
listed:
|
listed:
|
||||||
extends: sections/projects
|
extends: sections/projects
|
||||||
headline: En cours
|
headline: En cours
|
||||||
status: listed
|
query: user.currentProjects
|
||||||
|
sortBy: modified desc
|
||||||
|
- width: 1/2
|
||||||
|
sections:
|
||||||
|
unlisted:
|
||||||
|
extends: sections/projects
|
||||||
|
headline: Archivés
|
||||||
|
query: user.archivedProjects
|
||||||
sortBy: modified desc
|
sortBy: modified desc
|
||||||
# - width: 1/1
|
|
||||||
# sections:
|
|
||||||
# yourProjects:
|
|
||||||
# label: Tous vos projets
|
|
||||||
# type: pages
|
|
||||||
# query: user.projects
|
|
||||||
# sortBy: modified desc
|
|
||||||
# create: false
|
|
||||||
# search: true
|
|
||||||
# image:
|
|
||||||
# query: page.client.toPage.logo.toFile
|
|
||||||
|
|
||||||
settings:
|
settings:
|
||||||
label: Réglages
|
label: Réglages
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
title:
|
title:
|
||||||
fr: Chef·fe de projet
|
fr: Chef·fe de projet
|
||||||
en: Project Manager
|
en: Project Manager
|
||||||
|
home: /panel/pages/projects
|
||||||
permissions:
|
permissions:
|
||||||
access:
|
access:
|
||||||
users: false
|
users: false
|
||||||
|
|
|
||||||
20
public/site/plugins/user-projects/index.php
Normal file
20
public/site/plugins/user-projects/index.php
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
Kirby::plugin('adrienpayet/pdc-authorized-projects', [
|
||||||
|
'userMethods' => [
|
||||||
|
'currentProjects' => function() {
|
||||||
|
if ($this->role() == 'admin') {
|
||||||
|
return page('projects')->children()->listed();
|
||||||
|
} else {
|
||||||
|
return $this->projects()->toPages()->listed();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'archivedProjects' => function() {
|
||||||
|
if ($this->role() == 'admin') {
|
||||||
|
return page('projects')->children()->unlisted();
|
||||||
|
} else {
|
||||||
|
return $this->projects()->toPages()->unlisted();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
Kirby::plugin('adrienpayet/pdc-your-projects', [
|
|
||||||
'userMethods' => []
|
|
||||||
]);
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue