haml

How can I make errors in HAML (Rails) show me the exact line where the error occurred?

NoMethodError in course_templates#index Showing app/views/course_templates/index.haml where line #6 raised: undefined method `new_course_template' for #<ActionView::Base:0x237c3e4> Extracted source (around line #6): 3: - content_for :sidebar do 4: %ul.links 5: %li= link_to "Add a Template", new_course_template(@provider) ...

rails html helper

I'm trying to figure out the cleanest way to generate a bit of html AND nest content inside it. Using HAML. Basically I want to do something like: = block_large This is some nested content And that should generate: <div class="block large"> <img src="block_large_carat.gif" class="block_large_carat"> This is some nested content...

conditional haml - if else nesting

What I want is both whats in "if" and whats in "else" to include #main-block. - if @transparency #content-inner{:style => "background: url(../../../images/illustrations/" + @transparency + ") no-repeat 88% 50%"} - else #content-inner #main-block What happens currently is, if @transparency is defined, #main-block is not neste...

haml syntax - better way of writing this?

There must be a better way of writing this- I'm just not sure how (using staticmatic)- - if current_page.include? "0.html" - @current_index = 1 - if current_page.include? "1.html" - @current_index = 2 - if current_page.include? "2.html" - @current_index = 3 - if current_page.include? "3.html" - @current_index = 4 - if current_pa...

haml syntax - better way of writing this?

I have a config file full of this.... - if current_page.include? "test_string_one" - @total_index = 3 - @next_location = '../random_string/page0.html' - @next_name = 'title 2' - if current_page.include? "test_string_two" - @total_index = 10 - @next_location = '../another_random_string/page0.html' ...

Why does a rails app on heroku serve assets via all.css and locally via individual files

I'm a rails newbie, I've been trying to figure out what is going on with the stylesheets_link_tag on heroku. If I use = stylesheet_link_tag "style", :cache => true heroku uses "all.css" and does not pick up the stylesheet, but if I use = stylesheet_link_tag "style", :cache => false it serves the stylesheet using its name "style.c...

Referencing a SASS file from HAML

How do I reference a .sass file from a .haml file? I have the following haml expression that will reference a .css file: %link{'href' => '/stylesheets/layout.css?cache=1', 'rel' => 'stylesheet', 'type' => 'text/css'}/ How do I reference a .sass file? ...

How can I use Haml with Catalyst?

Is it possible to use Haml instead of a templating engine with the Catalyst web framework? ...

Feasibility of HAML + PHP/CakePHP

Is anyone using a HAML implementation for PHP like phpHaml or pHAML? Both projects have seen no activity for about 2 years, and both are < 1.0. Is it feasible/wise to use HAML for a large PHP application, or is it too immature? Does anybody have experience with Chaml for CakePHP? I played around with it, and it seems to be really picky ...

ruby - if string is not contained within an array

I only want to output one anchor here. If the current_page is in the array I get two (.html and -nf.html). If it is not in the array I get as many anchors as there are items in the array. I am using StaticMatic. - if page_options[:current_index] < page_options[:total_index] && page_options[:current_index] > 0 // loop through the ...

How to debug broken vim completefunc in haml files?

I'm using rails.vim and I love how you can use ctrl-x ctrl-u in insert mode to autocomplete long method names like distance_of_time_in_words and accepts_nested_attributes_for. But for some reason it doesn't work in haml files and I can't seem to figure out what's wrong or how to fix it. :help i_CTRL-X_CTRL-U says the autocompletion is u...

haml syntax - nesting partial properties

what i want is a way of nesting partial properties, this seems a tad long winded: = partial('frames/tabs_a', :locals => {:tabs_title => 'semi-dynamic-tabs', :tabs_id => 'p001', :panel_a => 'views/article-highlights_a', :a_id => 'p_002_0', :a_ft => '123 More in highlights', :a_tt => 'panel a', :a_c => 'magazine', :panel_b...

possible to define an array in Sass?

wondering if it is possible to use an array with Sass as I find my self repeating the following sort of thing: .donkey h2 background-color= !donkey .giraffe h2 background-color= !giraffe .iguana h2 background-color= !iguana ...

Using HAML elements inside a block of text

I often want some html like this: (<span id="items_shown">all</span> items shown) which I end up getting by using haml like this: %span>< ( %span#items_shown>< all %span items shown) Note that I end up having to create extra spans, and then having to control for the whitespace around those spans, in order to get the exact syn...

Haml installation in Rails app failing

I have a small rails app I got all gung-ho on tonight wanting to convert all the erb to haml templates. The Haml docs suggest running haml --rails /path/to/app to install it as a plugin (using the gem already installed on the system). Unfortunately, when I attempt to start the webserver for rails, I receive the following error: /code/s...

How to write a HAML custom filter?

I have written a simple custom filter in HAML but I cannot get my Rails app to find it. The filter looks like this: # lib/haml/filters/gfmarkdown.rb module Haml::Filters::Gfmarkdown include Haml::Filters::Base # copied from Haml::Filters::Markdown lazy_require 'rdiscount', 'peg_markdown', 'maruku', 'bluecloth' def render(text...

InvalidAuthenticityToken for JQuery despite setting authenticity token

I'm getting an InvalidAuthenticityToken despite adding in corresponding authenticity tokens in the jquery response. Is there an error in the code, or is there another, root problem? I appreciate any comments. Thanks! Using: Rails 2.3.3, Ruby 1.8.6, Webrick, JQuery 1.3.2 layout/networks.html.haml = token_tag = javascript_tag "window.AU...

textile and maruku problem

Hi, all. I've developed custom filters for HAML (http://github.com/alec-c4/cb-haml-filters) and have a small problem with textile and maruku. Maybe you can help me with this Problem with textile with code %h2 Textile test :cbtextile h4. YouTube video http://www.youtube.com/watch?v=0_IXrjqKbE4&amp;feature=player_embedded ...

HAML with pre, how to remove unwanted intend?

I have problem with <pre>, here is my code, please check my screenshot attached, how to remove those indents? %pre.code :escaped <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html> <head></head> <body>...

Javascript HAML engine

I'm looking for a javascript 'port' of haml supporting the following features: Templates stored in files. JSON input. Supports "collections" [{Booking},{Booking},{Booking}] for iterated processing. Essentially I'd like the functionality as sinatra_more's templates. Does anyone know of something that fits the bill? ...