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

jQuery forward compatibility layer for Zikula 1.4.x #844

Closed
phaidon opened this issue Jun 26, 2013 · 19 comments
Closed

jQuery forward compatibility layer for Zikula 1.4.x #844

phaidon opened this issue Jun 26, 2013 · 19 comments
Labels
Milestone

Comments

@phaidon
Copy link
Contributor

phaidon commented Jun 26, 2013

Starting position
Zikula 1.4 and all later version will use jQuery as standard. By technical reason there is no noconflict for prototype.js. This means we have to drop prototype.js and all prototype.js javascript in Zikula (core, modules, ...)

The problems

  1. Because there is no big motivation to program in prototype anymore more and more modules are using jQuery. This means both frameworks (prototype.js and jQuery) has to be loaded.
  2. IMHO the release of 1.4 is far away (IMHO more the year). The replacement of prototype scripts in Zikula core is a huge work and it is difficult because it is to be done as hole step. Partly steps are not possible.

My suggestion
Add a jQuery forward compatibility layer to Zikula 1.4

How will it work

  1. There will be a possibility in the system settings to select the preferred framework (jQuery/prototype)
  2. There will a jQuery check in pageaddvar. If prototype is activated as preferred framework nothing will happen. If jQuery is activated as preferred framework pageaddvar will check if there is a jQuery version of a script which should be loaded. For example if pageaddvar has to add xxx/test.js it will test if a xxx/test.jQuery.js is available. If a jQuery is available it will load this file otherwise it will load the original file.

Questions

  1. Can I still use prototype if chosed jQuery as preferred framework.
    Yes jQuery will use (like now) noConflict. So a mixture is still possible. This is also valid for the other way around.
  2. How can I provide a jQuery version for inline code?
    There are two possibilities: 1. By a smarty if or by using an external js.

Benefits of this solution

  1. It will be possible to run 1.3.x without prototype loading.
  2. We do the jQuery migration work of Zikula 1.4. already step by step in Zikula 1.3.x.
@phaidon
Copy link
Contributor Author

phaidon commented Jun 26, 2013

@Drak, @jusuff

@phaidon
Copy link
Contributor Author

phaidon commented Jun 30, 2013

I tested my suggestion with the system settings module. Here what I have done:

  1. I made the changes I suggested on the top and I activate jQuery as preferred framework
  2. I created jQuery version of admin_admin_ajax.js and settings_admin_multilingual

After that I could load the multilingual settings page without prototype and scriptaculous.

@jusuff
Copy link
Member

jusuff commented Jul 1, 2013

I like this idea. But we should know that this will require a lot of work with every system module and replacing each and every script with jQuery version.

Working on 1.4 I've made jQuery versions of core javascript libraries. This could be the base for this layer.

@phaidon
Copy link
Contributor Author

phaidon commented Jul 1, 2013

I like this idea. But we should know that this will require a lot of work with every system module and replacing each and every script with jQuery version.

Yes it is, but for 1.4 we have to do this work anyway. Prototype wont work anymore if you want to use jQuery with $.

We could even think about to do the migration step by step (1.3.6, 1.3.7, ...) and mark the jQuery option as experimental.

Working on 1.4 I've made jQuery versions of core javascript libraries. This could be the base for this layer.

Definitely. I saw you want to use underscore, modernizr, polyfills. I think this is a good base.

@ghost
Copy link

ghost commented Sep 8, 2013

bump

@ghost
Copy link

ghost commented Oct 7, 2013

Now we have seriously integrated jQuery/Bootstrap, are there any more thoughts or changed opinions now?

@craigh
Copy link
Member

craigh commented Jun 12, 2014

renamed from jQuery forward compatibility layer for Zikula 1.3.x to jQuery forward compatibility layer for Zikula 1.4.x

@craigh craigh changed the title jQuery forward compatibility layer for Zikula 1.3.x jQuery forward compatibility layer for Zikula 1.4.x Jun 12, 2014
@craigh
Copy link
Member

craigh commented Jun 13, 2014

ping @jusuff @phaidon

@Guite
Copy link
Member

Guite commented Jun 15, 2014

IMHO this can be closed, since we have agreed about future JS directions and can use $ with the approaches described at https://github.com/zikula/core/wiki/Module-Development-Best-Practices#javascript--jquery

Please confirm or deny.

@phaidon
Copy link
Contributor Author

phaidon commented Jun 23, 2014

What we can do is to convert all zikula helpers to jquery.
https://github.com/zikula/core/tree/1.3/src/javascript/helpers

I think @jusuff made already a nice beginning of that.

But the question is if we have time for it. @jusuff or what are your ideas?

@phaidon
Copy link
Contributor Author

phaidon commented Jul 3, 2014

@jusuff it would be great if could talk about your plans and the time you want to invest.

@craigh
Copy link
Member

craigh commented Nov 15, 2014

ping @jusuff @phaidon what is the status here? Are you still willing/interested in doing any of this work? anytime soon? how should we proceed?

@craigh craigh added the Blocker label Nov 15, 2014
@craigh
Copy link
Member

craigh commented Nov 15, 2014

I've added the 'blocker' tag only as a means of promoting more immediate discussion/work. This may not truly be a blocker however.

@craigh
Copy link
Member

craigh commented Dec 8, 2014

ping @jusuff @phaidon any chance you will be working on this?

@phaidon
Copy link
Contributor Author

phaidon commented Jan 10, 2015

I would to discard this idea.

I think the only good way to offer an prototype compatibility (without any problems) is to use jQuery noConflict.

IMHO I would use noConflict even in Zikula 2.0.0. This would allow to offer an prototype/zikula-helpers package.

So I suggest to close this topic.

@phaidon phaidon removed the Blocker label Jan 10, 2015
@Guite
Copy link
Member

Guite commented Jan 11, 2015

I agree!
Does anybody have objections?

@craigh
Copy link
Member

craigh commented Jan 11, 2015

I agree also, but I wish someone would tackle the work of migrating existing needed scripts from prototype to jquery...

@craigh craigh closed this as completed Jan 11, 2015
@cmfcmf
Copy link
Contributor

cmfcmf commented Jan 11, 2015

👍

@Guite
Copy link
Member

Guite commented Jan 11, 2015

I can't promise anything at the moment, but I will try to proceed on #1214 soon.

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

No branches or pull requests

5 participants