Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when scrivito is not loaded #4

Open
marcelgo opened this issue May 30, 2017 · 6 comments
Open

error when scrivito is not loaded #4

marcelgo opened this issue May 30, 2017 · 6 comments

Comments

@marcelgo
Copy link

When using the widget and having scrivito.js only included for logged in users, this line causes a "scrivito is not defined error":

https://github.com/Scrivito/scrivito_google_maps_widget/blob/master/app/assets/javascripts/scrivito_google_maps_widget/editing.js.coffee#L36

@gertimon
Copy link
Contributor

Problem here is, that this scrivito code is for the widget reload after changing content. Without the page has to be reloaded. So it would lead to a code like:

if scrivito_is_present
  scrivito.on(content, ...)
else
  $(document).ready(...)
end

This doubled code will be in every widget gem using js and can not be bind automatically to dynamic dom elements.

@marcelgo
Copy link
Author

Sorry, but I don't understand this? In my first thinking scrivito?.on... would solve this issue?

@cedrics
Copy link

cedrics commented May 31, 2017

@marcelgo You can safely include scrivito.js even for non logged in user. It is a very short file and will provide scrivito.on and scrivito.in_editable_view when the Scrivito UI is not open (as very simple implementation). The scrivito.js file should only contain the whole code of the referenced file. I marked the code that provides scrivito.on for you. https://github.com/infopark/rails_connector/blob/master/js/src/boot_up.es6.js#L33-L47.

@marcelgo
Copy link
Author

@cedrics thank you and I agree that the current version of the file is very short, but this does not have to be the case in the future. In generell I don’t want to do something because it’s safely possible. I want to do things that make sense. And it does not make sense to include files that are not used. Solving the issue with adding a ? looks relatively easy to me. Another option would be to provide different 2 different manifest-files with the gem, which can be included when necessary.

@marcelgo
Copy link
Author

marcelgo commented Sep 4, 2017

Any news on this issue?

@marcelgo
Copy link
Author

marcelgo commented Mar 6, 2018

@gertimon we still have the iframe use case requiring this to be solved. When you have the case, that the customer wants to include the website as an iframe into another page.

Would be great if you could solve this one. Also for the other widgets like the twitter widget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants