Re: [Radiant] simple extension dev question

2009-05-23 Thread Hamish Rickerby

Hi Joel,

I get custom javascript scripts into admin pages in the past I've just  
added them programmatically.  If you call include_javascript(script)  
in your controller the javascript library should be spat out in the  
rendered HTML (for an index controller method).  I've explained more  
about it here - http://hamishrickerby.com/2008/08/15/radiant-cms-tutorial-custom-javascript-in-admin-pages/


def index
  include_javascript(admin/mootools-1.2-core-yc.js)
  # rest of your index code goes here
end
HTH.

::: hamish rickerby :::
m: ham...@glimmerdesign.com
twitter: @rickerbh

http://glimmerdesign.com



On 23 May 2009, at 12:49, Joel Oliveira wrote:


Hi everyone -
I'm trying to put together a really simple extension for the admin  
area that
relies on a javascript library.  I generated the extension and  
changed the

contents of the main extension.rb file to contain

def activate
 admin.page.index.add :top, 'new_header'
end

and placed a partial in
my_extension/app/views/admin/pages/_new_header.html.haml  that  
contains


- include_javascript 'admin/my_js'

When I restart my dev instance it doesn't show up.  When I put that  
same
snippet of haml in another header partial it does.  What am I  
missing to get

it to spit out the script tag?

Thanks in advance!

- Joel
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] simple extension dev question

2009-05-23 Thread Joel Oliveira
Hamish -
First off thank you for the info and the link - it went straight into my
del.icio.us bookmarks :).

Second - It sounds like this example is for an admin extension's controller
- yes?  I'm looking to add an extra JS script tag for, ideally, the edit
page, not new views within the admin.

My simple little extension is just to add some KB shortcuts for the new and
edit actions of the page controller.  So I'm just piggy-backing the edit
screen.

After playing around a little bit it looks like I figured it out.

Before:
admin.page.index.add :top, new_header

After:
admin.page.edit.add :main, new_header

A few example extensions I poked around in had :top, and of course, they
worked.   Once I changed to :main and switched index to edit ... all good.

Thanks for the guidance, regardless!

Best,

Joel

On Sat, May 23, 2009 at 9:44 AM, Hamish Rickerby
ham...@glimmerdesign.comwrote:

 Hi Joel,

 I get custom javascript scripts into admin pages in the past I've just
 added them programmatically.  If you call include_javascript(script) in your
 controller the javascript library should be spat out in the rendered HTML
 (for an index controller method).  I've explained more about it here -
 http://hamishrickerby.com/2008/08/15/radiant-cms-tutorial-custom-javascript-in-admin-pages/

 def index
  include_javascript(admin/mootools-1.2-core-yc.js)
  # rest of your index code goes here
 end
 HTH.

 ::: hamish rickerby :::
 m: ham...@glimmerdesign.com
 twitter: @rickerbh

 http://glimmerdesign.com




 On 23 May 2009, at 12:49, Joel Oliveira wrote:

  Hi everyone -
 I'm trying to put together a really simple extension for the admin area
 that
 relies on a javascript library.  I generated the extension and changed the
 contents of the main extension.rb file to contain

 def activate
  admin.page.index.add :top, 'new_header'
 end

 and placed a partial in
 my_extension/app/views/admin/pages/_new_header.html.haml  that contains

 - include_javascript 'admin/my_js'

 When I restart my dev instance it doesn't show up.  When I put that same
 snippet of haml in another header partial it does.  What am I missing to
 get
 it to spit out the script tag?

 Thanks in advance!

 - Joel
 ___
 Radiant mailing list
 Post:   Radiant@radiantcms.org
 Search: http://radiantcms.org/mailing-list/search/
 Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


 ___
 Radiant mailing list
 Post:   Radiant@radiantcms.org
 Search: http://radiantcms.org/mailing-list/search/
 Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant