# |
May 18th 2021, 17:15 |
paolo.bragagni |
(there is a bake model for policy?) |
# |
May 18th 2021, 17:14 |
paolo.bragagni |
Ok thanks |
# |
May 18th 2021, 15:34 |
etibor |
i dodnt know that the default.ctp can be used for tis purposes |
# |
May 18th 2021, 15:33 |
etibor |
works a charm |
# |
May 18th 2021, 15:33 |
etibor |
thank you - thank you |
# |
May 18th 2021, 15:30 |
ndm |
At least if I understood your whole ordeal somewhat correctly. |
# |
May 18th 2021, 15:30 |
ndm |
In your default layout, accompanied by a check if the current user has the admin role. |
# |
May 18th 2021, 15:29 |
etibor |
but where should i place for Template elements? |
# |
May 18th 2021, 15:28 |
etibor |
i know for the controllers ehen i want to use a common function i have to place in AppController |
# |
May 18th 2021, 15:28 |
etibor |
if i want to use the admin menu in every admin page where should i add this: echo $this->element('admin_menu'); |
# |
May 18th 2021, 15:27 |
etibor |
just one last question |
# |
May 18th 2021, 15:27 |
etibor |
okey maybe its works id i make empty the default.ctp in the ADmin/layout direcotry |
# |
May 18th 2021, 15:19 |
ndm |
Why not? |
# |
May 18th 2021, 15:18 |
etibor |
if i place my menus to the elments insted of the layouts it can be work. the only issue is that i can not replace the default.ctp menu with admin_menu.ctp in the view |
# |
May 18th 2021, 15:14 |
ndm |
Yes. The only way to avoid that would be to create a custom command I think, one that scans for all tables, and runs the policy bake command for each table/entity. |
# |
May 18th 2021, 15:11 |
paolo.bragagni |
(all my policies) |
# |
May 18th 2021, 15:07 |
paolo.bragagni |
Si we have to edit all my actions manually?? |
# |
May 18th 2021, 15:02 |
ndm |
@paolo.bragagni That's not going to happen, what is baked by the `all` command is hardcoded in that command. |
# |
May 18th 2021, 15:01 |
ndm |
That doesn't answer my question though. |
# |
May 18th 2021, 15:00 |
etibor |
well the thing for the UsersController located in Templates/Users - without the prefix |
# |
May 18th 2021, 14:56 |
ndm |
@etibor Are you just using separate templates so that you can display different menus per role? |
# |
May 18th 2021, 14:47 |
paolo.bragagni |
it creates a LibroPolicy.php in my src\Policy |
# |
May 18th 2021, 14:46 |
paolo.bragagni |
I'd like that when I fire bin/cake bake all Libri -t BragBake |
# |
May 18th 2021, 14:44 |
paolo.bragagni |
bake template for policy? |
# |
May 18th 2021, 14:39 |
etibor |
the issue is when i navigate to the users/profile page and logged with admin for example i navigate to site-url/admin/users/profile |
# |
May 18th 2021, 14:37 |
etibor |
i have now: Template/admin/layout/admin_menu.ctp Template/clerk/layout/clerk_menu.ctp while my commonly used functions located in Controller/UsersController.php - non prefixed |
# |
May 18th 2021, 14:33 |
ndm |
Trying to substitute layouts is most likely having looots of pitfalls, I probably wouldn't even try it, rather I'd use a custom view or live with the mentioned layout subdirectory "workaround". |
# |
May 18th 2021, 14:30 |
etibor |
however when i tried to use element insted of layout it was only good for side menu, because the default top menu is the default layout |
# |
May 18th 2021, 14:29 |
etibor |
okey i now i a little more familiar with the concept |
# |
May 18th 2021, 14:24 |
ndm |
You could use subfolders in the default layout folder though? Sure, it's separate from the prefix template subfolders then, but still properly separated and in a place where it makes sense. |
# |
May 18th 2021, 14:22 |
ndm |
You can't just use that anywhere, it's tied to the view's internals. As you noticed, changing the layout path only changes where things point to inside of the default layout folder, more drastic changes can only be applied on view level. |
# |
May 18th 2021, 14:20 |
etibor |
i have just could not figured out how can i use that costumViews's functions |
# |
May 18th 2021, 14:19 |
etibor |
https://github.com/cakephp/cakephp/issues/3907 |
# |
May 18th 2021, 14:19 |
etibor |
the real issue is coming by the setLayyoutPath can not point out the prefixed layout directory path |
# |
May 18th 2021, 14:18 |
etibor |
my problem in short, i have different prefixes for different roles, i have non prefixed Controllers for commonly used function when i navigate to the non prefixed Controller, the page is look for the non prefixed layout directory, and con not change it by set Layout Path in my case layout are difinied two times, first in the prefixed layout directory, secondly by the non prefixed layout directory - this is simple not DRY |
# |
May 18th 2021, 14:02 |
ndm |
Why even in the first place? I don't really know what problem exactly that snippet there is trying to fix, but layouts for prefixes should work out of the box IIRC. |
# |
May 18th 2021, 13:59 |
etibor |
how can i use an element insted of a layout ? |
# |
May 18th 2021, 13:41 |
etibor |
this could solve my issue: https://gist.github.com/TamiasSibiricus/a1010fc95839f79e9e8a however i dont really knows how to use view's function in Controller |
# |
May 18th 2021, 13:40 |
etibor |
with layouts, i have a lot of issues, when i have multiple prefixes |
# |
May 18th 2021, 13:38 |
etibor |
its the first time that i try to work with elements, using insted of layouts |
# |
May 18th 2021, 13:37 |
etibor |
thank you @ndm |