Login

Username

Password





Register   Reset password

Get Cuyahoga at SourceForge.net. Fast, secure and Free Open Source software downloads

Forum

Welcome Guest Search | Active Topics | Members

Where to model JavaScript for maintainability and encapsulation Options
gedw99
Posted: Sunday, August 24, 2008 11:04:53 PM
Rank: Advanced Member
Groups: Member

Joined: 4/3/2006
Posts: 243
Points: 450
Location: the moon :)
I am wondering where is the best spot to put JavaScript files.

There a few options i see, and wondering what people can recommend here to keep me out of trouble.

1. Use Support.
This seems to be used allot for JavaScript which is used across Modules.

For example Default button does this.
Maybe its better to use the JavaScript as an embedded resource and load it up as a Web Resource each time you need it.


2. Use Template
There is no ability to create templates that also load JavaScript libraries as part of the template. I am referencing to the Admin area here.
Since templates are almost always dependent on the underlying html DOM structure, and so is the CSS i would have thought that this would be OK.

Of course we can hard code the links in the template ascx to the JS modelled inside the Template File System

3. Embed into Module.

This seems like a smart option to me?







if your doing it hard your probably doing it the wrong way....
martijnb
Posted: Monday, August 25, 2008 9:23:00 AM

Rank: Administration
Groups: Administration , Member

Joined: 12/30/2004
Posts: 1,674
Points: 1,824
Location: Wageningen (NL)
gedw99 wrote:


2. Use Template
There is no ability to create templates that also load JavaScript libraries as part of the template. I am referencing to the Admin area here.
Since templates are almost always dependent on the underlying html DOM structure, and so is the CSS i would have thought that this would be OK.

Of course we can hard code the links in the template ascx to the JS modelled inside the Template File System


For admin pages this would be fine to embed the js files in the template control.

Quote:

3. Embed into Module.

This seems like a smart option to me?


I really thought we already had this with RegisterJavaScripts() just like we do this with stylesheets (RegisterStyleSheets, available in BaseModuleControl, which references the method in PageEngine). To my surprise it has never been implemented. Do you know RegisterStyleSheets() and do you think it would be a good idea to make the same construction for javascripts?

gedw99
Posted: Monday, September 1, 2008 4:16:23 AM
Rank: Advanced Member
Groups: Member

Joined: 4/3/2006
Posts: 243
Points: 450
Location: the moon :)
Yes i have already added it.

Its a very good idea.

For css and SJ i think it woudl be a good idea if the Moduel advertised it is using it, and then the template engine can load up the JS because on inspecting the Section Modules and then pumping in the JS and CSS at the Page Engine Level.

THis also allow some Compile Time checking.

G

if your doing it hard your probably doing it the wrong way....
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Yet Another Forum.net version 1.9.0 running under Cuyahoga.
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.