Forum: Radiant CMS Associating a field with each page

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cb4a7de1759dd1be3e53505d84bdc2e3?d=identicon&s=25 Joe Lapp (Guest)
on 2007-07-13 21:48
(Received via mailing list)
Hi everyone,

I'd like to create a set of pages having two fields per page: a body
and an image URL.  The layout will centrally control the positioning
and formatting of the image across all pages, which is why I don't
want to embed the image separately in each page.

How do I do this?  Do I manually create an "image" tab for each new
page, and then have my layout retrieve the URL from this image tab?
Adding the tab to the parent page doesn't result in the children
inheriting it.

Also, I assume that each tab correlates to a VARCHAR in the database.
Is there a more efficient way to do this?

Thanks!
~joe

P.S. I'm an experienced web/software developer, but new to both Ruby
and Radiant.
D03835ee1210e4251e8c1a3976a38bc5?d=identicon&s=25 Andrea Franz (Guest)
on 2007-07-13 22:22
(Received via mailing list)
Il giorno 13/lug/07, alle ore 21:39, Joe Lapp ha scritto:

>
> Adding the tab to the parent page doesn't result in the children
> inheriting it.

I use DefaultPageParts extension:

http://darcs.bigchieflabs.com/radiant/extensions/d...
rdoc/

Let me know if it is what you need!

-----
Andrea Franz

andrea@bigchief.it
http://bigchieflabs.com/blog/
http://think.bigchief.it
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (Guest)
on 2007-07-13 22:43
(Received via mailing list)
Joe Lapp wrote:
> Hi everyone,
>
> I'd like to create a set of pages having two fields per page: a body
> and an image URL.  The layout will centrally control the positioning
> and formatting of the image across all pages, which is why I don't
> want to embed the image separately in each page.
>
> How do I do this?  Do I manually create an "image" tab for each new
> page, and then have my layout retrieve the URL from this image tab?
>
That is one way to do it.
> Adding the tab to the parent page doesn't result in the children
> inheriting it.
>
>
Make sure that you include inherit="true" in the layout: <r:content
part="image" inherit="true" />
This will force Radiant to look through parent pages until it finds a
matching part with that name.
> Also, I assume that each tab correlates to a VARCHAR in the database.
> Is there a more efficient way to do this?
>
>
Actually, it corresponds (roughly) to a record in a separate table in
the database.  There are more efficient ways, but they would involve
writing an extension.

Andrea's DefaultPageParts might help you with automatically creating the
tabs.

Sean
Cb4a7de1759dd1be3e53505d84bdc2e3?d=identicon&s=25 Joe Lapp (Guest)
on 2007-07-15 06:25
(Received via mailing list)
Hi Andrea.  Your extension looks perfect.  I used darcs to pull it
into the extensions directory.  But heck if I know how to get the
thing installed.  An update on the admin page did nothing, and running
rake from the default_page_parts directory resulted in this:

(in /var/www/ecotwined/vendor/extensions/default_page_parts)
/usr/bin/ruby1.8 -Ilib:lib
"/usr/lib/ruby/1.8/rake/rake_test_loader.rb"
"test/functional/default_page_parts_extension_test.rb"
Extensions cannot be used until Radiant migrations are up to date.
Loaded suite /usr/lib/ruby/1.8/rake/rake_test_loader
Started
EF
Finished in 0.006811 seconds.

  1) Error:
test_initialization(DefaultPagePartsExtensionTest):
NameError: uninitialized constant
DefaultPagePartsExtensionTest::DefaultPagePartsExtension
    /var/lib/gems/1.8/gems/radiant-0.6.2/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:477:in
`const_missing'
    ./test/functional/default_page_parts_extension_test.rb:11:in
`test_initialization'

  2) Failure:
test_this_extension(DefaultPagePartsExtensionTest)
[./test/functional/default_page_parts_extension_test.rb:7]:
Flunked.

2 tests, 1 assertions, 1 failures, 1 errors
rake aborted!
Command failed with status (1): [/usr/bin/ruby1.8 -Ilib:lib
"/usr/lib/ruby/...]
Cb4a7de1759dd1be3e53505d84bdc2e3?d=identicon&s=25 Joe Lapp (Guest)
on 2007-07-18 03:34
(Received via mailing list)
Can anyone confirm for me the appropriate way to install an extension?

Do I just run rake from the extension's directory?  I can find web
pages on creating extensions but not on installing them.  (Maybe it's
obvious to people familiar with rails; I'm new to ruby/rails.)

If running rake is supposed to suffice, can anyone explain why it
didn't work for me?  I now have the extension listed on my extensions
page, but the DefaultPageParts page type doesn't show for any page.
See rake output below.  Thanks!

~joe
This topic is locked and can not be replied to.