Re: How can I include custom javascript file on dexterity content type

Sean Upton <[email protected]>
Newsgroups gmane.comp.web.zope.plone.user
Message-ID <CANjV-2Mi6Ag0ACLRVpAWJSfrHVPgqxSadQ18vFK+Tdj-xH8y4Q@mail.gmail.com>
On Tue, Dec 16, 2014 at 11:43 AM, Bruno Barbosa <[email protected]> wrote:
> I need include a custom javascript file on add and edit views in my custom
> content type in dexterity like a helper_js on archetypes.

If you have custom add views with own template under your control,
just fill javascript_head_slot.  But presuming that you do not, here
are alternatives:

(1) Write a viewlet to inject (and only execute on relevant pages);

(2) Use portal_javascripts to inject (and only execute type-specific
stuff on relevant forms);

(3) Use a Diazo rule to inject;

(4) Customize main template (avoid if you can);

(5) jbot customize the template and inject a script tag (and only
execute on relevant type forms).

(6) Go through the efforts to customize the add/edit forms for your
type (guessing this is the most work).


Some of these may be documented on docs.plone.org or stackoverflow.  A
search may tell you more.

Sean

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.