Re: [Radiant] Taking advantage of Rails form helpers/partials within Radiant

2010-08-20 Thread Haselwanter Edmund
Hi,

On 20.08.2010, at 07:59, Wes Gamble wrote:

> On 8/19/10 11:05 PM, Wes Gamble wrote:
>> 
>> On 8/16/10 10:36 PM, Wes Gamble wrote:
>>> 
>>> All,
>>> 
>>> I have some custom models which need to be represented in Radiant views, 
>>> and I would like to be able to take advantage of standard Rails partials, 
>>> Rails form helpers, (e.g. all the good things about ActionView). 

Did you have a look at the hare-layouts-extension ?

http://github.com/radiant/radiant-share-layouts-extension
http://wiki.github.com/radiant/radiant/using-radiant-layouts-to-style-extension-controllers

cu edi
--
DI Edmund Haselwanter, edm...@haselwanter.com, http://edmund.haselwanter.com/
http://www.iteh.at | http://facebook.com/iTeh.solutions | 
http://at.linkedin.com/in/haselwanteredmund 







Re: [Radiant] Taking advantage of Rails form helpers/partials within Radiant

2010-08-20 Thread Wes Gamble

 On 8/20/10 2:44 AM, Haselwanter Edmund wrote:

Hi,

On 20.08.2010, at 07:59, Wes Gamble wrote:


On 8/19/10 11:05 PM, Wes Gamble wrote:

On 8/16/10 10:36 PM, Wes Gamble wrote:

All,

I have some custom models which need to be represented in Radiant 
views, and I would like to be able to take advantage of standard 
Rails partials, Rails form helpers, (e.g. all the good things about 
ActionView).


Did you have a look at the hare-layouts-extension ?

http://github.com/radiant/radiant-share-layouts-extension
http://wiki.github.com/radiant/radiant/using-radiant-layouts-to-style-extension-controllers

cu edi
--
DI Edmund Haselwanter, edm...@haselwanter.com 
, http://edmund.haselwanter.com/
http://www.iteh.at | http://facebook.com/iTeh.solutions | 
http://at.linkedin.com/in/haselwanteredmund




Edmund,

I did see this, but I don't think it exactly addresses my issue.  I want 
to render a page where half of my content is provided by a Radiant user, 
and the other half is provided by me (the developer).


share-layouts basically allows us to plug in the holes in the Radiant 
layout from a Rails controller/view pair, but then all of the content 
must come from the Rails app., correct?


In my current scheme, the minimal amount of content that has to be in 
the Rails filesystem is there, and everything else is in Radiant, where 
I want it.


Can you think of a way that I could successfully use share-layouts and 
still render a Radiant managed part in a Rails generated page?


Many thanks,
Wes


Re: [Radiant] Taking advantage of Rails form helpers/partials within Radiant

2010-08-20 Thread Haselwanter Edmund

> Edmund,
> 
> I did see this, but I don't think it exactly addresses my issue.  I want to 
> render a page where half of my content is provided by a Radiant user, and the 
> other half is provided by me (the developer).  

Then I don't understand your use case. Either use radius tags to render your 
data, or use share layouts to populate your data.

> share-layouts basically allows us to plug in the holes in the Radiant layout 
> from a Rails controller/view pair, but then all of the content must come from 
> the Rails app., correct?

hm. radiant is the rails app. 

> In my current scheme, the minimal amount of content that has to be in the 
> Rails filesystem is there, and everything else is in Radiant, where I want 
> it.  
> 
> Can you think of a way that I could successfully use share-layouts and still 
> render a Radiant managed part in a Rails generated page?

http://github.com/screenconcept/radiant-page-part-handling-extension

cu edi
--
DI Edmund Haselwanter, edm...@haselwanter.com, http://edmund.haselwanter.com/
http://www.iteh.at | http://facebook.com/iTeh.solutions | 
http://at.linkedin.com/in/haselwanteredmund 







[Radiant] Re: Taking advantage of Rails form helpers/partials within Radiant

2010-08-20 Thread Mark Reginald James
To render a partial in a tag I've been doing

tag('show_user_status') do |tag|
  response.template.render :partial => 'users/status', :locals =>
{:user => User.find(params[:id])}
end

You can also add scripts and stylesheets to the page head, and use
other view helpers

tag('show_user_status') do |tag|
  view = response.template
  controller = view.controller
  controller.include_javascript 'users'
  controller.include_stylesheet 'users'
  view.content_tag :div, :id => 'user-status-div' do
view.collection_select(:user, :id, User.all, :id, :name, :prompt
=> true) +
response.template.render(:partial => 'users/status', :locals =>
{:user => User.find(params[:id])})
  end
end

or one big String

tag('show_user_status') do |tag|
  %{

  #{response.template.render :partial => 'users/status', :locals
=> {:user => User.find(params[:id])}}

  }
end


I've found it best to use as many custom tags and as few custom Rails
actions as possible, so as to maximize the amount of content able to
be controlled via the web interface.



[Radiant] Re: Taking advantage of Rails form helpers/partials within Radiant

2010-08-20 Thread Mark Reginald James


Mark Reginald James wrote:
> I've found it best to use as many custom tags and as few custom Rails
> actions as possible, so as to maximize the amount of content able to
> be controlled via the web interface.

...page tree. The share-layouts extension allows fixed-parts of custom-
action pages to be user-editable, but you get a proliferation of
layouts, rather than a complete hierarchy of pages.


[Radiant] Save page using ActiveResource

2010-08-20 Thread Cjab
Hi, I'm trying to use ActiveResource to edit radiant pages and running
into some problems. Reading seems to work fine but when I try to save
a page I end up with:

ActiveRecord::AssociationTypeMismatch (PagePart(#70086996993120)
expected, got HashWithIndifferentAccess(#70087036317660)):

So it seems like the parts array is not being recognized as an array
of PageParts but instead just an array of hashes. Has anyone else run
into this problem or have any advice?


[Radiant] Issue with child pages of child pages in 0.9.1

2010-08-20 Thread gommo
We have a structure like
Home
- Page1
- Page2
-- SubPage
-Page3

SubPage above has 8 child pages. Radiant is showing a gray triangle on
it as if you can expand it (i.e. currently rendered as collapsed).
However, whatever we do we can't open it up.

Is there an issue with child pages of child pages?

Thanks


[Radiant] how to view (render) a draft page ?

2010-08-20 Thread nruth
Is there a way for admins to view a page before publishing it?

I can't find mention of this in the docs & 'view site' just loads the
live page's root. Radiant 0.9.1

Cheers, Nick


[Radiant] How to disable cache in development mode, Radiant version 0.9.1

2010-08-20 Thread Jurgen
It is said in config/environment.rb that you need to comment out
following line in order to disable a cache. System is running in
development mode under mongrel


# config.middleware.use ::Radiant::Cache


The thing is that disregarding of this line was commented or not, it
still performs caching.


cache: [GET /] fresh


Which is even more amazing, I can't see anything in cache or tmp/cache
folder - both just empty. If it caches - where cache get stored?
I'm at loss, please help.




Re: [Radiant] how to view (render) a draft page ?

2010-08-20 Thread Marshal Linfoot
You'll want to install the page_preview extension:
http://ext.radiantcms.org/extensions/58-page-preview

On Sun, Aug 15, 2010 at 8:33 AM, nruth  wrote:

> Is there a way for admins to view a page before publishing it?
>
> I can't find mention of this in the docs & 'view site' just loads the
> live page's root. Radiant 0.9.1
>
> Cheers, Nick




-- 
marshal


Re: [Radiant] Taking advantage of Rails form helpers/partials within Radiant

2010-08-20 Thread Wes Gamble

 On 8/20/10 5:27 AM, Haselwanter Edmund wrote

Edmund,

I did see this, but I don't think it exactly addresses my issue.  I want to 
render a page where half of my content is provided by a Radiant user, and the 
other half is provided by me (the developer).

Then I don't understand your use case. Either use radius tags to render your 
data, or use share layouts to populate your data.



share-layouts basically allows us to plug in the holes in the Radiant layout 
from a Rails controller/view pair, but then all of the content must come from 
the Rails app., correct?

hm. radiant is the rails app.


I misspoke here (it was late), what I meant was to distinguish between 
the two render paths available to me in the Rails app. - either 
SiteController - driven [Radiant - managed rendering] or standard Rails 
rendering.  As far as I can tell, these two render paths are effectively 
mutually exclusively across the entire page.   Either my entire page is 
rendered by Radius tags, or my entire page is rendered by share layouts.


Neither of these is sufficient if I need to render both content 
contained inside of Radiant and content that comes from a standard Rails 
request _in the same page_.


Specifically, in my applicaiton - in one page, I have a piece of content 
that is rendered at the top of the page, and then a form that needs to 
be rendered at the bottom.  Truth be told, I could use the forms 
extension to render the form, but having to hand-code all of the field 
attributes was distasteful to me, when I could use a standard Rails form 
builder based view, do it in Haml, and have the form view be more 
readable, etc.  What I probably _should_ do is change the forms 
extension to be able to take advantage of the form builder stuff in 
Rails, so that writing out a Radius form isn't as tedious as it is now.


Having said all of that, I'm pretty happy with what I have so far as it 
gives me what I think is more flexibility.


I looked at the page-part extension as well, but it didn't seem to 
address my issue, since one of my parts would be one of these forms.


I will keep thinking about it.  It's certainly possible that there is a 
more elegant solution.


Many thanks,
W


Re: [Radiant] Re: Taking advantage of Rails form helpers/partials within Radiant

2010-08-20 Thread Wes Gamble

 On 8/20/10 6:54 AM, Mark Reginald James wrote:

To render a partial in a tag I've been doing

tag('show_user_status') do |tag|
   response.template.render :partial =>  'users/status', :locals =>
{:user =>  User.find(params[:id])}
end

You can also add scripts and stylesheets to the page head, and use
other view helpers

tag('show_user_status') do |tag|
   view = response.template
   controller = view.controller
   controller.include_javascript 'users'
   controller.include_stylesheet 'users'
   view.content_tag :div, :id =>  'user-status-div' do
 view.collection_select(:user, :id, User.all, :id, :name, :prompt
=>  true) +
 response.template.render(:partial =>  'users/status', :locals =>
{:user =>  User.find(params[:id])})
   end
end

or one big String

tag('show_user_status') do |tag|
   %{
 
   #{response.template.render :partial =>  'users/status', :locals
=>  {:user =>  User.find(params[:id])}}
 
   }
end


I've found it best to use as many custom tags and as few custom Rails
actions as possible, so as to maximize the amount of content able to
be controlled via the web interface.
I went down this path, but ultimately, going through all of the effort 
to "manually" render a template and then wrapping it up in a Radius tag 
didn't seem worth it to me.


The Radiant user does get to control the :locals data that is passed in 
to the partial, but the partial still lives outside of Radiant, so the 
raw content is still outside of Radiant.


What I didn't realize is that it looks like you have access to the HTTP 
response in the custom tag - is that correct?  That's quite helpful.


I may try to do something like this in the future if it makes sense.  
Thanks for the info.


Wes






[Radiant] Getting the position of a child page within the list of children for its parent

2010-08-20 Thread Wes Gamble

 All,

I have a page X, which has several children pages underneath it (say, 10).

Is there any relatively easy way to derive the index of a given child of 
X in the list of children of X?  So, for example, for the 3rd child, I 
need to be able to get a 3 somehow in order to construct links.


I'm displaying children using  and I'm generating direct 
links to the children.  I'd like these direct links to reflect the 
pagination within the context of the parent.


So, for example, I want a link to the 3rd page of X that looks just like 
the link I get from paginating X, which is: /x/?page=3


I tried just forcing the slugs to be these types of links, but get a bad 
format error when I try to save the page.


This doesn't seem like it would be that hard to add a tag that derives a 
child's location within it's set of siblings underneath a parent, if I 
had to.


Many thanks,
Wes


Re: [Radiant] Getting the position of a child page within the list of children for its parent

2010-08-20 Thread Wes Gamble

 On 8/20/10 3:04 PM, Wes Gamble wrote:

All,

I have a page X, which has several children pages underneath it (say, 10).

Is there any relatively easy way to derive the index of a given child 
of X in the list of children of X?  So, for example, for the 3rd 
child, I need to be able to get a 3 somehow in order to construct links.


I'm displaying children using  and I'm generating direct 
links to the children.  I'd like these direct links to reflect the 
pagination within the context of the parent.


So, for example, I want a link to the 3rd page of X that looks just 
like the link I get from paginating X, which is: /x/?page=3


I tried just forcing the slugs to be these types of links, but get a 
bad format error when I try to save the page.


This doesn't seem like it would be that hard to add a tag that derives 
a child's location within it's set of siblings underneath a parent, if 
I had to.


Many thanks,
Wes


I've created a custom tag named "child_position" for this, and I'm very 
close to getting it working.  Here's the tag definition - this is, of 
course, executed within the context of a  tag:


tag "child_position" do |tag|
   if parent = tag.locals.page.parent
  parent.children.index(tag.locals.page)
   end
end

but nothing gets output.  I've verified that the parent object is a 
page, that it has children, and that tag.locals.page is a page.


What am I doing wrong?

Thanks,
Wes