thegreenwebfoundation / tgwf2015

The wordpress theme in use on www.thegreenwebfoundation.org
GNU General Public License v3.0
0 stars 1 forks source link

Making the input fields in the admin accept more formats & get a bug out #3

Open homepinr opened 5 years ago

homepinr commented 5 years ago

There is some bug in the admin-code, that results in urls from hosters that are put into the system, in the format starting with 'http://' of 'https://' being displayed, without the ':' in the green web directory on the site, even while the input looks OK in the admin-environment:

Schermafbeelding 2019-10-30 om 15 38 15

So this Belgian hoster details look OK, but when I click on the url, I get referred to 'http//www.kinamo.be', so the ':' has somehow dropped out.

When looking at the Green Hosting Directory on the site, the same thing happens (see down left for referring url:

Schermafbeelding 2019-10-30 om 15 37 45

Ideally, we would want to solve this in a way that the system becomes a bit more agnostic to the exact format: as well http, https, www as directname.topdomain should do it in practice.

If someone could address this issue (probably it is in the wordpress-code!), would be awesome!

mrchrisadams commented 5 years ago

Thanks Rene,

This is really helpful - here's what the response in the API looks like when we visit here:

https://api.thegreenwebfoundation.org/data/directory

{
        "iso": "BE",
        "id": "651",
        "naam": "Kinamo SA",
        "website": "https://www.kinamo.be/",
        "partner": null
      }

So, this makes me think the code in the attachDirectory function in the WP theme is the problem:

https://github.com/thegreenwebfoundation/tgwf2015/blob/master/js/directory.js#L15

Updating the template generation code would be the first place I'd check here, as it's using a bunch of nested if-statements at the mo, and revisiting this would be worthwhile.