# Extending the admin console

**URL:** <https://www.ruby-forum.com/t/extending-the-admin-console/98038>\
**Category:** Radiant CMS\
**Created:** [July 12, 2006, 3:43am UTC](https://www.ruby-forum.com/t/extending-the-admin-console/98038 "2006-07-12T03:43:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfwalter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/278dde/32.png) [@sfwalter](https://www.ruby-forum.com/u/sfwalter)\
**Post date:** [July 12, 2006, 3:43am UTC](https://www.ruby-forum.com/t/extending-the-admin-console/98038/1 "2006-07-12T03:43:11Z")

</div>

There’s a need to enhance the admin console outside the core product.  
Some ideas could be a dashboard/stats page, asset manager, manage  
comments, etc… I’m thinking that an extension to the admin console  
would basically be a simple Rails controller. There will be a little  
DSL for defining plugins and who can access them. The plugin would  
either create a tab into the main admin navigation or possibly be a  
second level menu item in one of the existing tabs. Once a plugin is  
registered it will be accessible via the route  
/admin/plugins/. Below is an example of how you would  
create a plugin:

init.rb  
require ‘dashboard\_controller’  
require ‘dashboard\_helper’

```
AdminPluginManager.define "dashboard" do
      description %{
            Manage Dashboard
      }
      author "Scott F. Walter"
      version "1.0.0"
    radiant_version_required "0.5"
    role_required "admin"

      add_tab 'The Dashboard', DashboardController, :display_order 

```

=\> 1

```
    or

    add_to_tab 'dashboard', 'Sub Item', DashboardController, 

```

:display\_order =\> 1  
end

dashboard\_controller.rb

```
class DashboardController < AdminPluginController
      def index
            render :text => 'I am Dashboard. Hear me roar!'
      end
end

DashboardController.configure_template_root __FILE__

```

dashboard\_helper.rb

```
module DashboardHelper
end

```

Let me know what you think! I’m also starting to think about how the  
existing forms (page, parts, snippets, layout) can be extended. For  
example pages don’t have any tagging/taxonomy assoicated with them.  
Wouldn’t be cool if a plugin could be developed that could add a tag  
field to the existing forms.

cheers,

scott

* * *

What’s an Intel chip doing in a Mac? A whole lor more that it’s ever  
done in a PC.

My Digital Life - [http://scottwalter.com/blog](http://scottwalter.com/blog)  
Pro:Blog - [http://scottwalter.com/problog](http://scottwalter.com/problog)  
Snippets - [http://snippets.scottwalter.com](http://snippets.scottwalter.com)

---

<div class="post-metadata">

**Author:** ![sfwalter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/278dde/32.png) [@sfwalter](https://www.ruby-forum.com/u/sfwalter)\
**Post date:** [July 12, 2006, 4:26am UTC](https://www.ruby-forum.com/t/extending-the-admin-console/98038/2 "2006-07-12T04:26:35Z")

</div>

On 11-Jul-2006 18:40 -0700, Scott W. was heard to say:

> menu item in one of the existing tabs. Once a plugin is registered it  
> will be accessible via the route /admin/plugins/.

I have been working on a plugin system before which allows plugins to  
add  
their own controllers and routes to the system. I like the idea of  
making a  
plugin’s controller accessible by an automatically generated route based  
on the plugin’s/controller’s name. However, we should also allow plugins  
to  
provide controllers that are supposed to be accessed outside of the  
admin  
interface and for which you would want to add custom routes. E.g.  
/\*page/comments, could be a route that invokes a speacial comments  
controller.

Oliver

---

<div class="post-metadata">

**Author:** ![sfwalter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/278dde/32.png) [@sfwalter](https://www.ruby-forum.com/u/sfwalter)\
**Post date:** [July 12, 2006, 4:43am UTC](https://www.ruby-forum.com/t/extending-the-admin-console/98038/3 "2006-07-12T04:43:59Z")

</div>

On 11-Jul-2006 18:40 -0700, Scott W. was heard to say:

> Let me know what you think! I’m also starting to think about how the  
> existing forms (page, parts, snippets, layout) can be extended. For  
> example pages don’t have any tagging/taxonomy assoicated with them.  
> Wouldn’t be cool if a plugin could be developed that could add a tag  
> field to the existing forms.

Sorry for replying a second time. I think the easiest thing to do this  
is  
to allow a plugin to register fields with a certain form and associate  
appropriate getter/setter methods with a field. The getter/setter  
methods  
have to be called in some well defined context, i.e. the page object,  
such  
that the plugin’s implementation can take care of associating the  
addition  
values with the page.

Oliver

---

<div class="post-metadata">

**Author:** ![sfwalter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/278dde/32.png) [@sfwalter](https://www.ruby-forum.com/u/sfwalter)\
**Post date:** [July 12, 2006, 7:36am UTC](https://www.ruby-forum.com/t/extending-the-admin-console/98038/4 "2006-07-12T07:36:43Z")

</div>

I actually got that helper callback system working like I had planned  
on… I’ve used it to add a textarea for entering trackbacks on the new  
and edit pages… I’m going to use it to create a small comment manager  
on each page under the main page form after the submit buttons; maybe  
ajax style. The number of callbacks is actually surpisingly low… only  
about 12 to modify the edit/new forms for pages, snippets, and layouts.  
This doesn’t yet include adding new tabs. Anyone interested in seeing  
the code?

I think the earlier post about having a special action like  
/admin/plugins/:plugin\_name is really great because it allows you to add  
new functionality easily. It doesn’t however allow you to modify the  
existing create/edit forms which is where I suspect a lot of  
functionality would want to live for the sake of simplicity. I am  
working tonight on extending the controllers with filters in some way,  
this might require a call to a special callback chain manager, which is  
how I did the other view callbacks.

Josh

---

<div class="post-metadata">

**Author:** ![sfwalter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/278dde/32.png) [@sfwalter](https://www.ruby-forum.com/u/sfwalter)\
**Post date:** [July 12, 2006, 3:39pm UTC](https://www.ruby-forum.com/t/extending-the-admin-console/98038/5 "2006-07-12T15:39:45Z")

</div>

Yes can you please post some code so I don’t have to reinvent the wheel.  
I would like to test it out to implement functionality such as being  
able to add a category to a page.

Thanks in advance. Scott.

* * *

What’s an Intel chip doing in a Mac? A whole lor more that it’s ever  
done in a PC.

My Digital Life - [http://scottwalter.com/blog](http://scottwalter.com/blog)  
Pro:Blog - [http://scottwalter.com/problog](http://scottwalter.com/problog)  
Snippets - [http://snippets.scottwalter.com](http://snippets.scottwalter.com)

----- Original Message ----  
From: Josh F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: removed\_email\_address@domain.invalid  
Cc: Scott W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Wednesday, July 12, 2006 1:36:24 AM  
Subject: Re: [Radiant] Extending the admin console

I actually got that helper callback system working like I had planned  
on… I’ve used it to add a textarea for entering trackbacks on the new  
and edit pages… I’m going to use it to create a small comment manager  
on each page under the main page form after the submit buttons; maybe  
ajax style. The number of callbacks is actually surpisingly low… only  
about 12 to modify the edit/new forms for pages, snippets, and layouts.  
This doesn’t yet include adding new tabs. Anyone interested in seeing  
the code?

I think the earlier post about having a special action like  
/admin/plugins/:plugin\_name is really great because it allows you to add  
new functionality easily. It doesn’t however allow you to modify the  
existing create/edit forms which is where I suspect a lot of  
functionality would want to live for the sake of simplicity. I am  
working tonight on extending the controllers with filters in some way,  
this might require a call to a special callback chain manager, which is  
how I did the other view callbacks.

Josh

---

<div class="post-metadata">

**Author:** ![sfwalter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/278dde/32.png) [@sfwalter](https://www.ruby-forum.com/u/sfwalter)\
**Post date:** [July 12, 2006, 4:16pm UTC](https://www.ruby-forum.com/t/extending-the-admin-console/98038/6 "2006-07-12T16:16:30Z")

</div>

I would very much like to see your code as well…

On Jul 12, 2006, at 3:38 PM, Scott W. wrote:

> Subject: Re: [Radiant] Extending the admin console
> 
> > > Wouldn’t be cool if a plugin could be developed that could add a  
> > > have to be called in some well defined context, i.e. the page
> 
> [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)  
> –  
> Jeroen J.  
> Laika online entertainment

* * *
