keystone-classic: localFile .format property ignored by Admin UI

Hi,

I’m having the same problem as this user: https://groups.google.com/forum/#!searchin/keystonejs/localFile$20format/keystonejs/KVKsu7eywek/851iYDO4pzsJ

The format property in the following example:

var Photo = new keystone.List('Photo',{track:true});

Photo.add({
    name: { type: Types.Key, required: true, index: true },
    photo: {
          type: Types.LocalFile,
          dest: './public/data',
          prefix: '/photo',
        allowedTypes: [
            'image/jpeg', 'image/png'
        ],
        format: function(item, file) {
            console.log('format()');
            return '<img src="/data/' + item.id + '.' + file.extension + '" style="max-width: 300px">';
        }
      }
});

… inserts no <img> tag at all in the detail page of an ‘image’ item in the Admin UI. Nor is the console message format() logged. I suspect this property is currenty broken. Currently running Keystone.js 0.3.10.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 20 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Why is there no hint in the documentation that the 3.X branch does not support the format function on LocalFiles(s)? This is very confusing, @JedWatson !