Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Kottibrowser doesn't work on custom content types #19

Closed
nightmarebadger opened this Issue · 5 comments

3 participants

@nightmarebadger

A while ago, we came across this issue:

If you click on browse button (e.g. when uploading an image or editing a link), on a custom content type, you get the current view in the popup, instead of the content browser.

The problem is in kotti_tinymce.js, which doesn't construct the url properly, it only works for the default Document type:

var kotti_url;
kotti_url = window.location.toString();
kotti_url = kotti_url.replace(/@@edit/, "@@kottibrowser");
kotti_url = kotti_url.replace(/add_document/, "@@kottibrowser");
...

So in our case instead of getting something like:

http://localhost:5000/folder/@@kottibrowser?type=image"

we get:

http://localhost:5000/folder/add_custom_contenttype?type=image"

which of course opens up the same view in a popup.

@ferewuz came up with a possible fix (he is not home right now so he can't issue a pull request). Comments on the topic are appreciated (is this the right way to go around fixing it?).
ferewuz@ba7a9e2

@dnouri
Owner

I'd say if it works, it works. Maybe some testing to make sure it opens the browser in the right folder even if you're inside a subfolder.

@disko
Owner

This issue is in some way related to Kotti/Kotti#219.

It all comes down to not having a reliable way to get the context url from Javascript. Trying to solve this by messing around with window.location and friends will IMO always be limited to specific issues (like this one) and still have the potential to fail under certain circumstances. I think we rather want to have a context_url Javascript global variable. This would give us some means to solve all issues of that kind at once and forever.

Or am I missing something particular wrt this specific issue?

@dnouri
Owner

No you're not. :+1: for adding a context_url.

@nightmarebadger

:+1: from me too, looks like a better solution that helps in other places too.

@disko
Owner

Implemented / fixed in 9ab024f and Kotti/Kotti@6bb5ab1 / Kotti/Kotti@22fccf1

@disko disko closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.