locomotivecms/engine — pull request #475 by alexsanford (2012-07-23 16:04:40+00:00)
Title: Fixed issue with removing membership from a site

I wasn't able to remove a membership from a site. This issue was posted before (#397) but wasn't reproducible. I discovered that it wasn't reproducible because it only failed when running the server on a port other than the default (port 80). The problem is twofold:

* The `app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee` file checks to see if the model's domains includes the current location. However, the current location string includes the port number and the model's domain does not. So as a result, it was trying to do a regular post rather than an AJAX post since the current location was "not included" in the model's domains list.
* The regular (non-AJAX) post seems to submit the form fields, rather than the backbone model attributes. This means that since the UI removes the deleted memberships from the DOM, the membership's "_destroy" attribute is not pushed. I can't say I know very much about backbone, but I think that a regular (non-AJAX) post should still try to sync using the backbone model, rather than the form fields.

I fixed the first issue, so now it uses AJAX requests for apps run on other ports. I also put a cucumber feature around it.