Re: [Catalyst] javascript in Catalyst using Template Toolkit

2008-07-18 Thread kakimoto
Hello, Jonathan and  Peter,
  Thanks for that :) 

  i got the issue fixed up by add  "root/static" to lib/myApp/View/TT.pm
and yes, 'Static::Simple' was used.

  Here's an extract...



__PACKAGE__->config({
CATALYST_VAR => 'Catalyst',
INCLUDE_PATH => [
myApp->path_to( 'root', 'src' ),
myApp->path_to( 'root', 'lib' ),
myApp->path_to( 'root', 'static' ),<-- Added this in
],
PRE_PROCESS  => 'config/main',
WRAPPER  => 'site/wrapper',
ERROR=> 'error.tt2',
TIMER=> 0,
});


Thank you for the prompt response/help, guys! 

K.akimoto



Quoting Jonathan Rockway <[EMAIL PROTECTED]>:

> * On Fri, Jul 18 2008, [EMAIL PROTECTED] wrote:
> >  Did this work?
> >I have actually tried this and yes, like Emily,my JS stuff is
> store
> > in myapp/root/lib/site .
> >
> >
> > 
> >
> >
> > Does not work.
> >  Did I miss anything out?  
> 
> Unless you have an action that matches "/multifile.js", nothing is
> going
> to happen when that URL is visited.  If you use Static::Simple, put
> the
> javascript in /static, and link via
> $c->uri_for('/static/multifile.js'),
> then something will happen.
> 
> Someone else suggested linking to '/lib/site/multifile.js'.  I don't
> think that will work either.
> 
> Regards,
> Jonathan Rockway
> 
> -- 
> print just => another => perl => hacker => if $,=$"
> 
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
> 
> 
> 



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] javascript in Catalyst using Template Toolkit

2008-07-18 Thread Peter Karman



Jonathan Rockway wrote on 7/18/08 8:17 PM:


Someone else suggested linking to '/lib/site/multifile.js'.  I don't
think that will work either.



Jon is correct. I broke an ankle jumping to the conclusion that '/lib/site' was 
in the Static::Simple config include path.


--
Peter Karman  .  http://peknet.com/  .  [EMAIL PROTECTED]

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] javascript in Catalyst using Template Toolkit

2008-07-18 Thread Jonathan Rockway
* On Fri, Jul 18 2008, [EMAIL PROTECTED] wrote:
>  Did this work?
>I have actually tried this and yes, like Emily,my JS stuff is store
> in myapp/root/lib/site .
>
>
> 
>
>
> Does not work.
>  Did I miss anything out?  

Unless you have an action that matches "/multifile.js", nothing is going
to happen when that URL is visited.  If you use Static::Simple, put the
javascript in /static, and link via $c->uri_for('/static/multifile.js'),
then something will happen.

Someone else suggested linking to '/lib/site/multifile.js'.  I don't
think that will work either.

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] javascript in Catalyst using Template Toolkit

2008-07-18 Thread Peter Karman



[EMAIL PROTECTED] wrote on 7/18/08 6:08 PM:

hi there,,

 Did this work?
   I have actually tried this and yes, like Emily,my JS stuff is store
in myapp/root/lib/site .






[% Catalyst.uri_for('/lib/site/multifile.js') %]

assuming that you really have 'Catalyst' as your app variable, and not 'c'.
If you are using Catalyst::View::TT, it is 'c' by default.


--
Peter Karman  .  http://peknet.com/  .  [EMAIL PROTECTED]

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] javascript in Catalyst using Template Toolkit

2008-07-18 Thread kakimoto
hi there,,

 Did this work?
   I have actually tried this and yes, like Emily,my JS stuff is store
in myapp/root/lib/site .





Does not work.
 Did I miss anything out?  


thank you 



On 20/12/2007, Emily Heureux  wrote:
>
> I am trying to execute a bit of external javascript code, but I don't
> believe I am setting it up correctly in Catalyst.  I have a clock.js file,
> and then inside a menu file in myapp/root/lib/site I have the script tag:
> ….

src="[% c.uri_for('/clock.js') %]"

EVERY link in your template files should use uri_for() to build the URL.

Cheers,
Carl

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] javascript in Catalyst using Template Toolkit

2008-07-18 Thread kakimoto
hi there,,

 Did this work?
   I have actually tried this and yes, like Emily,my JS stuff is store
in myapp/root/lib/site .





Does not work.
 Did I miss anything out?  


thank you 



On 20/12/2007, Emily Heureux  wrote:
>
> I am trying to execute a bit of external javascript code, but I don't
> believe I am setting it up correctly in Catalyst.  I have a clock.js file,
> and then inside a menu file in myapp/root/lib/site I have the script tag:
> ….

src="[% c.uri_for('/clock.js') %]"

EVERY link in your template files should use uri_for() to build the URL.

Cheers,
Carl

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] javascript in Catalyst using Template Toolkit

2007-12-23 Thread Matt S Trout
On Fri, Dec 21, 2007 at 11:06:33PM +0100, Daniel McBrearty wrote:
> >
> > My experience is that every time I think I -can- make that assumption, later
> > I end up really wishing I could deploy my app to a sub-URL for testing or
> > similar.
> >
> > You may not have such bad luck, but I don't like to take that chance these 
> > days :)
> 
> If I hit that one (needing to test code on the real server while an
> existing version runs) I typically just run a second server on port
> 8080 or something. That makes it completely independent of the running
> version (as long as you make sure you use a test database) and lets
> you deploy at /.

Actually, that wasn't the particular testing case I was thinking of, but the
point is there are -lots- of things that turn out to be good reasons for running
an app on a sub-URL. Yes, there are workaround for each individual case, but
they're all workarounds.

Given how little more effort it is, doing things properly in the first place
seems like a much better idea to me.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] javascript in Catalyst using Template Toolkit

2007-12-21 Thread Andreas Marienborg


On 22. des.. 2007, at 06.37, Kieren Diment wrote:



On 22 Dec 2007, at 16:25, John Romkey wrote:

Since uri_for() won't help with static file paths, is there any  
convention for storing the path for static files in the config, or  
getting access to it in some other way?


Actually I've wanted a relative_uri_for() for a while.  Not that  
badly apparently, otherwise I would have established that either a.   
something with this funcitonality already exists, or b.  I would  
have implemented it and sent patches back in.  All it is is the  
relative URI without the host name to be honest, so I guess it would  
be pretty straightforward to implement.




not sure I understand you, but c.uri_for('something/ 
something').path_part (I think that is the name of the method)



- andreas

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] javascript in Catalyst using Template Toolkit

2007-12-21 Thread Kieren Diment


On 22 Dec 2007, at 16:25, John Romkey wrote:

Since uri_for() won't help with static file paths, is there any  
convention for storing the path for static files in the config, or  
getting access to it in some other way?


Actually I've wanted a relative_uri_for() for a while.  Not that  
badly apparently, otherwise I would have established that either a.   
something with this funcitonality already exists, or b.  I would have  
implemented it and sent patches back in.  All it is is the relative  
URI without the host name to be honest, so I guess it would be pretty  
straightforward to implement.



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] javascript in Catalyst using Template Toolkit

2007-12-21 Thread John Romkey

On Dec 21, 2007, at 1:51 PM, Matt S Trout wrote:

On Thu, Dec 20, 2007 at 02:11:50PM -0500, John Romkey wrote:

Two recommendations, assuming the Javascript file isn't meant to be
modified at runtime:

First, use an absolute path to the file in your script tag, ie:

Re: [Catalyst] javascript in Catalyst using Template Toolkit

2007-12-21 Thread Daniel McBrearty
>
> My experience is that every time I think I -can- make that assumption, later
> I end up really wishing I could deploy my app to a sub-URL for testing or
> similar.
>
> You may not have such bad luck, but I don't like to take that chance these 
> days :)

If I hit that one (needing to test code on the real server while an
existing version runs) I typically just run a second server on port
8080 or something. That makes it completely independent of the running
version (as long as you make sure you use a test database) and lets
you deploy at /.

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] javascript in Catalyst using Template Toolkit

2007-12-21 Thread Matt S Trout
On Thu, Dec 20, 2007 at 02:11:50PM -0500, John Romkey wrote:
> Two recommendations, assuming the Javascript file isn't meant to be  
> modified at runtime:
> 
> First, use an absolute path to the file in your script tag, ie:  
> 

Re: [Catalyst] javascript in Catalyst using Template Toolkit

2007-12-20 Thread John Romkey
Two recommendations, assuming the Javascript file isn't meant to be  
modified at runtime:


First, use an absolute path to the file in your script tag, ie:  
 or use $c->uri_for() to compute the  
path.

Second, serve the Javascript file from your static directory so that Catalyst is bypassed. This will help performance and caching as well (I embed version numbers in the filenames to help avoid new code from getting old cached versions of my Javascript files, so I would have something like