Ticket #335 (assigned defect)

Opened 11 months ago

Last modified 6 days ago

More robust AddJavascript implementation

Reported by: VexedPanda Owned by: somebody
Priority: must Milestone: 1.1.3
Component: QForms Version: 1.0.0 Stable
Keywords: Cc:

Description

Hard-coding js files to only be storable in the assets/js dir, then using a hack (.. paths) to work around it for the special case of plugins is ugly.

We should support adding js files from arbitrary paths (for example, I have js files that must be included from my app's module directories). This would also clean up the implementation of adding plugin javascript files.

Attachments

ticket335.patch (3.4 kB) - added by VexedPanda 11 months ago.
I think this is all it takes. We may want to do something similar for all other types of assets as well.

Change History

Changed 11 months ago by VexedPanda

I think this is all it takes. We may want to do something similar for all other types of assets as well.

Changed 11 months ago by VexedPanda

  • status changed from new to in_QA

Changed 10 months ago by alex94040

Reviewed the code, looks just fine. Check it in!

Changed 10 months ago by alex94040

  • status changed from in_QA to assigned

Tested this, and no, unfortunately this does NOT work. Plugin manager is broken - a bunch of JS files are NOT included (paths are wrong).

Changed 10 months ago by VexedPanda

Have some examples? Perhaps the plugin manager code needs updated too.

Changed 10 months ago by VexedPanda

Ok, I see the problem. I missed a couple spots. New patch coming.

Changed 10 months ago by VexedPanda

Ok, I may not have enough time to put this out today, so FYI, the current problem is the QControl $strJavaScripts array.

Currently, everything treats it like it's relative to the js assets folder.

I'm leaning towards keeping it that way, and just say that anyone wanting to have absolute-path js files for their controls need to call the form function instead. I think that approach will work...

Changed 10 months ago by alex94040

Considering the priority of this, my recommendation is to drop this bug to vNext.

Changed 10 months ago by alex94040

  • milestone changed from 1.1 to 1.2

Changed 9 months ago by VexedPanda

Other options discussed in #362

Changed 6 months ago by VexedPanda

#466 also brings up the use of this to include 3rd party hosted js, such as those from CDNs.

Changed 6 months ago by alex94040

  • milestone changed from 1.2 to 1.1.2

I think the issue of CDN's is of paramount importance, now that we're about to be fully based on jQuery. Changing milestone to 1.1.2. We should make sure to port this over to 2.0 codebase, too.

Changed 6 months ago by akrohn

Oh great, didn't notice this ticket. So from 1.1.2 we could use CDN's and thats grood news.

Patch looks good forAddJavascript? .

Changes to use a CDN for the JQery define in configuration.inc.php has yet to be added.

Changed 6 months ago by alex94040

  • status changed from assigned to in_QA

Changed 6 months ago by VexedPanda

  • status changed from in_QA to assigned

This patch already failed QA. We need a new one that doesn't use QControl's javascript functions, or makes them backwards compatible somehow.

Changed 2 months ago by VexedPanda

The patch in #362 may be a valid approach. I don't like the idea of using http:// to identify absolutely-pathed js files, since I don't necessarily know what domain my app is going to be hosted on, and I don't want to build that string. Easier to use SUBDIRECTORY.VIRTUAL_DIRECTORY.'/someFolder/somejs.js'.

Changed 4 weeks ago by alex94040

  • milestone changed from 1.1.2 to 1.1.3

Changed 3 weeks ago by alex94040

  • status changed from assigned to in_QA

That's a good start, but it's not enough. I want to be able to write the following in the configuration.inc.php, and have it work without any other changes:

define ('JQUERY_BASE', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
define ('JQUERY_EFFECTS', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js');

Changed 6 days ago by VexedPanda

  • status changed from in_QA to assigned
Note: See TracTickets for help on using tickets.