volto icon indicating copy to clipboard operation
volto copied to clipboard

Fix view body classes (was: No way to differentiate different views in CSS)

Open tisto opened this issue 5 years ago • 6 comments

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

tisto avatar Feb 13 '20 09:02 tisto

Briefly discussed this with @sneridagh, the way to go is to fix the view definitions in the body as classic Plone does it.

tisto avatar Feb 13 '20 10:02 tisto

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.

pbauer avatar Apr 22 '20 19:04 pbauer

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

sneridagh avatar Apr 22 '20 19:04 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

pbauer avatar Apr 23 '20 07:04 pbauer

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 avatar Feb 20 '24 04:02 tjprescott

@tjprescott Volto addresses issues subject to the availability of unpaid open source software volunteers. Pull requests are welcome.

stevepiercy avatar Feb 20 '24 06:02 stevepiercy