Change folder_contents to show other columns

I'm trying to modify folder_contents to showing something else rather than the default 3 columns (last modified, publication date and review state).

I saw this here on community.plone.org:

But using the same approach with activeColumns seems to not work:

https://github.com/plone/mockup/blob/master/mockup/patterns/structure/pattern.js#L86

I posted a question on stackoverflow for it already but so far no answer there either:

Any advice? Since I posted the stackoverflow question I noticed the activeColumns on the mockup structure pattern, so, maybe I have to compile my own version of mockup?

Hi,
did you found an easy solution for this? Just like you I need to set default active columns.

Looks like the right way to do it is loading the module and changing it's prototype:

var structure = require('mockup-patterns-structure');
structure.prototype.defaults._default_activeColumns = ["ModificationDate","EffectiveDate","review_state","id","Type"]

and you can also do this via the resource registry like Nathan suggested in the date format question that gforcada referenced to:

  • Go to the resource registry - Pattern Options tab, add a pattern called 'structure' with this value:

    {"_default_activeColumns": ["ModificationDate","EffectiveDate","id","review_state","Type"]}

Since resource registry settings are saved in the (registry.xml), you can export the Export the configuration registry schemata step via ZMI - portal_setup - export, this will show you the full registry.xml. Something like this will be inside for the pattern options:

<record name="plone.patternoptions">
<field type="plone.registry.field.Dict">
  <description>Base pattern configuration options</description>
  <key_type type="plone.registry.field.ASCIILine"/>
  <title>Patterns configuration</title>
  <value_type type="plone.registry.field.Text"/>
</field>
<value>
  <element key="plone-modal">{"actionOptions": {"displayInModal": false}}</element>
  <element key="pickadate">{"date": {"selectYears": 200}, "time": {"interval": 5 } }</element>
  <element key="structure">{"momentFormat": "MMM DD, YYYY","_default_activeColumns": ["ModificationDate","EffectiveDate","id","review_state","Type"]}</element>
</value>
</record>

Then you can move this record into your package code (profiles/default/registry.xml).

2 Likes

Has anyone ever does this in Plone 6 classic?
I found this code: https://github.com/plone/plone.app.content/blob/master/plone/app/content/browser/tableview.py
but it seems columns are now hardcoded and it's no longer to change them via a registry settings?

I found an issue: Plone 6.0 Classic-UI: where can I set default pattern options · Issue #3837 · plone/Products.CMFPlone · GitHub
not fixed yet, this might provide a solution for other pattern option like date formats int he future, but not for the default columns for the plone default folder contents

https://github.com/plone/plone.app.contenttypes/blob/a18566dad2cf2153473662191d28c44cc1faace3/news/customize-tabular.feature
"Enable customization of tabular_view via views for fields of contentlisting items."

Maybe here there's something useful?

Just to clarify: folder_contents and tabular_view are two completely different things.

The folder_contents aka Contents at the top left in the toolbar uses the pat-structure pattern with pattern options which soon can be configured again in the controlpanel.

tabular_view is the folder and collection template which you can select in the Display action and right now you can configure columns in the collection schema but this is pretty old code. It might be more useful if there would be a layout behavior and a controlpanel where you can configure globally and per context basis the look and feel of your tabular folder listing.

I did something similar in an addon for folderish types: collective.gridlisting. Plone >= 6 only.

3 Likes

great package, thanks!

1 Like