Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Kottibrowser doesn't work on custom content types #19

Closed
nightmarebadger opened this Issue Sep 30, 2013 · 5 comments

Comments

Projects
None yet
3 participants

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?).
vanclevstik/kotti_tinymce@ba7a9e2

Owner

dnouri commented Sep 30, 2013

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.

Owner

disko commented Sep 30, 2013

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?

Owner

dnouri commented Oct 1, 2013

No you're not. 👍 for adding a context_url.

👍 from me too, looks like a better solution that helps in other places too.

Owner

disko commented Feb 5, 2014

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

@disko disko closed this Feb 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment