Created
October 7, 2012 19:44
-
-
Save bbttxu/3849351 to your computer and use it in GitHub Desktop.
#PROBLEM: how to render HAML in helper like in a view? likely Ruby or Rails issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def li_link_to(text, url, options = nil) | |
link_to_unless_current text, url, options do |text, url, options| | |
Haml::Engine.new("%li.active= link_to(#{text}, #{url}, #{options})").render | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%html | |
/ paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ | |
/[if lt IE 7 ] <html class="ie6" lang="en"> | |
/[if IE 7 ] <html class="ie7" lang="en"> | |
/[if IE 8 ] <html class="ie8" lang="en"> | |
/[if (gte IE 9)|!(IE)] <html lang="en"> | |
%head | |
%meta{ :charset => "utf-8" } | |
/ Uncomment to make IE8 render like IE7 | |
/ <meta http-equiv="X-UA-Compatible" content="IE=7"/> | |
/ Set the viewport width to device width for mobile | |
%meta( name="viewport" content="width=device-width, initial-scale=1.0") | |
%title= content_for?(:title) ? yield(:title) : "Untitled" | |
/ Included CSS Files | |
= stylesheet_link_tag "application" | |
/ Included JS Files | |
= javascript_include_tag "application" | |
= csrf_meta_tags | |
%body | |
%h1 QCBS | |
%ul#navigation | |
= li_link_to 'Current', '/shops/current' | |
%li | |
%a{ :href=>"/shops" } Shops | |
%li | |
%a{ :href=>"/volunteers" } Volunteers | |
%li | |
%a{ :href=>"/sessions"} Sessions | |
= yield |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment