                 ]
     , group
 
+    modal.modalTabs.forms["Avatar"].buttons["Use this image"].enable()
     modal.modalTabs.forms["Avatar"].inputs["Drop Image here"].on 'FileReadComplete', (stuff)->
       # modal.$('img.avatar-image').attr 'src' : stuff.file.data
       modal.$('div.image-wrapper').css backgroundImage : "url(#{stuff.file.data})"
 
   editPermissions:(group)->
+    log 'calling fetchPermissions'
     group.getData().fetchPermissions (err, permissionSet)->
+      log arguments
       if err
         new KDNotificationView title: err.message
       else

              #     modal.$('.image-wrapper').append("<img src='#{image.medium}'/>")
              #     modal.$('.image-wrapper').append("<img src='#{image.big}'/>")

              modal.destroy()

            buttons:
              Save                :
                style             : "modal-clean-gray"
                type              : "submit"
                loader            :

            #<img class='avatar-image' src='#{group.avatar or "http://lorempixel.com/#{200+@utils.getRandomNumber(10)}/#{200+@utils.getRandomNumber(10)}"}'/>
            partial : "<div class='image-wrapper'></div>"
            callback :(formData)=>
              log 'image data, ready for S3 upload',formData

              for image in formData.images
                if image
                  modal.$('.image-wrapper').css backgroundImage : "url(#{image.small})"
                  modal.modalTabs.forms["General Settings"].addCustomData 'avatar', image.small
              # access data like this. formData.images may have undefined values for some reason
              # for image in formData.images
              #   if image
