Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
pass variables to layouts as well as partials
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
JoeE  
View profile   Translate to Translated (View Original)
 More options 26 Oct, 12:58
From: JoeE <joeegan1...@googlemail.com>
Date: Mon, 26 Oct 2009 05:58:49 -0700 (PDT)
Local: Mon 26 Oct 2009 12:58
Subject: pass variables to layouts as well as partials
I think this would be a powerful feature to add, even though it would
not exactly add any functionality - it would save gluing a load of
partials together allowing users' code to be more linear.

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg DeVore  
View profile   Translate to Translated (View Original)
 More options 26 Oct, 14:23
From: Greg DeVore <greg.dev...@gmail.com>
Date: Mon, 26 Oct 2009 07:23:10 -0700 (PDT)
Local: Mon 26 Oct 2009 14:23
Subject: Re: pass variables to layouts as well as partials
You can already do this. Just set an instance variable in the src
file. You can add logic in the layout to handle it accordingly. I do
this to emulate the content_for functionality of rails all the time in
my staticmatic sites.

Greg

On Oct 26, 8:58 am, JoeE <joeegan1...@googlemail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
JoeE  
View profile   Translate to Translated (View Original)
 More options 26 Oct, 15:13
From: JoeE <joeegan1...@googlemail.com>
Date: Mon, 26 Oct 2009 08:13:39 -0700 (PDT)
Local: Mon 26 Oct 2009 15:13
Subject: Re: pass variables to layouts as well as partials
Cool - I'm not too ruby savvy - could you provide an example?

Thanks,

Joe

On 26 Oct, 14:23, Greg DeVore <greg.dev...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg DeVore  
View profile   Translate to Translated (View Original)
 More options 26 Oct, 17:35
From: Greg DeVore <greg.dev...@gmail.com>
Date: Mon, 26 Oct 2009 10:35:59 -0700 (PDT)
Local: Mon 26 Oct 2009 17:35
Subject: Re: pass variables to layouts as well as partials
Here is a gist with some excerpts:

http://gist.github.com/218838

In this example, sometimes I want to show a subnavigation and
sometimes I don't. In the layout I check for the existence of the
@sub_nav variable. If it is present then I output the requisite html.

In the page file I assign a partial to the @sub_nav variable. This
lets me easily assign blocks of html to a variable.

You could also just use a ture/false approach, i.e. @sub_nav = true,
and then in the layout:

if @sub_nav == true do
  #subnav

Does that help?

Greg

On Oct 26, 11:13 am, JoeE <joeegan1...@googlemail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
JoeE  
View profile   Translate to Translated (View Original)
 More options 26 Oct, 17:53
From: JoeE <joeegan1...@googlemail.com>
Date: Mon, 26 Oct 2009 10:53:15 -0700 (PDT)
Local: Mon 26 Oct 2009 17:53
Subject: Re: pass variables to layouts as well as partials
Greg that is really clear - and really simple - I never thought about
defining a variable of a partial - thanks a lot,

Joe

On 26 Oct, 17:35, Greg DeVore <greg.dev...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google