frankmullenger / silverstripe-gallery

Image gallery for SilverStripe 3
23 stars 17 forks source link

Using Gallery Page in ModelAdmin #28

Open thezenmonkey opened 9 years ago

thezenmonkey commented 9 years ago

Using the a ModelAdmin (or anythig outside of the site tree) to edit a Gallery Page (or its extensions) cause issues becuase the Javasctip searches for Form_EditForm_Images. This can also cause issues if the relation isn't Images. It may be better to put the label back onto the field and using the followingt to build the data-config call in the javascript

uploadFieldID = $(this).parents("div.galleryupload").find("label").attr("for");
ids = [];
config = $.parseJSON($('div.galleryupload input#'+uploadFieldID).attr('data-config').replace(/'/g,'"'));

The label for attribute will ways have the full form ID. This is also make modifying the field for multiple gallery uplaod fields easier