haml

testing helpers with 'haml_tag'

module FooHelper def foo haml_tag(:div) do haml_content("bar") end end end When I test this I get: NoMethodError: undefined method `haml_tag' This code is perfectly valid and works in a development/production environment. It's something to do with having the haml helpers properly loaded in the test environment. Th...

Haml - how do I force tag attributes to use double quotes only AND how do I order tag attributes the way I wan't?

I use staticmatic for templates I use later with PHP. There is an odd situation where some tag attributes have single quotes, while some have double quotation marks. I would like all of them to have double quotes exclusively (not that it matters I guess, but I want them like that!) For example, haml code: !!! XML %html{html_attrs('hr-H...

Is there a good HAML -> ERB/HTML converter?

I'm looking for a reliable way to convert a HAML template to an equivalent ERB/HTML template? Has anyone come across one? ...

Rails HAML conversion problems - unexpected kENSURE, expecting kEND

I'm trying to switch over to using HAML for my views but I keep getting unexpected KENSURE messages. I've used html2haml to switch over working view files. First run through it told me I didn't need the end that html2haml had in its output so I removed it and now I get errors that look like it is complaining about the form not being e...

my rails ApplicationController is having a RoutingError

I am by no means a Ruby developer, but I code HAML for a ruby framework on my localhost. I had originally put a file called vidgirlBox2.flv file and called to it within the HAML, but converted the file to a swf called vidGirl_home.swf . This swf worked. Until I made a simple change to the orginal .fla, and overwrote the vidGirl_home...

How do you write tr:nth-child(odd) in Sass?

Is this sass code valid? tr:nth-child(odd) :background-color #cccccc Somehow, it does not color my table's alternating rows. ...

Are HAML and Sass requirements for working with Compass?

How interdependent are Haml, Sass and Compass? Are all three required in a Compass project? ...

Rails 2.3.2 trying to render ERB instead of HAML

Rails is suddenly trying to render ERB instead of Haml and I can't figure out why. I've created new rails projects, reinstalled Haml, and reinstalled Rails. Here's exactly the steps I take when making my application (Rails 2.3.2): rails> rails test rails> cd test rails\test> haml --rails . rails\test> ruby script\generate model...

Pair of blocks in each?

As in the standart cycle: - @goods.each do |good| ??? ...to organize this (HAML): .columns-wrapper .column First good .column Second good .column Third good .columns-wrapper .column Fourth good .column Fifth good .column Sixth good ...

ERB vs HAML conversion of an if condition?

I am getting started with HAML and am working on my converting my first file. The ostensibly correct omission of the "- end": - if current_user = link_to 'Edit Profile', edit_user_path(current_user.id) = link_to 'Logout', logout_path - else = link_to 'Register', new_user_path = link_to 'Login', login_path gets me: app/views/layouts/a...

How do I make an image link tag using haml in Rails?

I have something like this in application.html.haml: #header = image_tag("header.jpg") How do I make that link to www.google.com, for example? Thanks ...

Passing options to Haml on the command line

I'm using Haml from the command-line to do a basic transform of one .haml file to .html, like this: > haml input.haml output.html Thing is, this produces single-quotes around attributes in the resulting HTML. So how to I pass in the :attr_wrapper => '"' option from the command-line? Alternatively, can I just globally set :attr_wrappe...

Rails duplicating view

Hi, I'm trying to display all @user.notes on my index action of the user_controller, and provide a form below to add a new note, inline. Pretty simple code that I've gleaned from a few tutorials, but what's happening is my view is completely duplicated. It spits out 2 copies of the same html. Still pretty new to rails so I'm having a ...

Very strange problem with Gettext and Haml on Rails / rake updatepo broke

Hi, I'm on Rails 2.3.3 and using Haml 2.0.9 for my templates and Gettext-Rails 2.0.4 for the translation. Haml works like a charm and gettext is also working like it should. But I cant get Gettext to parse Haml Files when using "rake updatepo". I created a custom parser like this: # lib/haml_parser.rb require 'gettext_rails/tools' req...

Rails -- How to save HTML output of a HAML partial as a string to send to an external service?

Hey guys, first post here, hope you can help me out. We're generating a newsletter automatically every 24 hours using a rake task. There's a section at the top of the newsletter where an admin can put a customized message. The screen that the admin uses has a live preview of the newsletter (they were insistent on this), rendered using...

Haml: Control whitespace around text

In my Rails template, I'd like to accomplish final HTML to this effect using HAML: I will first <a href="http://example.com"&gt;link somewhere</a>, then render this half of the sentence if a condition is met The template that comes close: I will first = link_to 'link somewhere', 'http://example.com' - if @condition , then render th...

Haml/Sass Syntax Highlighting in Notepad++?

Has anybody made this yet? ...

refactor conditions within haml view

beside the fact that accessibility standards discourage the use of a link pointing to the current page, how I am supposed to refactor the following view code? #navigation %ul.tabbed - if current_page?(new_profile_path) %li{:class => "current_page_item"} = link_to t("new_profile"), new_profile_path - else %...

Is there a way to write a single expression over multiple lines in haml?

I have this in one of my haml views: -form_for :news_item_comment, :url=>{:id => comment.id, :controller => 'comment' , :action => 'add_comment'}, :html => {:id => "form-#{comment.id}"} do |f| ... Since it's really long and hard to read I want to split it over 2 lines. Is there anyway to do this without violating haml's whites...

Rendering HAML partials from within HAMLoutside of Rails

I'm using HAML to generate some static html pages for a site, and I was wanting to split out common components into partials that I can include in multiple pages, just like in Rails. However I don't want to use the whole Rails stack to do this as it seems like overkill. I've looked around on the Internet but haven't found anything, bett...