plone5将列添加到folder_contents视图

时间:2016-01-14 11:08:08

标签: javascript plone plone-5.x

我有一个plone插件,可以为portal_catalog添加内容类型和索引(以及元数据)。现在我想在folder_contents - 视图中添加一列,以显示该新类型对象的元数据。

我已经发现我可以通过将新索引(eggs/mockup-2.0.12-py2.7.egg/mockup/patterns/structure/pattern.js)的名称添加到myindexattributes变量来更改availableColumns中的列。

看起来像这样:

    define([
      'jquery',
      'mockup-patterns-base',
      'mockup-utils',
      'mockup-patterns-structure-url/js/views/app',
      'text!mockup-patterns-structure-url/templates/paging.xml',
      'text!mockup-patterns-structure-url/templates/selection_item.xml',
      'text!mockup-patterns-structure-url/templates/tablerow.xml',
      'text!mockup-patterns-structure-url/templates/table.xml',
      'text!mockup-ui-url/templates/popover.xml',
    ], function($, Base, utils, AppView) {
      'use strict';

      var Structure = Base.extend({
        name: 'structure',
        trigger: '.pat-structure',
        defaults: {
          ...
          attributes: [
            'UID', 'Title', 'portal_type', 'path', 'review_state',
            'ModificationDate', 'EffectiveDate', 'CreationDate',
            'is_folderish', 'Subject', 'getURL', 'id', 'exclude_from_nav',
            'getObjSize', 'last_comment_date', 'total_comments', 
            'myindex'
          ],

          ...
          availableColumns: {
            'id': 'ID',
            'ModificationDate': 'Last modified',
            'EffectiveDate': 'Published',
            'ExpirationDate': 'Expiration',
            'CreationDate': 'Created',
            'review_state': 'Review state',
            'Subject': 'Tags',
            'portal_type': 'Type',
            'is_folderish': 'Folder',
            'exclude_from_nav': 'Excluded from navigation',
            'getObjSize': 'Object Size',
            'last_comment_date': 'Last comment date',
            'total_comments': 'Total comments',
            'myindex': 'Test'
          },

          ...

但我不想更改模型包。有没有办法在我的plone插件中添加列?

0 个答案:

没有答案
相关问题