I am trying to pass a page_type parameter (via query string) to the page
controller new and create actions.
The goal is for the new page to appear showing it’s page type-specific
fields already. Normally, when creating a new page you click the add
button on the page index, you arrive at the new page screen, you select
the page type and AFTER you click “Create Page” you finally end up with
the page in its typed glory.
The thing I’m trying to avoid is having the user save the page in two
steps. 1) Create a basic page setting the type before saving, 2) When
the page reloads fill out the type-specific fields and save again.
It’s easy enough to add a feature to the page index that allows for page
type selection and invokes the page#new action with a page type. I have
attempted to mixin some modules into Admin::ResourceController and
Admin::PagesController with limited success.
I was looking for the least obtrusive way to do this, but after lots of
failed attempts, I’m less concerned with how obtrusive/clean the change
I would have thought this fairly simple but after 3 hours it’s seeming
less simple. Any ideas?
alias old_new new
alias old_create create
puts ‘i made it to new’ #=> seeing this
klass = params[:page_type].camelize.constantize rescue model_class
self.model = klass.new_with_defaults(config)
self.model.slug = ‘/’
puts ‘i made it to create’ #=> not seeing this
I’m using Radiant 0.8.1.
Mario T. Lanza