Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Best way to do conditional body tag in HAML
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
  9 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:
Followup To:
Add Cc | Add Followup-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 you hear
 
Noel_g  
View profile  
 More options Jun 23, 4:00 pm
From: Noel_g <wwydi...@gmail.com>
Date: Tue, 23 Jun 2009 13:00:35 -0700 (PDT)
Local: Tues, Jun 23 2009 4:00 pm
Subject: Best way to do conditional body tag in HAML
Following up on this compass thread

http://groups.google.com/group/compass-users/browse_thread/thread/fbe...

What would be the best way to implement the conditional body tag in my
HAML layout?

http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer...

I thought I could do
/[if !IE]
%body
/[endif]

but that doesn't work.  On the Compass thread someone mentioned that
it would need to be done in erb.

So would I do

:erb
  <!--[if !IE]>--> <body> <!--<![endif]-->

Is this the best way to do this?


    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.
scottwb  
View profile  
 More options Jun 23, 4:11 pm
From: scottwb <scot...@gmail.com>
Date: Tue, 23 Jun 2009 13:11:53 -0700 (PDT)
Local: Tues, Jun 23 2009 4:11 pm
Subject: Re: Best way to do conditional body tag in HAML
I bet somebody has a better way, but here's something I've done before
- capture the haml and then render it with or without the %body based
on your conditional. Not real pretty, but at least the ugliness is
mostly just confined to the top and bottom of the file. Something like
this:

- body = capture_haml do
  - ...haml for everything in layout...

- if request.env['HTTP_USER_AGENT'] !~ /msie/i
  %body= body
- else
  = body


    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.
Nathan Weizenbaum  
View profile  
 More options Jun 23, 11:45 pm
From: Nathan Weizenbaum <nex...@gmail.com>
Date: Tue, 23 Jun 2009 20:45:14 -0700
Local: Tues, Jun 23 2009 11:45 pm
Subject: Re: [haml] Re: Best way to do conditional body tag in HAML

For this sort of thing, I just use a simple string-manipulating helper:
http://gist.github.com/134988


    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.
Chris Eppstein  
View profile  
 More options Jun 23, 11:48 pm
From: Chris Eppstein <ch...@eppsteins.net>
Date: Tue, 23 Jun 2009 20:48:06 -0700
Local: Tues, Jun 23 2009 11:48 pm
Subject: Re: [haml] Re: Best way to do conditional body tag in HAML

That's pretty sweet.
chris


    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.
Noel  
View profile  
 More options Jun 24, 12:39 am
From: Noel <wwydi...@gmail.com>
Date: Tue, 23 Jun 2009 21:39:43 -0700
Local: Wed, Jun 24 2009 12:39 am
Subject: Re: [haml] Re: Best way to do conditional body tag in HAML
how do you use that? ...n00b


    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.
Bradley Grzesiak  
View profile  
 More options Jun 24, 12:44 am
From: Bradley Grzesiak <listro...@gmail.com>
Date: Tue, 23 Jun 2009 23:44:27 -0500
Local: Wed, Jun 24 2009 12:44 am
Subject: Re: [haml] Re: Best way to do conditional body tag in HAML

I'm guessing:

conditional_body do
  rest of haml document

Just make sure to put that gist in a helper... most likely in the
application helper if you're going to use it everywhere.

:brad

--
Bradley Grzesiak
listro...@gmail.com
http://toleoandbeyond.blogspot.com

* You have received an email from my personal account. Please do not divulge
this address to any website (eg: evite, shutterfly, etc). I have another
address for such uses; please ask me for it.


    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.
Chris Eppstein  
View profile  
 More options Jun 24, 12:46 am
From: Chris Eppstein <ch...@eppsteins.net>
Date: Tue, 23 Jun 2009 21:46:30 -0700
Local: Wed, Jun 24 2009 12:46 am
Subject: Re: [haml] Re: Best way to do conditional body tag in HAML

Like this:
!!!
%html
  %head
    %title This is the tile
  - conditional_body do
    %p
      This is text in the body.

-chris


    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.
Bradley Grzesiak  
View profile  
 More options Jun 24, 12:48 am
From: Bradley Grzesiak <listro...@gmail.com>
Date: Tue, 23 Jun 2009 23:48:34 -0500
Local: Wed, Jun 24 2009 12:48 am
Subject: Re: [haml] Re: Best way to do conditional body tag in HAML

right... the hyphen... don't forget that.

*slaps forehead*

nice helper by the way. i look forward to never having to use it because all
browsers are standards compliant (in about 40 years). =)

:brad

On Tue, Jun 23, 2009 at 11:46 PM, Chris Eppstein <ch...@eppsteins.net>wrote:

--
Bradley Grzesiak
listro...@gmail.com
http://toleoandbeyond.blogspot.com

* You have received an email from my personal account. Please do not divulge
this address to any website (eg: evite, shutterfly, etc). I have another
address for such uses; please ask me for it.


    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.
Noel  
View profile  
 More options Jun 24, 12:58 am
From: Noel <wwydi...@gmail.com>
Date: Tue, 23 Jun 2009 21:58:38 -0700
Local: Wed, Jun 24 2009 12:58 am
Subject: Re: [haml] Re: Best way to do conditional body tag in HAML
thanks, that's cool


    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