TheRosettaFoundation / SOLAS-Match

Self-managed translation project interface
www.TheRosettaFoundation.org
GNU Lesser General Public License v3.0
12 stars 8 forks source link

Fix AJAX url for vagrant box #1257

Closed aquilax closed 7 years ago

aquilax commented 7 years ago

site.location is used for AJAX calls. Settings it to the site root, fixes the AJAX calls for the vagrant box.

RFR @alanbarrett

alanbarrett commented 7 years ago

Assuming the browser knows "/" is the site from which it downloaded the webpage (including the port!), then this is a cleaner way of writing "http://127.0.0.1:8080/" which had not occured to me and should work, so I will pull.

That will work for the following places... ui\js\Parameters.js(85): url: siteLocation + "static/getUserHash/", ui\js\Parameters.js(110): url: siteLocation + "static/getUserStrings/", ui\js\Parameters.js(130): url: siteLocation + "static/getDefaultStrings/", and all internally pointing URLs in the templates.

However it will not work for these places (creating/editing Projects and the user's profile)... ui\js\ProjectAlter.js(498): url: siteAPI + "v0/projects/getProjectByName", ui\js\ProjectAlter.js(536): url: siteAPI + "v0/projects/getProjectByNameAndOrganisation/" + title + "/organisation/" + orgId, ui\js\ProjectAlter.js(588): url: siteAPI + "v0/io/projectImage/" + orgId + "/" + projectId, ui\js\ProjectAlter.js(624): url: siteAPI + "v0/projects/" + projectId + "/updateWordCount/" + newWordCount, ui\js\ProjectCreate.js(787): url: siteAPI + "v0/projects/getProjectByName", ui\js\ProjectCreate.js(825): url: siteAPI + "v0/projects/getProjectByNameAndOrganisation/" + title + "/organisation/" + orgId, ui\js\UserPrivateProfile.js(208): url: siteAPI + "v0/users/" + userId,

Alan.