Fix view body classes (was: No way to differentiate different views in CSS)
The CSS classes/ids we use in our Volto views are inconsistent:
DefaultView.jsx:
https://github.com/plone/volto/blob/cded39e762af5051b23df0e0d53498a6e7b9b32e/src/components/theme/View/DefaultView.jsx#L40
ListingView.jsx:
https://github.com/plone/volto/blob/cded39e762af5051b23df0e0d53498a6e7b9b32e/src/components/theme/View/ListingView.jsx#L19
SummaryView.jsx:
https://github.com/plone/volto/blob/cded39e762af5051b23df0e0d53498a6e7b9b32e/src/components/theme/View/SummaryView.jsx#L20
FileView.jsx:
https://github.com/plone/volto/blob/cded39e762af5051b23df0e0d53498a6e7b9b32e/src/components/theme/View/FileView.jsx#L20
ImageView.jsx:
https://github.com/plone/volto/blob/cded39e762af5051b23df0e0d53498a6e7b9b32e/src/components/theme/View/ImageView.jsx#L20
NewsItemView.jsx:
https://github.com/plone/volto/blob/cded39e762af5051b23df0e0d53498a6e7b9b32e/src/components/theme/View/NewsItemView.jsx#L20
--
The body classes are also not suited to differentiate since it seems all use "view-viewview" and the album view even has "view-viewview section-folder view-injectintl(component contenttype-folder has-toolbar)".
Question:
- what's the best way do differentiate the different views via CSS? body class or container class?
ToDo:
- make sure all views are consistent in that regard
Briefly discussed this with @sneridagh, the way to go is to fix the view definitions in the body as classic Plone does it.
We should add the same body-classes as classic plone.
In Volto we currently have:
contenttype-talk
has-toolbar
section-dexterity
section-training
view-viewview
Teh same page in classic Plone has:
frontend
icons-off
pat-plone
patterns-loaded
plone-toolbar-default
plone-toolbar-left
plone-toolbar-left-default
portaltype-talk
section-training
site-Plone
subsection-dexterity
template-view
thumbs-on
userrole-authenticated
userrole-manager
userrole-owner
viewpermission-view
Most importantly we should add userrole, subsection and site.
I’ll show you tomorrow how to differentiate views. Agreed regarding the userrole, but that’s not easy now, some other things should happen before. The sections are there though.
On Wed, 22 Apr 2020 at 21:15, Philip Bauer [email protected] wrote:
We should add the same body-classes as classic plone.
In Volto we currently have:
contenttype-talk has-toolbar section-dexterity section-training view-viewview
Teh same page in classic Plone has:
frontend icons-off pat-plone patterns-loaded plone-toolbar-default plone-toolbar-left plone-toolbar-left-default portaltype-talk section-training site-Plone subsection-dexterity template-view thumbs-on userrole-authenticated userrole-manager userrole-owner viewpermission-view
Most importantly we should add userrole, subsection and site.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/plone/volto/issues/1189#issuecomment-617976823, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADW4D5UMF5VZP7AC22S7E3RN463RANCNFSM4KUNVWEQ .
-- Víctor Fernández de Alba Github/Twitter/IRC: sneridagh
In the hope that userrole will be implementet soon I'll leave this in the training:
// Hide date fields from contributors
body.userrole-contributor {
#default-start.field,
#default-end.field,
#default-whole_day.field,
#default-open_end.field {
display: none;
}
}
From https://github.com/plone/training/commit/c702e37818dd4dcd0b328169a96add904d4edbf2#diff-44366b2a1cad54098abec452a0fd54b2R235
It's been about 4 years since the last comment. I'm going through this training now (Mastering Plone 6) and wondering if this is going to be addressed?
@tjprescott Volto addresses issues subject to the availability of unpaid open source software volunteers. Pull requests are welcome.