Re: [Radiant] Difficulties with a navigation menu and selectively showing children

2007-12-05 Thread John W. Long
On Dec 5, 2007, at 9:52 AM, Sean Cribbs wrote:
> Here's a tag definition you can drop into your project's extension
> that might help.
>
> tag 'if_self' do |tag|
>  tag.expand if tag.locals.page == tag.globals.page
> end
>
> Since we have better support for detecting the globally rendering page
> now, we should probably add it to the core.

+1

--
John Long
http://wiseheartdesign.com
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Difficulties with a navigation menu and selectively showing children

2007-12-05 Thread Sean Cribbs
Lou,

Here's a tag definition you can drop into your project's extension
that might help.

tag 'if_self' do |tag|
  tag.expand if tag.locals.page == tag.globals.page
end

Since we have better support for detecting the globally rendering page
now, we should probably add it to the core.

Sean

On Dec 5, 2007 8:31 AM, Lou Brothers <[EMAIL PROTECTED]> wrote:
>
> On Tue Dec 04 16:14:06 UTC 2007, Mohit Sindhwani <[EMAIL PROTECTED]> wrote:
> > Lou Brothers wrote:
> > > I want to display all of the children of the parent page, and then
> > > display the children of the current page only.  In this example, Child
> > > Page 2 has children, but I am not showing them.
> > >
> > I haven't tried it but this might work (or something like this):
> >
> > <-- switch the context to the parent of this page
> > <-- for each child (of the page's parent)
> >  <-- sorry, I can't remember
> > how to match this
> >   <--- for each child of this page
> ><-- or whatever you want to do
> >
> >   
> >
> > 
> >
> > Maybe, these will help:
> > 1. http://lists.radiantcms.org/pipermail/radiant/2006-July/000888.html
> > 2. http://www.ruby-forum.com/topic/125811
> >
> > Based on #1 above, you may need to match using:
> > because that works at the level of the current page, not the level of
> > the current context (which in a nested scheme will be the child/ parent
> > page).
> >
> > Hope this helps.
> >
> > Cheers,
> > Mohit.
> > 12/5/2007 | 12:14 AM.
>
> I can't seem to find a reference to an example of determining if a url is the 
> url of the current page.  My attempts at using  have not 
> been successful.
>
> ___
> Radiant mailing list
> Post:   Radiant@lists.radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] page_attachments with page type not set to normal.

2007-12-05 Thread Dave Bryand
I think I've got part of the solution figured out. After digging into 
the code a little and poking around console, I think I understanding 
what's going on.

page_attachments is literally attached to a page with class Page. In 
page_attachments_extension.rb, the PageAttachment stuff gets 
class_eval'ed onto Page.

--
Page.class_eval {
  include PageAttachmentAssociations
  include PageAttachmentTags
}
--

Also, I see in the PageAttachment class definition:

class PageAttachment < ActiveRecord::Base
  ...

  belongs_to :page
end

>From looking at a page with page type "Archive" in console:
#"/", 
"class_name"=>"ArchivePage", 

This is no longer a page with class Page, it is an ArchivePage and 
ArchivePage hasn't received the PageAttachment extensions.

As an experiment, I tried just duplicating the include code above and 
eval'ing it on ArchivePage:

--
ArchivePage.class_eval {
  include PageAttachmentAssociations
  include PageAttachmentTags
}
--

I restarted my server and tried to edit the page, but got stopped with 
an error:

SQLite3::SQLException: no such column: page_attachments.archive_page_id: 
SELECT count(*) AS count_all FROM page_attachments WHERE 
(page_attachments.archive_page_id = 1)

What I noticed after that was that PageAttachmentAssociations evals the 
following when it gets included into a class:

has_many :attachments, :class_name => "PageAttachment", :dependent => 
:destroy

Adding :foreign_key => "page_id" should clear up the error that just 
stopped us:

has_many :attachments, :class_name => "PageAttachment", :dependent => 
:destroy, :foreign_key => "page_id"

I restarted my server and tried to attach an image to the Archive page 
and it worked. So now, the main issue is just figuring out a way to 
include PageAttachments gracefully into all of the page types when the 
extension gets activated. Anyone have any ideas?
-- 
Posted via http://www.ruby-forum.com/.
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Difficulties with a navigation menu and selectively showing children

2007-12-05 Thread Lou Brothers
On Tue Dec 04 16:14:06 UTC 2007, Mohit Sindhwani <[EMAIL PROTECTED]> wrote:
> Lou Brothers wrote:
> > I want to display all of the children of the parent page, and then 
> > display the children of the current page only.  In this example, Child 
> > Page 2 has children, but I am not showing them.
> >
> I haven't tried it but this might work (or something like this):
> 
> <-- switch the context to the parent of this page
> <-- for each child (of the page's parent)
>  <-- sorry, I can't remember 
> how to match this
>   <--- for each child of this page
><-- or whatever you want to do
>
>   
>
> 
> 
> Maybe, these will help:
> 1. http://lists.radiantcms.org/pipermail/radiant/2006-July/000888.html
> 2. http://www.ruby-forum.com/topic/125811
> 
> Based on #1 above, you may need to match using: 
> because that works at the level of the current page, not the level of 
> the current context (which in a nested scheme will be the child/ parent 
> page).
> 
> Hope this helps.
> 
> Cheers,
> Mohit.
> 12/5/2007 | 12:14 AM.

I can't seem to find a reference to an example of determining if a url is the 
url of the current page.  My attempts at using  have not 
been successful.  
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] page_attachments with page type not set to normal.

2007-12-05 Thread Sean Cribbs
Dave,

That sounds kind of hack-ish.  The better solution is make sure 
page_attachments loads before anything else.  Uncomment/put this line in 
config/environment.rb:

config.extensions = [:page_attachments, :all]

Although I haven't heard of changes to a superclass not propagating to 
subclasses like this, it may have to do with associations.

Sean

Dave Bryand wrote:
> I think I've got part of the solution figured out. After digging into 
> the code a little and poking around console, I think I understanding 
> what's going on.
>
> page_attachments is literally attached to a page with class Page. In 
> page_attachments_extension.rb, the PageAttachment stuff gets 
> class_eval'ed onto Page.
>
> --
> Page.class_eval {
>   include PageAttachmentAssociations
>   include PageAttachmentTags
> }
> --
>
> Also, I see in the PageAttachment class definition:
>
> class PageAttachment < ActiveRecord::Base
>   ...
>
>   belongs_to :page
> end
>
> >From looking at a page with page type "Archive" in console:
> #"/", 
> "class_name"=>"ArchivePage", 
>
> This is no longer a page with class Page, it is an ArchivePage and 
> ArchivePage hasn't received the PageAttachment extensions.
>
> As an experiment, I tried just duplicating the include code above and 
> eval'ing it on ArchivePage:
>
> --
> ArchivePage.class_eval {
>   include PageAttachmentAssociations
>   include PageAttachmentTags
> }
> --
>
> I restarted my server and tried to edit the page, but got stopped with 
> an error:
>
> SQLite3::SQLException: no such column: page_attachments.archive_page_id: 
> SELECT count(*) AS count_all FROM page_attachments WHERE 
> (page_attachments.archive_page_id = 1)
>
> What I noticed after that was that PageAttachmentAssociations evals the 
> following when it gets included into a class:
>
> has_many :attachments, :class_name => "PageAttachment", :dependent => 
> :destroy
>
> Adding :foreign_key => "page_id" should clear up the error that just 
> stopped us:
>
> has_many :attachments, :class_name => "PageAttachment", :dependent => 
> :destroy, :foreign_key => "page_id"
>
> I restarted my server and tried to attach an image to the Archive page 
> and it worked. So now, the main issue is just figuring out a way to 
> include PageAttachments gracefully into all of the page types when the 
> extension gets activated. Anyone have any ideas?
>   

___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] page_attachments with page type not set to normal.

2007-12-05 Thread Dave Bryand
Sean Cribbs wrote:
> Dave,
> 
> That sounds kind of hack-ish.  The better solution is make sure
> page_attachments loads before anything else.  Uncomment/put this line in
> config/environment.rb:
> 
> config.extensions = [:page_attachments, :all]
> 
> Although I haven't heard of changes to a superclass not propagating to
> subclasses like this, it may have to do with associations.
> 
> Sean

Nice work, Sean. I undid all of my changes and this solution worked 
perfectly!

Thanks!
-- 
Posted via http://www.ruby-forum.com/.
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


[Radiant] page_attachments with page type not set to normal.

2007-12-05 Thread Dave Bryand
Hi,

I'm using the page_attachments extension and it is working fine, except
when I use it on a page that with a page type of anything other than
normal. I saw an old mailing list post about it, but there was no
resolution...anyone else having problems with this?

I'm running 0.6.4 Radiant with mongrel and I have some extensions
installed including default_page_parts.

Thanks!
-- 
Posted via http://www.ruby-forum.com/.
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Getting Radiant rolling on a fresh Dapper install with Deprec

2007-12-05 Thread Andrew Neil

> The easiest way to solve this is to try a "chmod a+w -R", on /var/ 
> www/apps/nomore/current/cache/ .

OK, I tried that and it worked. So that appears to have sourced the  
problem.

> But be aware of security issues.

Indeed. Here is the output from running 'ls -al' from my app  
directory on the server (after resetting permissions with  "chmod 775  
cache"):

drwxrwxr-x  3 deploy deploy   4096 Dec  5 23:09 cache
drwxrwxr-x  4 deploy deploy   4096 Dec  5 23:09 config
drwxrwxr-x  3 deploy deploy   4096 Dec  5 23:09 db
drwxrwxr-x  7 deploy deploy   4096 Dec  5 23:09 public
drwxrwxr-x  5 deploy deploy   4096 Dec  5 23:09 script
drwxrwxr-x  6 deploy app_nomore   4096 Dec  5 23:09 tmp
drwxrwxr-x  5 deploy deploy   4096 Dec  5 23:09 vendor

I notice that the tmp/ directory has different ownership group from  
all other directories. So I tried running "sudo chgrp app_nomore  
cache/", which changed to:

drwxrwxr-x  3 deploy app_nomore   4096 Dec  5 23:09 cache
...
drwxrwxr-x  6 deploy app_nomore   4096 Dec  5 23:09 tmp

Which also works. Does this avoid the security issues mentioned above?

I guess I just have to work out how to add that command to my  
deploy.rb file as a capistrano task now.

Thanks for the tip Aitor!

Drew
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant