zopefoundation / Products.ExternalEditor

Other
2 stars 6 forks source link

Adapt to new ZMI #13

Open icemac opened 5 years ago

icemac commented 5 years ago

zopefoundation/Zope#471 requires changes in ExternalEditor as it overwrites the templates to add its link. Maybe it should be switched to do it using JavaScript as it would to drop the existing monkey patch mechanism. It could be included using the mechanism described in https://zope.readthedocs.io/en/latest/ZMI.html#use-custom-icons-and-resources.

Originally posted by @icemac in https://github.com/zopefoundation/Zope/pull/471#issuecomment-461483569

icemac commented 5 years ago

Example JS code written by @drfho in zopefoundation/Zope#471

 $('table.objectItems').find('tr').each(function(){
        $(this).find('th').eq(1).after('<th>&nbsp;</th>');
        var random_boolean = Math.random() >= 0.5;
        if (random_boolean) {
            $(this).find('td').eq(1).after('<td><i title="External Editor" class="far fa-edit"></i></td>');
        } else {
            $(this).find('td').eq(1).after('<td>&nbsp;</i></td>');
        }

   });