On Sun, Feb 19, 2012 at 9:03 AM, Christian Aust
<christian.a...@software-consultant.net> wrote:
> Hi,
>
> I'm trying to extend Radiant 1.0-rc5 from within RAILS_ROOT, that is, I'm 
> trying to add models, a controller, routes and such from my radiant site 
> without the use of a separate extension. In my opinion this should be this 
> most obvious way to add stuff to Radiant (unless it's meant to be reused)
>
> I've succeeded getting my model/controller/routes to work, but can't add 
> something to the Radiant UI. I assume that I'd need to use the extension 
> interface for this, so I wrote in lib/trainings_extension.rb:
>
> class TrainingsExtension < Radiant::Extension
>  version "0.0.1"
>  description "Manage trainings"
>  url "http://www.somewebsite.com";
>
>  def activate
>    puts "*** Activating!"
>
>    tab "Content" do
>      add_item "Trainings", "/admin/trainings", :after => "Pages"
>    end
>
>    Page.class_eval do
>      # include CustomTags #if any
>    end
>  end
> end
>
> At first, nothing happens starting up the site: No navigation entry, nothing 
> in Settings/Extensions. If I require that file somewhere during 
> initialization, the extension shows up in Settings/Extensions but still no 
> navigation entry. I suspect it hasn't been activated.
>
> How could I activate my extension properly, or else: What needs to be done to 
> make it visible to the standard extension loader? Kind regards,
>
> Christian
>

I haven't attempted this.
This is something that I'd like to support, but you'd probably be
better served now by just using an extension.

You could probably do what you need in an initializer and just call
TrainingsExtension.new.activate (or something like that) but if you
haven't yet, take a look at
https://github.com/radiant/radiant/blob/master/lib/radiant/initializer.rb



-- 
Write intention revealing code #=> http://www.clean-ruby.com

Jim Gay
Saturn Flyer LLC
571-403-0338

Reply via email to