replace " admin.page.edit.add(:form, "mediamaid_gallery", :before=> "edit_page_parts")" with admin.page.edit.add(:form, "header", :before=> "edit_page_parts") (the name of the partial file without the underscore, or .rb)
On Sat, Feb 6, 2010 at 11:17 AM, banane <[email protected]> wrote: > Hi Christian > > Not sure quite what your objective is, but a couple things I'm > thinking while looking at your code: > > - the usual thing to do for extensions is not to edit the gem code, > but make an extension directory (/vendor/extensions/your_extension) > and in that file directory structure, include files that will extend > the Radiant code base. So to add to the Admin UI, as I think you want > to do, you'd add a haml file in > /vendor/extensions/your_extension/app/views/admin/_header.html.haml, > and then in the Ruby file that is your extension > (/vendor/extensions/your_extension/your_extension.rb) you'd include a > line of code that would tell the rendering view for the Radiant admin > to include your partial: > > admin.page.edit.add(:form, "mediamaid_gallery", :before=> > "edit_page_parts") > > This page on the wiki really explains well how to change the Admin UI: > http://wiki.github.com/radiant/radiant/modifying-the-page-ui > > Also, getting started on extensions (written by moi) with a focus on > converting ruby apps to Radiant extensions, may explain some of hte > basic architecture. > http://wiki.github.com/radiant/radiant/how-to-create-an-extension > > On Sat, Feb 6, 2010 at 8:18 AM, Christian Aust > <[email protected]> wrote: >> Hi all, >> >> I'm writing an extension to Radiant that defines new database entities. The >> docs suggest to let my controller inherit from Admin::ResourceController, to >> "get a lot of functionality for free". What is that functionality, >> specifically? >> >> In particular, I've been confused by that :singular and :plural stuff in >> there, what's that? When do I need that? >> >> What's going on with the @template_name and @controller_name variables, what >> do I need them for? >> >> As I've mentioned before, Radiant itself is pretty neat, but documentation >> on these parts of its public API isn't only lacking but non-existant. That >> makes it harder to understand errors like this: My entity is called "City", >> I've copied all relevant code from Radiants Page view and controller. The >> edit haml throws this error: >> >> undefined method `cities' for #<Radiant::AdminUI:0x102036be8> >> >> Extracted source (around line #1): >> >> 1: - render_region :main do |main| >> 2: - main.edit_header do >> 3: %h1 Edit City >> 4: - main.edit_form do >> >> /opt/local/lib/ruby/gems/1.8/gems/radiant-0.8.1/app/helpers/admin/regions_helper.rb:25:in >> `send' >> /opt/local/lib/ruby/gems/1.8/gems/radiant-0.8.1/app/helpers/admin/regions_helper.rb:25:in >> `lazy_initialize_region_set' >> /opt/local/lib/ruby/gems/1.8/gems/radiant-0.8.1/app/helpers/admin/regions_helper.rb:3:in >> `render_region' >> /Users/christian/mueller/vendor/extensions/mueller/app/views/admin/cities/edit.html.haml:1:in >> >> `_run_haml_vendor47extensions47mueller47app47views47admin47cities47edit46html46haml' >> >> It feels like I've got something wrong while copying code, but I can't >> easily tell what. Can you? Kind regards, >> >> Christian >> _______________________________________________ >> Radiant mailing list >> Post: [email protected] >> Search: http://radiantcms.org/mailing-list/search/ >> List Site: http://lists.radiantcms.org/mailman/listinfo/radiant >> Radiant: http://radiantcms.org >> Extensions: http://ext.radiantcms.org >> > _______________________________________________ Radiant mailing list Post: [email protected] Search: http://radiantcms.org/mailing-list/search/ List Site: http://lists.radiantcms.org/mailman/listinfo/radiant Radiant: http://radiantcms.org Extensions: http://ext.radiantcms.org
